Class: Octopolo::Scripts::SyncBranch
- Inherits:
-
Object
- Object
- Octopolo::Scripts::SyncBranch
- Includes:
- CLIWrapper, ConfigWrapper, GitWrapper
- Defined in:
- lib/octopolo/scripts/sync_branch.rb
Instance Attribute Summary collapse
-
#branch ⇒ Object
Returns the value of attribute branch.
Attributes included from GitWrapper
Attributes included from CLIWrapper
Attributes included from ConfigWrapper
Class Method Summary collapse
Instance Method Summary collapse
-
#default_branch ⇒ Object
Public: Default value of branch if none given.
- #execute ⇒ Object
-
#initialize(branch = nil) ⇒ SyncBranch
constructor
A new instance of SyncBranch.
-
#merge_branch ⇒ Object
Public: Merge the specified remote branch into your local.
Constructor Details
#initialize(branch = nil) ⇒ SyncBranch
Returns a new instance of SyncBranch.
16 17 18 |
# File 'lib/octopolo/scripts/sync_branch.rb', line 16 def initialize(branch=nil) @branch = branch || default_branch end |
Instance Attribute Details
#branch ⇒ Object
Returns the value of attribute branch.
10 11 12 |
# File 'lib/octopolo/scripts/sync_branch.rb', line 10 def branch @branch end |
Class Method Details
.execute(branch = nil) ⇒ Object
12 13 14 |
# File 'lib/octopolo/scripts/sync_branch.rb', line 12 def self.execute(branch=nil) new(branch).execute end |
Instance Method Details
#default_branch ⇒ Object
Public: Default value of branch if none given
21 22 23 |
# File 'lib/octopolo/scripts/sync_branch.rb', line 21 def default_branch config.deploy_branch end |
#execute ⇒ Object
25 26 27 |
# File 'lib/octopolo/scripts/sync_branch.rb', line 25 def execute merge_branch end |
#merge_branch ⇒ Object
Public: Merge the specified remote branch into your local
30 31 32 33 34 |
# File 'lib/octopolo/scripts/sync_branch.rb', line 30 def merge_branch git.merge branch rescue Git::MergeFailed cli.say "Merge failed. Please resolve these conflicts." end |