Class: Bumpversion::GitOperation
- Inherits:
-
Object
- Object
- Bumpversion::GitOperation
- Defined in:
- lib/bumpversion/git_operation.rb
Instance Method Summary collapse
- #commit! ⇒ Object
- #do! ⇒ Object
-
#initialize(options) ⇒ GitOperation
constructor
A new instance of GitOperation.
- #push! ⇒ Object
- #tag! ⇒ Object
Constructor Details
#initialize(options) ⇒ GitOperation
Returns a new instance of GitOperation.
5 6 7 8 9 |
# File 'lib/bumpversion/git_operation.rb', line 5 def initialize() = @git = Git.init Git.init('.') end |
Instance Method Details
#commit! ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'lib/bumpversion/git_operation.rb', line 11 def commit! if [:git_commit] file = [:file].split(',') + [[:config_file]] file += [:git_extra_add].split(',') if [:git_extra_add] @git.add(file) @git.commit("Bump version: #{@options[:current_version]} → #{@options[:new_version]}", {author: "#{@options[:git_user]} <#{@options[:git_email]}>"}) end end |
#do! ⇒ Object
29 30 31 32 33 |
# File 'lib/bumpversion/git_operation.rb', line 29 def do! commit! tag! push! end |
#push! ⇒ Object
24 25 26 27 |
# File 'lib/bumpversion/git_operation.rb', line 24 def push! @git.push if [:git_push] @git.push(@git.remote.name, @git.branch.name, :tags => true) if [:git_push] && [:git_tag] end |
#tag! ⇒ Object
20 21 22 |
# File 'lib/bumpversion/git_operation.rb', line 20 def tag! @git.add_tag("v#{@options[:new_version]}") if [:git_tag] end |