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
owner= -> username=
owner -> username
find -> show
find -> search

Attributes

created  [RW] 
description  [RW] 
fork  [RW] 
forks  [RW] 
homepage  [RW] 
id  [RW] 
language  [RW] 
name  [RW] 
open_issues  [RW] 
owner  [RW] 
private  [RW] 
pushed  [RW] 
score  [RW] 
size  [RW] 
type  [RW] 
url  [RW] 
watchers  [RW] 

Public Class methods

Create new github repo, accepts Hash with :repo, :description, :homepage, :public/:private or repo name as a single parameter

[Source]

# File lib/git_hub/repo.rb, line 82
      def create(opts)
        repo = opts[:repo] || opts[:repository] || opts[:name] || opts[:project]
        description = opts[:description] || opts[:descr] || opts[:desc]
        homepage = opts[:homepage]
        public = opts[:public] || !opts[:private] # default to true
        ensure_auth opts
        convert_to_repo post("/create", 'name' => repo, 'description' => description,
                             '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 65
      def find(opts)
        if opts[:query]
          query = opts[:query].map(&:to_s).join('+')
          path = "/search/#{query}"
        else
          owner = opts[:owner] || opts[:user] || opts[:username] || opts[:login] || api.auth['login'] || ''
          repo = opts[:repo] || opts[:repository] || opts[:name] || opts[:project]
          path = repo ? "/show/#{owner}/#{repo}" : "/show/#{owner}"
        end
        convert_to_repo get(path)
      end

[Source]

# File lib/git_hub/repo.rb, line 33
    def initialize options
      super
      raise "Unable to initialize #{self.class} without name" unless @name
      @url ||= "http://github.com/#{@owner}/#{@name}"
      @type ||= "repo"
    end

Public Instance methods

[Source]

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

[Source]

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

[Source]

# File lib/git_hub/repo.rb, line 53
    def clone_url
      url = private? || api.auth['login'] == self.owner ? "git@github.com:" : "git://github.com/"
      url += "#{self.owner}/#{self.name}.git"
    end

Delete github repo

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Source]

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

[Validate]