Class: WithGitRepo
- Inherits:
-
Object
- Object
- WithGitRepo
- Defined in:
- lib/with_git_repo.rb,
lib/with_git_repo/version.rb
Constant Summary collapse
- VERSION =
'0.3.0'.freeze
Instance Attribute Summary collapse
-
#clone_url ⇒ Object
readonly
Returns the value of attribute clone_url.
-
#user_email ⇒ Object
readonly
Returns the value of attribute user_email.
-
#user_name ⇒ Object
readonly
Returns the value of attribute user_name.
Instance Method Summary collapse
- #commit_changes_to_branch(branch, message) ⇒ Object
-
#initialize(options = {}) ⇒ WithGitRepo
constructor
A new instance of WithGitRepo.
Constructor Details
#initialize(options = {}) ⇒ WithGitRepo
Returns a new instance of WithGitRepo.
9 10 11 12 13 |
# File 'lib/with_git_repo.rb', line 9 def initialize( = {}) @clone_url = .fetch(:clone_url) @user_name = .fetch(:user_name, 'with_git_repo') @user_email = .fetch(:user_email, '[email protected]') end |
Instance Attribute Details
#clone_url ⇒ Object (readonly)
Returns the value of attribute clone_url.
5 6 7 |
# File 'lib/with_git_repo.rb', line 5 def clone_url @clone_url end |
#user_email ⇒ Object (readonly)
Returns the value of attribute user_email.
7 8 9 |
# File 'lib/with_git_repo.rb', line 7 def user_email @user_email end |
#user_name ⇒ Object (readonly)
Returns the value of attribute user_name.
6 7 8 |
# File 'lib/with_git_repo.rb', line 6 def user_name @user_name end |
Instance Method Details
#commit_changes_to_branch(branch, message) ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/with_git_repo.rb', line 15 def commit_changes_to_branch(branch, ) checkout_branch!(branch) git.chdir { yield } git.add return unless git.status.changed.any? || git.status.added.any? git.commit() git.push('origin', branch) end |