Class: Workit::FinishTaskCommand

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

Instance Method Summary collapse

Instance Method Details

#executeObject



6
7
8
9
10
11
12
13
14
15
# File 'lib/workit/finish_task_command.rb', line 6

def execute
  Workit::Model.setup
  if Workit::Model::Task.can_finish?
    task = Workit::Model::Task.all(:state.not => 'finished').last
    puts "Finished task '#{task.description}'" if task.finish!
  else
    puts "There are currently no tasks to finish"
    exit(1)
  end
end