Class: Octopi::Repository
- Octopi::Base
- Octopi::Repository
Included Modules
Attributes
Instance Attributes
description | [RW] | public |
Sets the attribute description. |
---|---|---|---|
forks | [RW] | public |
Sets the attribute forks. |
fork | [RW] | public |
Sets the attribute fork. |
homepage | [RW] | public |
Sets the attribute homepage. |
name | [RW] | public |
Sets the attribute name. |
open_issues | [RW] | public |
Sets the attribute open_issues. |
owner | [RW] | public |
Sets the attribute owner. |
pledgie | [RW] | public |
Sets the attribute pledgie. |
private | [RW] | public |
Sets the attribute private. |
url | [RW] | public |
Sets the attribute url. |
watchers | [RW] | public |
Sets the attribute watchers. |
Constants Inherited from Octopi::Base
Constructor Summary
This class inherits a constructor from Octopi::Base.
Public Visibility
Public Class Method Summary
create(owner, name, opts = {}) | |
---|---|
find(options = {}) | |
find_all(*args) | |
open_issue(args) |
Public Instance Method Summary
#all_issues | |
---|---|
#branches |
Returns all branches for the Repository. |
#clone_url | |
#collaborators | |
#comments |
Returns all the comments for a Repository. |
#commits(branch = "master") | |
#delete | |
#issue(number) | |
#issues(state = "open") | |
#open_issue(args) | |
#owner=(owner) |
Sets the attribute owner.. |
#tags |
Returns all tags for the Repository. |
#to_s |
Public Instance Methods Inherited from Octopi::Base
Public Class Method Details
create
public
create(owner, name, opts = {})
[View source]
114 115 116 117 118 119 120 |
# File 'lib/octopi/repository.rb', line 114 def self.create(owner, name, opts = {}) api = owner.is_a?(User) ? owner.api : ANONYMOUS_API raise APIError, "To create a repository you must be authenticated." if api.read_only? self.validate_args(name => :repo) api.post(path_for(:create), opts.merge(:name => name)) self.find(owner, name, api) end |
find
public
find(options = {})
[View source]
68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/octopi/repository.rb', line 68 def self.find(={}) self.validate_hash() # Lots of people call the same thing differently. repo = [:repo] || [:repository] || [:name] user = [:user].to_s return find_plural(user, :resource) if repo.nil? self.validate_args(user => :user, repo => :repo) super user, repo end |
find_all
public
find_all(*args)
[View source]
80 81 82 83 84 |
# File 'lib/octopi/repository.rb', line 80 def self.find_all(*args) # FIXME: This should be URI escaped, but have to check how the API # handles escaped characters first. super args.join(" ").gsub(/ /,'+') end |
open_issue
public
open_issue(args)
[View source]
86 87 88 |
# File 'lib/octopi/repository.rb', line 86 def self.open_issue(args) Issue.open(args[:user], args[:repo], args) end |
Public Instance Method Details
all_issues
public
all_issues
[View source]
102 103 104 |
# File 'lib/octopi/repository.rb', line 102 def all_issues Issue::STATES.map{|state| self.issues(state)}.flatten end |
branches
public
branches
Returns all branches for the Repository
Example:
repo = Repository.find("fcoury", "octopi") repo.branches.each { |r| puts r.name }
[View source]
24 25 26 |
# File 'lib/octopi/repository.rb', line 24 def branches BranchSet end |
clone_url
public
clone_url
[View source]
63 64 65 66 |
# File 'lib/octopi/repository.rb', line 63 def clone_url url = private? || api.login == self.owner ? "git@github.com:" : "git://github.com/" url += "#{self.owner}/#{self.name}.git" end |
collaborators
public
collaborators
[View source]
110 111 112 |
# File 'lib/octopi/repository.rb', line 110 def collaborators property('collaborators', [self.owner,self.name].join('/')).values end |
comments
commits
public
commits(branch = "master")
[View source]
94 95 96 |
# File 'lib/octopi/repository.rb', line 94 def commits(branch = "master") Commit.find_all(self, {:branch => branch}) end |
delete
public
delete
[View source]
122 123 124 125 |
# File 'lib/octopi/repository.rb', line 122 def delete token = @api.post(self.class.path_for(:delete), :id => self.name)['delete_token'] @api.post(self.class.path_for(:delete), :id => self.name, :delete_token => token) unless token.nil? end |
issue
public
issue(number)
[View source]
106 107 108 |
# File 'lib/octopi/repository.rb', line 106 def issue(number) Issue.find(self.owner, self, number) end |
issues
public
issues(state = "open")
[View source]
98 99 100 |
# File 'lib/octopi/repository.rb', line 98 def issues(state = "open") IssueSet.new(Octopi::Issue.find_all(:user => owner, :repository => self)) end |
open_issue
public
open_issue(args)
[View source]
90 91 92 |
# File 'lib/octopi/repository.rb', line 90 def open_issue(args) Issue.open(self.owner, self, args) end |
owner=
public
owner=(owner)
Sets the attribute owner
[View source]
4 5 6 |
# File 'lib/octopi/repository.rb', line 4 def owner=(owner) @owner = User.find(owner) end |
tags
to_s
public
to_s
[View source]
127 128 129 |
# File 'lib/octopi/repository.rb', line 127 def to_s name end |
Returns all the comments for a Repository