Skip to content

Instantly share code, notes, and snippets.

@IanVaughan
Created May 29, 2012 14:03
Show Gist options
  • Save IanVaughan/2828604 to your computer and use it in GitHub Desktop.
Save IanVaughan/2828604 to your computer and use it in GitHub Desktop.
Quick hack to get a list of all our repos
# curl -u "user:password" https://api.github.com/orgs/:org/repos
require 'httparty'
require 'pp'
class GitHub
include HTTParty
base_uri 'https://api.github.com'
def initialize(u, p)
@auth = {:username => u, :password => p}
end
def repos repo
self.class.get("/orgs/#{repo}/repos", {:basic_auth => @auth})
end
end
repos = GitHub.new('user','pass').repos('org')
repos.each do |r|
puts r['name']
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment