Class: Verat::Hotfix

Inherits:
Object
  • Object
show all
Defined in:
lib/verat/hotfix.rb

Class Method Summary collapse

Class Method Details

.finish(hotfix, options) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'lib/verat/hotfix.rb', line 14

def self.finish(hotfix, options)
  puts "Finishing hotfix: #{hotfix}"

  repo   = Git.open(Dir.pwd)
  branch = "hotfix-#{hotfix}"

  if repo.current_branch() != 'master' and repo.is_branch?(branch)
    repo.checkout('master')

    # Temporary fix until git adds options to the merge method
    status = system("git merge --no-ff #{branch}")
    if status
      repo.checkout('develop')
      system("git merge --no-ff #{branch}")
    end
  else
    # Temporary fix until git adds options to the merge method
    status = system("git merge --no-ff #{branch}")
    if status
      repo.checkout('develop')
      system("git merge --no-ff #{branch}")
    end
  end

  if options['delete']
    repo.branch(branch).delete
    puts "Deleting branch: #{branch}"
  end

  puts "Finished succesfuly. Current branch: develop"
end

.start(hotfix) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/verat/hotfix.rb', line 5

def self.start(hotfix)
  puts "Creating branch: hotfix-#{hotfix}"

  repo = Git.open(Dir.pwd)
  repo.branch("hotfix-#{hotfix}").checkout

  puts "Branch created succesfuly. Current branch: hotfix-#{hotfix}"
end