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 19 |
# File 'lib/bumpversion/git_operation.rb', line 11 def commit! if [:git_commit] PrettyOutput.info("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
40 41 42 43 44 |
# File 'lib/bumpversion/git_operation.rb', line 40 def do! commit! tag! push! end |
#push! ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/bumpversion/git_operation.rb', line 28 def push! if [:git_push] @git.push if [:git_tag] PrettyOutput.info("git push with tags") @git.push(@git.remote.name, @git.branch.name, :tags => true) else PrettyOutput.info("git push") end end end |
#tag! ⇒ Object
21 22 23 24 25 26 |
# File 'lib/bumpversion/git_operation.rb', line 21 def tag! if [:git_tag] PrettyOutput.info("git tag") @git.add_tag("v#{@options[:new_version]}") end end |