class Jobshop::CLI::Base
Public Instance Methods
print_header()
click to toggle source
# File lib/jobshop/cli/base.rb, line 10 def print_header say(set_color(Base64.decode64(%w( ICAgICAgIF9fX19fXyAgX19fXyBfX19fXyBfXyAgX19fX19fICBfX19fCiAg ICAgIC8gLyBfXyBcLyBfXyApIF9fXy8vIC8gLyAvIF9fIFwvIF9fIFwKIF8g ICAvIC8gLyAvIC8gX18gIFxfXyBcLyAvXy8gLyAvIC8gLyAvXy8gLwovIC9f LyAvIC9fLyAvIC9fLyAvX18vIC8gX18gIC8gL18vIC8gX19fXy8KXF9fX18v XF9fX18vX19fX18vX19fXy9fLyAvXy9cX19fXy9fLwo=ICAg ).join ).prepend("\n"), :white, :bold)) say "Version: ", nil, false say(set_color(Jobshop.gem_version, :white, :bold)) puts end
quiet_command(command, status = nil, message = nil)
click to toggle source
# File lib/jobshop/cli/base.rb, line 31 def quiet_command(command, status = nil, message = nil) say_status(status, message, :white) if status Open3.popen3(command) do |stdin, stdout, stderr, wait_thread| stdout_t = Thread.new do until (line = stdout.gets).nil? do STDOUT.write(line) if options[:verbose] end end Thread.new do until (line = stderr.gets).nil? do STDERR.write(line) if options[:verbose] abort_message = <<~ABORT An error occured and setup can not continue. #{if !options[:verbose] "Please rerun your command with the -v option to " + "see complete error information." end} ABORT say_status :error, abort_message stdout_t.kill abort end end wait_thread.join end end
require_environment!()
click to toggle source
# File lib/jobshop/cli/base.rb, line 23 def require_environment! begin require File.expand_path("spec/canary/config/environment") rescue LoadError abort "Canary app does not exist. Run `jobshop reset` to create it." end end