Class: Octopi::Commit
- Octopi::Base
- Octopi::Commit
Included Modules
Attributes
Instance Attributes
added | [RW] | public |
Sets the attribute added. |
---|---|---|---|
authored_date | [ | ]public |
Sets the attribute authored_date. |
author | [ | ]public |
Sets the attribute author. |
committed_date | [RW] | public |
Sets the attribute committed_date. |
committer | [RW] | public |
Sets the attribute committer. |
id | [RW] | public |
Sets the attribute id. |
message | [RW] | public |
Sets the attribute message. |
modified | [RW] | public |
Sets the attribute modified. |
parents | [RW] | public |
Sets the attribute parents. |
removed | [RW] | public |
Sets the attribute removed. |
repository | [RW] | public |
Sets the attribute repository. |
tree | [RW] | public |
Sets the attribute tree. |
url | [RW] | public |
Sets the attribute url. |
Constants Inherited from Octopi::Base
Constructor Summary
This class inherits a constructor from Octopi::Base.
Public Visibility
Public Class Method Summary
find(opts = {}) |
Finds all commits for the given options:. |
---|---|
find_all(opts = {}) |
Finds all commits for the given options:. |
Public Class Method Details
find
Finds all commits for the given options:
:repo or :repository or :name - A repository object or the name of a repository :user - A user object or the login of a user :branch - A branch object or the name of a branch. Defaults to master. :sha - The commit ID
Sample usage:
>> find(:user => "fcoury", :repo => "octopi", :sha => "f6609209c3ac0badd004512d318bfaa508ea10ae") => <Commit f6609209c3ac0badd004512d318bfaa508ea10ae for branch master> >> find(:user => "fcoury", :repo => "octopi", :branch => "lazy", :sha => "f6609209c3ac0badd004512d318bfaa508ea10ae") # branch is set to lazy. => <Commit f6609209c3ac0badd004512d318bfaa508ea10ae for branch lazy>
47 48 49 50 |
# File 'lib/octopi/commit.rb', line 47 def self.find(opts={}) user, repo, branch, sha = gather_details(opts) super [user, repo, sha] end |
find_all
Finds all commits for the given options:
:repo or :repository or :name - A repository object or the name of a repository :user - A user object or the login of a user :branch - A branch object or the name of a branch. Defaults to master.
Sample usage:
>> find_all(:user => "fcoury", :repo => "octopi") => <Latest 30 commits for master branch> => find_all(:user => "fcoury", :repo => "octopi", :branch => "lazy") # branch is set to lazy. => <Latest 30 commits for lazy branch>
24 25 26 27 28 29 30 |
# File 'lib/octopi/commit.rb', line 24 def self.find_all(opts={}) user, repo, branch = gather_details(opts) commits = super user, repo.name, branch # Repository is not passed in from the data, set it manually. commits.each { |c| c.repository = repo } commits end |
Public Instance Method Details
repo_identifier
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/octopi/commit.rb', line 52 def repo_identifier url_parts = url.split('/') if @repository parts = [@repository.owner, @repository.name, url_parts[6]] else parts = [url_parts[3], url_parts[4], url_parts[6]] end parts.join('/') end |