Class: Octopolo::Scripts::SyncBranch

Inherits:
Object
  • Object
show all
Includes:
CLIWrapper, ConfigWrapper, GitWrapper
Defined in:
lib/octopolo/scripts/sync_branch.rb

Instance Attribute Summary collapse

Attributes included from GitWrapper

#git

Attributes included from CLIWrapper

#cli

Attributes included from ConfigWrapper

#config

Class Method Summary collapse

Instance Method Summary collapse

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

#branchObject

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_branchObject

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

#executeObject



25
26
27
# File 'lib/octopolo/scripts/sync_branch.rb', line 25

def execute
  merge_branch
end

#merge_branchObject

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