Class: GTA::Hotfix
Instance Attribute Summary collapse
-
#gta_config_path ⇒ Object
readonly
Returns the value of attribute gta_config_path.
Instance Method Summary collapse
- #branch_name ⇒ Object
- #checkout(stage_name = nil) ⇒ Object
- #deploy ⇒ Object
-
#initialize(gta_config_path = nil) ⇒ Hotfix
constructor
A new instance of Hotfix.
- #manager ⇒ Object
- #not_hotfixable!(stage_name) ⇒ Object
- #stage_for(stage_name) ⇒ Object
Methods included from Sh
Constructor Details
#initialize(gta_config_path = nil) ⇒ Hotfix
Returns a new instance of Hotfix.
7 8 9 |
# File 'lib/gta/hotfix.rb', line 7 def initialize(gta_config_path = nil) @gta_config_path = gta_config_path end |
Instance Attribute Details
#gta_config_path ⇒ Object (readonly)
Returns the value of attribute gta_config_path.
5 6 7 |
# File 'lib/gta/hotfix.rb', line 5 def gta_config_path @gta_config_path end |
Instance Method Details
#branch_name ⇒ Object
37 38 39 40 41 |
# File 'lib/gta/hotfix.rb', line 37 def branch_name branches = sh!("git branch").strip matches = branches.match(/\*\s+(.*)/) matches[1].strip if matches end |
#checkout(stage_name = nil) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/gta/hotfix.rb', line 11 def checkout(stage_name=nil) stage = stage_for(stage_name) sh!("git fetch #{stage.name}") not_hotfixable!(stage_name) unless stage stage.checkout end |
#deploy ⇒ Object
22 23 24 25 26 27 |
# File 'lib/gta/hotfix.rb', line 22 def deploy stage_name = branch_name stage = stage_for(stage_name) not_hotfixable!(stage_name) if !stage || !stage_name sh!("git push #{stage_name} #{stage_name}:master") end |
#manager ⇒ Object
18 19 20 |
# File 'lib/gta/hotfix.rb', line 18 def manager @manager ||= Manager.new(gta_config_path) end |
#not_hotfixable!(stage_name) ⇒ Object
29 30 31 |
# File 'lib/gta/hotfix.rb', line 29 def not_hotfixable!(stage_name) raise "stage #{stage_name} not hotfixable" end |
#stage_for(stage_name) ⇒ Object
33 34 35 |
# File 'lib/gta/hotfix.rb', line 33 def stage_for(stage_name) manager.hotfixer(stage_name) end |