class Jobshop::CLI::Base

Public Instance Methods

print_header() click to toggle source
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