lib/gush/cli/overview.rb in gush-2.0.2 vs lib/gush/cli/overview.rb in gush-2.1.0
- old
+ new
@@ -15,15 +15,15 @@
if workflow.failed?
failed_status
elsif workflow.running?
running_status
elsif workflow.finished?
- "done".green
+ Paint["done", :green]
elsif workflow.stopped?
- "stopped".red
+ Paint["stopped", :red]
else
- "ready to start".blue
+ Paint["ready to start", :blue]
end
end
def jobs_list(jobs)
"\nJobs list:\n".tap do |output|
@@ -46,45 +46,45 @@
def columns
{
"ID" => workflow.id,
"Name" => workflow.class.to_s,
"Jobs" => workflow.jobs.count,
- "Failed jobs" => failed_jobs_count.red,
- "Succeeded jobs" => succeeded_jobs_count.green,
- "Enqueued jobs" => enqueued_jobs_count.yellow,
- "Running jobs" => running_jobs_count.blue,
+ "Failed jobs" => Paint[failed_jobs_count, :red],
+ "Succeeded jobs" => Paint[succeeded_jobs_count, :green],
+ "Enqueued jobs" => Paint[enqueued_jobs_count, :yellow],
+ "Running jobs" => Paint[running_jobs_count, :blue],
"Remaining jobs" => remaining_jobs_count,
"Started at" => started_at,
"Status" => status
}
end
def running_status
finished = succeeded_jobs_count.to_i
- status = "running".yellow
+ status = Paint["running", :yellow]
status += "\n#{finished}/#{total_jobs_count} [#{(finished*100)/total_jobs_count}%]"
end
def started_at
Time.at(workflow.started_at) if workflow.started_at
end
def failed_status
- status = "failed".light_red
+ status = Paint["failed", :red]
status += "\n#{failed_job} failed"
end
def job_to_list_element(job)
name = job.name
case
when job.failed?
- "[✗] #{name.red} \n"
+ "[✗] #{Paint[name, :red]} \n"
when job.finished?
- "[✓] #{name.green} \n"
+ "[✓] #{Paint[name, :green]} \n"
when job.enqueued?
- "[•] #{name.yellow} \n"
+ "[•] #{Paint[name, :yellow]} \n"
when job.running?
- "[•] #{name.blue} \n"
+ "[•] #{Paint[name, :blue]} \n"
else
"[ ] #{name} \n"
end
end