Class: RGitFlow::Tasks::SCM::Tag
- Defined in:
- lib/rgitflow/tasks/scm/tag.rb
Constant Summary
Constants included from Printing
Printing::DEBUG_PREFIX, Printing::ERROR_PREFIX, Printing::INPUT_PREFIX, Printing::STATUS_PREFIX
Instance Attribute Summary
Attributes inherited from Task
#after, #before, #dependencies, #description, #name, #namespaces
Instance Method Summary collapse
-
#initialize(git) ⇒ Tag
constructor
A new instance of Tag.
- #run ⇒ Object protected
Methods inherited from Task
Methods inherited from Task
Methods included from Console
#execute, #invoke, #multi_task, #task?
Methods included from Printing
#debug, #error, #prompt, #status
Constructor Details
#initialize(git) ⇒ Tag
Returns a new instance of Tag.
7 8 9 |
# File 'lib/rgitflow/tasks/scm/tag.rb', line 7 def initialize(git) super(git, 'tag', 'Tags the repository') end |
Instance Method Details
#run ⇒ Object (protected)
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/rgitflow/tasks/scm/tag.rb', line 13 def run status 'Creating tag...' if dirty? error 'There are uncommitted changes in the repository!' print_status abort end status 'There are no uncommitted changes in the repository.' tag = ENV['TAG'] || ("#{RGitFlow::Config.[:tag]}" % RGitFlow::VERSION.to_s) unless @git..select { |t| t.name == tag }.length == 0 error 'Cannot create a tag that already exists!' abort end @git.add_tag tag, { :m => "tagging as #{tag}" } @git.push 'origin', @git.current_branch, { :tags => true } status 'Successfully created tag!' end |