Class: StiDeploy::Git::Merge

Inherits:
Object
  • Object
show all
Defined in:
lib/sti_deploy/git/merge.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(origin_branch, target_branch) ⇒ Merge

Returns a new instance of Merge.



6
7
8
9
# File 'lib/sti_deploy/git/merge.rb', line 6

def initialize(origin_branch, target_branch)
  @origin = origin_branch
  @target = target_branch
end

Instance Attribute Details

#originObject (readonly)

Returns the value of attribute origin.



4
5
6
# File 'lib/sti_deploy/git/merge.rb', line 4

def origin
  @origin
end

#targetObject (readonly)

Returns the value of attribute target.



4
5
6
# File 'lib/sti_deploy/git/merge.rb', line 4

def target
  @target
end

Instance Method Details

#merge!Object



11
12
13
14
15
16
# File 'lib/sti_deploy/git/merge.rb', line 11

def merge!
  return unless needs_merge?
  Messages.puts('git.merging', origin: origin, target: target,
                color: :yellow)
  update_target_branch! && try_merge! && finalize_merge!
end