Class | GitHub::Repo |
In: |
lib/git_hub/repo.rb
|
Parent: | GitHub::Base |
GITHUB_SERVICES | = | { #[github] # user = user # token = token # :donate => {:path => '/edit/donate', :inputs => ['paypal']} # homepage = homepage_url # webhooks => {:path => '/edit/postreceive_urls', :fields => [] #http://rdoc.info/projects/update, http://runcoderun.com/github, http://api.devver.net/github # basecamp = url, username, password, project, category # cia = true # campfire = subdomain, username, password, room, ssl, play_sound # email = arvitallian@gmail.com # fogbugz = cvssubmit_url, fb_version, fb_repoid # friendfeed = nickname, remotekey # irc = server, port, room, password, nick, ssl # jabber = user # lighthouse = subdomain, project_id, token, private # presently = subdomain, group_name, username, password # rubyforge = username, password, grupid # runcoderun = true # trac = url, token # twitter = username, password, digest } |
watchers= | -> | followers= |
watchers | -> | followers |
user= | -> | username= |
user | -> | username |
user= | -> | owner= |
user | -> | owner |
find | -> | show |
find | -> | search |
created | [RW] | |
description | [RW] | |
fork | [RW] | |
forks | [RW] | |
homepage | [RW] | |
id | [RW] | |
language | [RW] | |
name | [RW] | |
open_issues | [RW] | |
private | [RW] | |
pushed | [RW] | |
score | [RW] | |
size | [RW] | |
type | [RW] | |
url | [RW] | |
user | [RW] | |
watchers | [RW] |
Create new github repo, accepts Hash with :repo, :description, :homepage, :public/:private
# File lib/git_hub/repo.rb, line 100 def create(opts) repo, desc, homepage, public = extract opts, :repo, :desc, :homepage, :public api.ensure_auth opts instantiate post("/create", 'name' => repo, 'description' => desc, 'homepage' => homepage, 'public' => (public ? 1 : 0)) end
Find repo(s) of a (valid) github user, accepts Hash with keys:
:owner/:user/:username: | Github user name |
:repo/:repository/:project/:name: | Repo name |
:query/:search: | Array of search terms as Strings or Symbols |
# File lib/git_hub/repo.rb, line 82 def find(opts) user, repo, query = extract opts, :user, :repo, :query path = if query "/search/#{query.map(&:to_s).join('+')}" elsif user && repo "/show/#{user}/#{repo}" elsif user "/show/#{user}" else raise "Unable to find #{self.class}(s) for #{opts}" end instantiate get(path) end
# File lib/git_hub/repo.rb, line 33 def initialize options super raise "Unable to initialize #{self.class} without user and name" unless @user && @name @url ||= "http://github.com/#{@user}/#{@name}" @type ||= "repo" end
# File lib/git_hub/repo.rb, line 55 def clone_url url = private? || api.auth['login'] == user ? "git@github.com:" : "git://github.com/" url += "#{@user}/#{@name}.git" end
Returns commits for this repo, accepts options:
:branch: | Only commits for specific branch - default ‘master’ |
:path: | Only commits for specific path |
:sha/:id: | Only one commit with specific id (sha) |
# File lib/git_hub/repo.rb, line 72 def commits opts = {} Commit.find opts.merge(:user => @user, :repo => @name) end