Class: SC::Checkout

Inherits:
Command show all
Defined in:
lib/sc/commands/checkout.rb

Constant Summary

Constants inherited from Command

SC::Command::VALID_SET_KEYS

Instance Method Summary collapse

Methods inherited from Command

commands, inherited, options, reset!

Instance Method Details

#run(project, args) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/sc/commands/checkout.rb', line 50

def run (project, args)
  what = 
    case
    when opthash[:co_bug]
      project.branches("bug/#{opthash[:co_bug]}")
    when opthash[:co_exp]
      opthash[:prefix] ||= 'exp'
      project.branches("#{opthash[:prefix]}/#{opthash[:co_exp]}")
    when opthash[:co_release]
      opthash[:co_release]
    else
      nil
    end

  Constants::TERMINAL.say("Checked out to: " + 
    Constants::TERMINAL.color(Path.relative_to_home(project.checkout(what)), :green))
end