-
-
Save robotarmy/2257596 to your computer and use it in GitHub Desktop.
Revisions
-
robotarmy revised this gist
Mar 31, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -52,7 +52,7 @@ class GitHub end end body[:labels] = r['Labels'].split(',').map {|l|l.strip} if r['Labels'] != '' p json_body = JSON.generate(body) -
robotarmy revised this gist
Mar 31, 2012 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -33,6 +33,7 @@ class GitHub if r['Labels'] != '' r['Labels'].split(',').each do |label| label = label.strip color ='' 3.times { color << "%02x" % rand(255) @@ -43,7 +44,8 @@ class GitHub end labels.each do |label| p label # this hack doesn't care if you have an existing label - it just errors and moves on like a zen master # the server however is expected to be equally zen :D visited_labels << label[:name] label = GitHub.post '/repos/robotarmy/driveless/labels', :body => JSON.generate(label) p label -
robotarmy revised this gist
Mar 31, 2012 . 1 changed file with 7 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,6 +21,8 @@ class GitHub password = get_input("Enter Password >", "*") GitHub.basic_auth user, password visited_labels = [] FasterCSV.open filename, :headers => true do |csv| csv.each do |r| body = { @@ -35,12 +37,14 @@ class GitHub 3.times { color << "%02x" % rand(255) } unless visited_labels.include? label labels << {:name => label, :color =>color} end end labels.each do |label| p label visited_labels << label[:name] label = GitHub.post '/repos/robotarmy/driveless/labels', :body => JSON.generate(label) p label end -
robotarmy revised this gist
Mar 31, 2012 . 1 changed file with 27 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ #encoding:UTF-8 #!/usr/bin/env ruby require 'rubygems' require 'FasterCSV' require 'httparty' require 'json' require 'highline/import' def get_input(prompt="Enter >",show = true) ask(prompt) {|q| q.echo = show} end class GitHub include HTTParty base_uri 'https://api.github.com' end user = get_input("Enter Username >") password = get_input("Enter Password >", "*") GitHub.basic_auth user, password labels = GitHub.get '/repos/robotarmy/driveless/labels' labels.each do |label| p GitHub.delete label['url'].split(GitHub.base_uri).last end -
robotarmy revised this gist
Mar 31, 2012 . No changes.There are no files selected for viewing
-
robotarmy revised this gist
Mar 31, 2012 . 1 changed file with 37 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,34 +1,63 @@ #encoding:UTF-8 #!/usr/bin/env ruby require 'rubygems' require 'FasterCSV' require 'httparty' require 'json' require 'highline/import' def get_input(prompt="Enter >",show = true) ask(prompt) {|q| q.echo = show} end filename = ARGV.shift or raise "Enter Filepath to CSV as ARG1" class GitHub include HTTParty base_uri 'https://api.github.com' end user = get_input("Enter Username >") password = get_input("Enter Password >", "*") GitHub.basic_auth user, password FasterCSV.open filename, :headers => true do |csv| csv.each do |r| body = { :title => r['Story'], :body => r['Description'], } labels = [] if r['Labels'] != '' r['Labels'].split(',').each do |label| color ='' 3.times { color << "%02x" % rand(255) } labels << {:name => label, :color =>color} end labels.each do |label| p label # this hack doesn't care if you have an existing label - it just errors and moves on like a zen master # the server however is expected to be equally zen :D label = GitHub.post '/repos/robotarmy/driveless/labels', :body => JSON.generate(label) p label end end body[:labels] = r['Labels'].split(',') if r['Labels'] != '' p json_body = JSON.generate(body) issue = GitHub.post '/repos/robotarmy/driveless/issues', :body => json_body p issue r.each do |f| if f[0] == 'Note' next unless f[1] body = { :body => f[1] } GitHub.post "/repos/robotarmy/driveless/issues/#{issue.parsed_response['number']}/comments", :body => JSON.generate(body) end end end -
visnu pitiyanuvath created this gist
Jul 31, 2011 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,35 @@ #!/usr/bin/env ruby require 'rubygems' require 'FasterCSV' require 'httparty' require 'json' class GitHub include HTTParty base_uri 'https://api.github.com' basic_auth user, password end FasterCSV.open ARGV.shift, :headers => true do |csv| csv.each do |r| # POST /repos/nko2/website/issues # title, body, assignee, milestone, labels body = { :title => r['Story'], :body => r['Description'], } body[:labels] = [ r['Labels'] ] if r['Labels'] != '' issue = GitHub.post '/repos/nko2/website/issues', :body => JSON.generate(body) p issue r.each do |f| if f[0] == 'Note' next unless f[1] # POST /repos/nko2/website/issues/:id/comments body = { :body => f[1] } GitHub.post "/repos/nko2/website/issues/#{issue.parsed_response['number']}/comments", :body => JSON.generate(body) end end end end