class Tlog::Command::Checkout
Public Instance Methods
description()
click to toggle source
# File lib/tlog/command/checkout.rb, line 8 def description "checkouts a time log in order to start tasks on" end
execute(input, output)
click to toggle source
# File lib/tlog/command/checkout.rb, line 12 def execute(input, output) raise Tlog::Error::CommandInvalid, "Must specify log name" unless input.args[0] checkout(input.args[0]) output.line("Checked-out log '#{input.args[0]}'"); end
name()
click to toggle source
# File lib/tlog/command/checkout.rb, line 4 def name "checkout" end
options(parser, options)
click to toggle source
# File lib/tlog/command/checkout.rb, line 18 def options(parser, options) parser.banner = "usage: tlog checkout <log_name>" end
Private Instance Methods
checkout(log_name)
click to toggle source
# File lib/tlog/command/checkout.rb, line 24 def checkout(log_name) storage.in_branch do |wd| log = storage.require_log(log_name) raise Tlog::Error::TimeLogNotFound, "Time log '#{log_name}' does not exist" unless log checked_out_log = storage.checkout_value if checked_out_log == log.name raise Tlog::Error::CommandInvalid, "Time log '#{log_name}' is currently checked out " end storage.checkout_log(log) end end