Skip to content

Commit

Permalink
add dumper script
Browse files Browse the repository at this point in the history
  • Loading branch information
bronson committed Aug 24, 2010
1 parent b123857 commit 61d9d04
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
@@ -0,0 +1,2 @@
token
repos
20 changes: 20 additions & 0 deletions dumper
@@ -0,0 +1,20 @@
#!/bin/env ruby

require 'rubygems'
require 'json'
require 'grit'

repos_dir = 'repos'

script = JSON.parse($stdin.read)
Dir.mkdir repos_dir unless test ?d, repos_dir
repo_path = File.join(repos_dir, script['name'] + '.git')
repo = Grit::Repo.init_bare_or_open(repo_path)

script['versions'].reverse.each do |version|
puts "#{version['date']} #{version['script_version']}"
end

# token = File.read('token').chomp
# client = Octopussy::Client.new(:login => 'vim-scripts', :token => token)

5 changes: 4 additions & 1 deletion scraper
Expand Up @@ -3,6 +3,7 @@
require 'rubygems' require 'rubygems'
require 'hpricot' require 'hpricot'
require 'open-uri' require 'open-uri'
require 'json'




def scrape_author(user_id) def scrape_author(user_id)
Expand Down Expand Up @@ -42,4 +43,6 @@ def scrape_script(script_id)
s s
end end


pp scrape_script(1567)
puts JSON.pretty_generate(scrape_script(1567))

0 comments on commit 61d9d04

Please sign in to comment.