Class: Workit::StartTaskCommand

Inherits:
AbstractCommand show all
Defined in:
lib/workit/start_task_command.rb

Instance Method Summary collapse

Instance Method Details

#executeObject



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/workit/start_task_command.rb', line 7

def execute
  Workit::Model.setup
  if Workit::Model::Task.can_start?
    task = Workit::Model::Task.new(:description => description.join(' '))
    if task.save
      task.start!
      puts "Started task '#{task.description}'"
    end
  else
    puts "'#{Workit::Model::Task.current.description}' is not yet finished"
    exit(1)
  end
end