lib/acquia_toolbelt/cli/task.rb in acquia_toolbelt-2.3.1 vs lib/acquia_toolbelt/cli/task.rb in acquia_toolbelt-2.3.2

- old
+ new

@@ -5,36 +5,36 @@ # Internal: Output information for a single task item. # # task - The task object that contains all the information about the # task. def output_task_item(task) - completion_time = (task["completed"].to_i - task["started"].to_i) / 60 + completion_time = (task['completed'].to_i - task['started'].to_i) / 60 ui.say - ui.say "Task ID: #{task["id"].to_i}" - ui.say "Description: #{task["description"]}" - ui.say "Status: #{task["state"]}" + ui.say "Task ID: #{task['id'].to_i}" + ui.say "Description: #{task['description']}" + ui.say "Status: #{task['state']}" # If the completion time is greater then 0, output it in minutes # otherwise just say it was less then a minute. if completion_time > 0 - ui.say "Compeletion time: About #{completion_time} minutes" + ui.say "Completion time: About #{completion_time} minutes" else - ui.say "Compeletion time: Less than 1 minute" + ui.say 'Completion time: Less than 1 minute' end - ui.say "Queue: #{task["queue"]}" + ui.say "Queue: #{task['queue']}" end end # Public: List all tasks from the Acquia tasks queue(s). # # Returns a task listing. - desc "list", "List all tasks." + desc 'list', 'List all tasks.' method_option :queue, :type => :string, :aliases => %w(-q), - :desc => "Task queue to target." + :desc => 'Task queue to target.' method_option :count, :type => :string, :aliases => %w(-c), - :desc => "Limit the tasks returned." + :desc => 'Limit the tasks returned.' def list if options[:subscription] subscription = options[:subscription] else subscription = AcquiaToolbelt::CLI::API.default_subscription @@ -48,23 +48,21 @@ # Fetch a single queue from the tasks list if the queue parameter is set # otherwise just add all the tasks. if queue all_tasks.each do |task| - if task["queue"] == queue + if task['queue'] == queue tasks << task end end else all_tasks.each do |task| tasks << task end end # If there is a count to return, restrict it to that required amount. - if count && tasks.any? - tasks = tasks.last(count.to_i) - end + tasks = tasks.last(count.to_i) if count && tasks.any? tasks.each do |task| output_task_item(task) end end