Class: Bumpversion::GitOperation
- Inherits:
-
Object
- Object
- Bumpversion::GitOperation
- Defined in:
- lib/bumpversion/git_operation.rb
Instance Method Summary collapse
- #commit! ⇒ Object
- #config! ⇒ 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
16 17 18 19 20 21 22 23 |
# File 'lib/bumpversion/git_operation.rb', line 16 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]}") end end |
#config! ⇒ Object
11 12 13 14 |
# File 'lib/bumpversion/git_operation.rb', line 11 def config! @git.config('user.name', [:git_user]) @git.config('user.email', [:git_email]) end |
#do! ⇒ Object
34 35 36 37 38 39 |
# File 'lib/bumpversion/git_operation.rb', line 34 def do! config! commit! tag! push! end |
#push! ⇒ Object
29 30 31 32 |
# File 'lib/bumpversion/git_operation.rb', line 29 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
25 26 27 |
# File 'lib/bumpversion/git_operation.rb', line 25 def tag! @git.add_tag("v#{@options[:new_version]}") if [:git_tag] end |