Class: Jira::Command::Checkout

Inherits:
Base
  • Object
show all
Defined in:
lib/jira/commands/checkout.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ticket, options) ⇒ Checkout

Returns a new instance of Checkout.



17
18
19
20
# File 'lib/jira/commands/checkout.rb', line 17

def initialize(ticket, options)
  self.ticket = ticket
  self.options = options
end

Instance Attribute Details

#optionsObject

Returns the value of attribute options.



15
16
17
# File 'lib/jira/commands/checkout.rb', line 15

def options
  @options
end

#ticketObject

Returns the value of attribute ticket.



15
16
17
# File 'lib/jira/commands/checkout.rb', line 15

def ticket
  @ticket
end

Instance Method Details

#runObject



22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/jira/commands/checkout.rb', line 22

def run
  return unless Jira::Core.ticket?(ticket)
  return if .empty?
  unless ['errorMessages'].nil?
    on_failure
    return
  end
  unless remote?
    on_failure
    return
  end

  create_branch unless branches.include?(ticket)
  checkout_branch
  reset_branch unless branches.include?(ticket)
  on_success
end