Class: Fuselage::Commit
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#committer ⇒ Object
Returns the value of attribute committer.
-
#message ⇒ Object
Returns the value of attribute message.
-
#parents ⇒ Object
Returns the value of attribute parents.
-
#sha ⇒ Object
Returns the value of attribute sha.
-
#tree ⇒ Object
Returns the value of attribute tree.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from Base
Class Method Summary collapse
-
.create(repo, message, tree, parents = [], options = {}) ⇒ Object
Create a commit.
-
.find(repo, sha, user = nil) ⇒ Object
Find a commit.
Instance Method Summary collapse
Methods inherited from Base
delete_method, get, #initialize, post
Constructor Details
This class inherits a constructor from Fuselage::Base
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
4 5 6 |
# File 'lib/fuselage/commit.rb', line 4 def @author end |
#committer ⇒ Object
Returns the value of attribute committer.
4 5 6 |
# File 'lib/fuselage/commit.rb', line 4 def committer @committer end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/fuselage/commit.rb', line 4 def @message end |
#parents ⇒ Object
Returns the value of attribute parents.
4 5 6 |
# File 'lib/fuselage/commit.rb', line 4 def parents @parents end |
#sha ⇒ Object
Returns the value of attribute sha.
4 5 6 |
# File 'lib/fuselage/commit.rb', line 4 def sha @sha end |
#tree ⇒ Object
Returns the value of attribute tree.
4 5 6 |
# File 'lib/fuselage/commit.rb', line 4 def tree @tree end |
#url ⇒ Object
Returns the value of attribute url.
4 5 6 |
# File 'lib/fuselage/commit.rb', line 4 def url @url end |
Class Method Details
.create(repo, message, tree, parents = [], options = {}) ⇒ Object
Create a commit
Options:
:author
:name
:date
:email
:committer
:name
:date
:email
examples:
Commit.create('cockpit', 'This is a new commit', '45f6d8e74e145b910be4e15f67ef3892fe7abb26', ['45f6d8e74e145b910be4e15f67ef3892fe7abb26'])
Commit.create('cockpit', 'Comit with author', '45f6d8e74e145b910be4e15f67ef3892fe7abb26', ['45f6d8e74e145b910be4e15f67ef3892fe7abb26'], {
:author => {:name => 'Corey', :email => '[email protected]'}
})
34 35 36 37 38 39 |
# File 'lib/fuselage/commit.rb', line 34 def self.create(repo, , tree, parents=[], ={}) raise AuthenticationRequired unless Api.authenticated params = {:message => , :tree => tree, :parents => parents}.merge() user = User.current.login Commit.new(post("/repos/#{user}/#{repo}/git/commits", params)) end |
.find(repo, sha, user = nil) ⇒ Object
Find a commit
examples:
Blob.find('cockpit', '45f6d8e74e145b910be4e15f67ef3892fe7abb26')
10 11 12 13 14 |
# File 'lib/fuselage/commit.rb', line 10 def self.find(repo, sha, user=nil) raise AuthenticationRequired unless Api.authenticated user ||= User.current.login Commit.new(get("/repos/#{user}/#{repo}/git/commits/#{sha}")) end |
Instance Method Details
#merge_attributes(attributes) ⇒ Object
41 42 43 44 45 46 |
# File 'lib/fuselage/commit.rb', line 41 def merge_attributes(attributes) attributes.each do |key, value| method = "#{key}=" self.send(method, value) if respond_to? method end end |