Class GitHub::Repo
In: lib/git_hub/repo.rb
Parent: GitHub::Base

Methods

Constants

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 }

External Aliases

watchers= -> followers=
watchers -> followers
user= -> username=
user -> username
user= -> owner=
user -> owner
find -> show
find -> search

Attributes

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] 

Public Class methods

Create new github repo, accepts Hash with :repo, :description, :homepage, :public/:private

[Source]

# 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

[Source]

# 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

[Source]

# 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

Public Instance methods

[Source]

# File lib/git_hub/repo.rb, line 129
    def add_collaborator
    end

[Source]

# File lib/git_hub/repo.rb, line 119
    def add_service
    end

[Source]

# File lib/git_hub/repo.rb, line 64
    def branches
      hash_of_commits(:branches)
    end

[Source]

# 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

[Source]

# File lib/git_hub/repo.rb, line 125
    def collaborators
      'repos/show/:user/:repo/collaborators'
    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)

[Source]

# File lib/git_hub/repo.rb, line 72
    def commits opts = {}
       Commit.find opts.merge(:user => @user, :repo => @name)
    end

Delete github repo, accepts optional Hash with authentication

[Source]

# File lib/git_hub/repo.rb, line 109
    def delete(opts = {})
      api.ensure_auth opts
      result = post("/delete/#{@name}")
      if token = result['delete_token']
        post("/delete/#{@name}", 'delete_token' => token)
      else
        result
      end
    end

[Source]

# File lib/git_hub/repo.rb, line 47
    def fork?;
      !!fork
    end

[Source]

# File lib/git_hub/repo.rb, line 51
    def private?;
      !!self.private
    end

[Source]

# File lib/git_hub/repo.rb, line 132
    def remove_collaborator
    end

[Source]

# File lib/git_hub/repo.rb, line 122
    def remove_service
    end

[Source]

# File lib/git_hub/repo.rb, line 60
    def tags
      hash_of_commits(:tags)
    end

[Validate]