Module: Werk::Commands

Included in:
Base
Defined in:
lib/werk/commands.rb

Instance Method Summary collapse

Instance Method Details

#listObject



3
4
5
# File 'lib/werk/commands.rb', line 3

def list
  ticket_list
end

#markaccepted(branch = nil) ⇒ Object



37
38
39
# File 'lib/werk/commands.rb', line 37

def markaccepted(branch = nil)
  take_action(branch, "pass")
end

#markfortest(branch = nil) ⇒ Object



29
30
31
# File 'lib/werk/commands.rb', line 29

def markfortest(branch = nil)
  take_action(branch, "testing")
end

#markrejected(branch = nil) ⇒ Object



33
34
35
# File 'lib/werk/commands.rb', line 33

def markrejected(branch = nil)
  take_action(branch, "reject")
end

#mergeandclose(branch = nil) ⇒ Object



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/werk/commands.rb', line 41

def mergeandclose(branch = nil)
  branch = repo_current_head unless branch
  

  # This'll throw if we can't get a ticket out
  ticket = branch2ticket(branch)

  # Push the branch
  repo_checkout(branch)
  repo_pull
  repo_push
  
  # Pull a new master / production
  targets = ["master"]
  targets << "production" if branch.include? "hotfix"
  targets.each do |target|
    repo_checkout(target)
    repo_pull
    repo_merge(branch)
    repo_push
  end

  # Annotate the ticket
  take_action(ticket, "merged")
end

#show(branch = nil) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/werk/commands.rb', line 7

def show(branch=nil)
  branch = repo_current_head unless branch
  
  # This'll throw if we can't get a ticket out
  ticket = branch2ticket(branch)
  system "open #{@trac_url.sub('xmlrpc', 'ticket/' + ticket)}"
end

#start(ticket, *args) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/werk/commands.rb', line 15

def start(ticket, *args)
  # Are we starting a hotfix?
  hotfix = args.include? "--hotfix"
  
  # Start a ticket named 'ticket', branching from the correct place if needed
  repo_branch(ticket2branch(ticket, hotfix), (hotfix)? "production" : "master")
  
  # Push the branch up to origin
  repo_push
  
  # Annotate the ticket
  take_action(branch2ticket(ticket), "start")
end