Class: CapistranoHelper
- Inherits:
-
Object
- Object
- CapistranoHelper
- Defined in:
- lib/auto_tagger/capistrano_helper.rb
Instance Attribute Summary collapse
-
#stage ⇒ Object
readonly
Returns the value of attribute stage.
-
#variables ⇒ Object
readonly
Returns the value of attribute variables.
-
#working_directory ⇒ Object
readonly
Returns the value of attribute working_directory.
Instance Method Summary collapse
- #branch ⇒ Object
-
#initialize(variables) ⇒ CapistranoHelper
constructor
A new instance of CapistranoHelper.
- #previous_stage ⇒ Object
- #release_tag_entries ⇒ Object
Constructor Details
#initialize(variables) ⇒ CapistranoHelper
Returns a new instance of CapistranoHelper.
5 6 7 8 9 10 |
# File 'lib/auto_tagger/capistrano_helper.rb', line 5 def initialize(variables) @stage_manager = StageManager.new(variables[:autotagger_stages]) @variables = variables @stage = variables[:stage] @working_directory = variables[:working_directory] || Dir.pwd end |
Instance Attribute Details
#stage ⇒ Object (readonly)
Returns the value of attribute stage.
3 4 5 |
# File 'lib/auto_tagger/capistrano_helper.rb', line 3 def stage @stage end |
#variables ⇒ Object (readonly)
Returns the value of attribute variables.
3 4 5 |
# File 'lib/auto_tagger/capistrano_helper.rb', line 3 def variables @variables end |
#working_directory ⇒ Object (readonly)
Returns the value of attribute working_directory.
3 4 5 |
# File 'lib/auto_tagger/capistrano_helper.rb', line 3 def working_directory @working_directory end |
Instance Method Details
#branch ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/auto_tagger/capistrano_helper.rb', line 16 def branch if variables.has_key?(:head) variables[:branch] elsif variables.has_key?(:tag) variables[:tag] elsif stage && (latest = AutoTagger.new(stage, working_directory).latest_tag) latest else variables[:branch] end end |
#previous_stage ⇒ Object
12 13 14 |
# File 'lib/auto_tagger/capistrano_helper.rb', line 12 def previous_stage @stage_manager.previous_stage(stage) end |
#release_tag_entries ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/auto_tagger/capistrano_helper.rb', line 28 def release_tag_entries entries = [] @stage_manager.stages.each do |stage| tagger = AutoTagger.new(stage, working_directory) tag = tagger.latest_tag commit = tagger.repository.commit_for(tag) entries << "#{stage.to_s.ljust(10, " ")} #{tag.to_s.ljust(30, " ")} #{commit.to_s}" end entries end |