Class: Karo::Workflow

Inherits:
Thor
  • Object
show all
Includes:
Common
Defined in:
lib/karo/workflow.rb

Instance Method Summary collapse

Methods included from Common

#branch_exists?, #checkout_branch, #create_and_checkout_branch, #create_branch, #current_branch, #git_repo, #make_command, #run_it

Instance Method Details

#bugfix(name) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/karo/workflow.rb', line 26

def bugfix(name)
  branch_name = "bugfix/#{name}"

  if current_branch.eql?(branch_name)
    say "You are already on #{branch_name} this bug fix branch", :red
  elsif branch_exists? branch_name
    say "Bug fix branch #{branch_name} already exists! so checking it out", :red
    checkout_branch branch_name
  else
    create_and_checkout_branch branch_name
  end
end

#feature(name) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/karo/workflow.rb', line 12

def feature(name)
  branch_name = "feature/#{name}"

  if current_branch.eql?(branch_name)
    say "You are already on #{branch_name} this feature branch", :red
  elsif branch_exists? branch_name
    say "Feature branch #{branch_name} already exists! so checking it out", :red
    checkout_branch branch_name
  else
    create_and_checkout_branch branch_name
  end
end