Skip to content

Instantly share code, notes, and snippets.

@felton
Forked from manveru/get-github-wiki.rb
Created February 13, 2012 16:38
Show Gist options
  • Save felton/1818055 to your computer and use it in GitHub Desktop.
Save felton/1818055 to your computer and use it in GitHub Desktop.
Download github wikis
require 'open-uri'
require 'hpricot'
user, project = ARGV # 'tobi', 'liquid'
fail "get-github-wiki <username> <projectname>" unless user and project
uri = "http://wiki.github.com/#{user}/#{project}"
xpath = "div.sidebar/ul[1]//a"
command = %w[wget -t 2 -mkc --no-parent]
(Hpricot(open(uri))/xpath).each do |a|
cmd = command.dup << a[:href]
puts cmd
system(*cmd)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment