Class: Octopi::Commit
- Includes:
- Resource
- Defined in:
- lib/octopi/commit.rb
Constant Summary
Constants inherited from Base
Instance Attribute Summary collapse
-
#added ⇒ Object
Returns the value of attribute added.
-
#author ⇒ Object
Returns the value of attribute author.
-
#authored_date ⇒ Object
Returns the value of attribute authored_date.
-
#committed_date ⇒ Object
Returns the value of attribute committed_date.
-
#committer ⇒ Object
Returns the value of attribute committer.
-
#id ⇒ Object
Returns the value of attribute id.
-
#message ⇒ Object
Returns the value of attribute message.
-
#modified ⇒ Object
Returns the value of attribute modified.
-
#parents ⇒ Object
Returns the value of attribute parents.
-
#removed ⇒ Object
Returns the value of attribute removed.
-
#repository ⇒ Object
Returns the value of attribute repository.
-
#tree ⇒ Object
Returns the value of attribute tree.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from Base
Class Method Summary collapse
-
.find(options = {}) ⇒ Object
Finds all commits for the given options:.
-
.find_all(options = {}) ⇒ Object
Finds all commits for the given options:.
Instance Method Summary collapse
Methods included from Resource
Methods inherited from Base
#error=, #initialize, #property, #save
Constructor Details
This class inherits a constructor from Octopi::Base
Instance Attribute Details
#added ⇒ Object
Returns the value of attribute added.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def added @added end |
#author ⇒ Object
Returns the value of attribute author.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def @author end |
#authored_date ⇒ Object
Returns the value of attribute authored_date.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def @authored_date end |
#committed_date ⇒ Object
Returns the value of attribute committed_date.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def committed_date @committed_date end |
#committer ⇒ Object
Returns the value of attribute committer.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def committer @committer end |
#id ⇒ Object
Returns the value of attribute id.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def id @id end |
#message ⇒ Object
Returns the value of attribute message.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def @message end |
#modified ⇒ Object
Returns the value of attribute modified.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def modified @modified end |
#parents ⇒ Object
Returns the value of attribute parents.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def parents @parents end |
#removed ⇒ Object
Returns the value of attribute removed.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def removed @removed end |
#repository ⇒ Object
Returns the value of attribute repository.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def repository @repository end |
#tree ⇒ Object
Returns the value of attribute tree.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def tree @tree end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/octopi/commit.rb', line 7 def url @url end |
Class Method Details
.find(options = {}) ⇒ Object
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>
52 53 54 55 56 |
# File 'lib/octopi/commit.rb', line 52 def self.find(={}) ensure_hash() user, repo, branch, sha = gather_details() super [user, repo, sha] end |
.find_all(options = {}) ⇒ Object
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 31 32 33 34 35 |
# File 'lib/octopi/commit.rb', line 24 def self.find_all(={}) ensure_hash() user, repo, branch = gather_details() commits = if [:path] super user, repo.name, branch, [:path] else super user, repo.name, branch end # Repository is not passed in from the data, set it manually. commits.each { |c| c.repository = repo } commits end |
Instance Method Details
#repo_identifier ⇒ Object
58 59 60 61 62 63 64 65 66 67 |
# File 'lib/octopi/commit.rb', line 58 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 |