Class: RoboPigeon::GitLab::Commit
- Inherits:
-
Object
- Object
- RoboPigeon::GitLab::Commit
- Defined in:
- lib/robopigeon/gitlab/commit.rb
Instance Attribute Summary collapse
-
#author_email ⇒ Object
Returns the value of attribute author_email.
-
#author_name ⇒ Object
Returns the value of attribute author_name.
-
#branch ⇒ Object
Returns the value of attribute branch.
-
#files ⇒ Object
Returns the value of attribute files.
-
#message ⇒ Object
Returns the value of attribute message.
Instance Method Summary collapse
- #add_file(file, content = nil, method = 'update') ⇒ Object
- #client ⇒ Object
- #commit! ⇒ Object
-
#initialize ⇒ Commit
constructor
A new instance of Commit.
Constructor Details
#initialize ⇒ Commit
Returns a new instance of Commit.
4 5 6 7 8 9 |
# File 'lib/robopigeon/gitlab/commit.rb', line 4 def initialize self.files = [] self. = ENV['GITLAB_USER_NAME'] self. = ENV['GITLAB_USER_EMAIL'] self.branch = RoboPigeon::GitLab::Client.branch end |
Instance Attribute Details
#author_email ⇒ Object
Returns the value of attribute author_email.
3 4 5 |
# File 'lib/robopigeon/gitlab/commit.rb', line 3 def @author_email end |
#author_name ⇒ Object
Returns the value of attribute author_name.
3 4 5 |
# File 'lib/robopigeon/gitlab/commit.rb', line 3 def @author_name end |
#branch ⇒ Object
Returns the value of attribute branch.
3 4 5 |
# File 'lib/robopigeon/gitlab/commit.rb', line 3 def branch @branch end |
#files ⇒ Object
Returns the value of attribute files.
3 4 5 |
# File 'lib/robopigeon/gitlab/commit.rb', line 3 def files @files end |
#message ⇒ Object
Returns the value of attribute message.
3 4 5 |
# File 'lib/robopigeon/gitlab/commit.rb', line 3 def @message end |
Instance Method Details
#add_file(file, content = nil, method = 'update') ⇒ Object
11 12 13 14 |
# File 'lib/robopigeon/gitlab/commit.rb', line 11 def add_file(file, content=nil, method='update') content ||= File.read(file) files.push(action: method, file_path: file, content: content) end |
#client ⇒ Object
16 17 18 |
# File 'lib/robopigeon/gitlab/commit.rb', line 16 def client RoboPigeon::GitLab::Client.client end |
#commit! ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/robopigeon/gitlab/commit.rb', line 20 def commit! client.create_commit( RoboPigeon::GitLab::Client.project, branch, , files, author_name: , author_email: ) end |