Permalink
Browse files

add dumper script

  • Loading branch information...
1 parent b123857 commit 61d9d04f32d6265ceba310a0c1e1019a7f14550d @bronson bronson committed Aug 24, 2010
Showing with 26 additions and 1 deletion.
  1. +2 −0 .gitignore
  2. +20 −0 dumper
  3. +4 −1 scraper
View
@@ -0,0 +1,2 @@
+token
+repos
View
20 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)
+
View
@@ -3,6 +3,7 @@
require 'rubygems'
require 'hpricot'
require 'open-uri'
+require 'json'
def scrape_author(user_id)
@@ -42,4 +43,6 @@ def scrape_script(script_id)
s
end
-pp scrape_script(1567)
+
+puts JSON.pretty_generate(scrape_script(1567))
+

0 comments on commit 61d9d04

Please sign in to comment.