Skip to content

Instantly share code, notes, and snippets.

@coderanger
Created April 10, 2012 07:02
Show Gist options
  • Save coderanger/2348932 to your computer and use it in GitHub Desktop.
Save coderanger/2348932 to your computer and use it in GitHub Desktop.
Clean up after Gemnasium
require 'octokit'
c = Octokit::Client.new(:login => "...", :password => "...")
conn = c.instance_exec{connection}
c.repos.each do |r|
puts "Trying to unsub #{r.name}"
begin
conn.get("/repos/#{c.login}/#{r.name}/hooks").body.each do |hook|
if hook.name == 'gemnasium'
conn.delete "/repos/#{c.login}/#{r.name}/hooks/#{hook.id}"
end
end
rescue SignalException => e
raise e
rescue Exception => e
puts "Error: #{e.to_s}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment