Class: Foreman::Engine::CLI

Inherits:
Foreman::Engine show all
Defined in:
lib/foreman/engine/cli.rb

Defined Under Namespace

Modules: Color

Constant Summary collapse

FOREMAN_COLORS =
%w( cyan yellow green magenta red blue bright_cyan bright_yellow
bright_green bright_magenta bright_red bright_blue )

Constants inherited from Foreman::Engine

HANDLED_SIGNALS

Instance Attribute Summary

Attributes inherited from Foreman::Engine

#env, #options, #processes

Instance Method Summary collapse

Methods inherited from Foreman::Engine

#base_port, #clear, #each_process, #environment, #formation, #handle_hangup, #handle_interrupt, #handle_signal, #handle_term_signal, #initialize, #kill_children, #killall, #load_env, #load_procfile, #notice_signal, #port_for, #process, #process_names, #register, #register_signal_handlers, #restore_default_signal_handlers, #root, #start

Constructor Details

This class inherits a constructor from Foreman::Engine

Instance Method Details

#output(name, data) ⇒ Object


56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/foreman/engine/cli.rb', line 56

def output(name, data)
  data.to_s.lines.map(&:chomp).each do |message|
    output  = ""
    output += $stdout.color(@colors[name.split(".").first].to_sym)
    output += "#{Time.now.strftime("%H:%M:%S")} #{pad_process_name(name)} | "
    output += $stdout.color(:reset)
    output += message
    $stdout.puts output
    $stdout.flush
  end
rescue Errno::EPIPE
  terminate_gracefully
end

#shutdownObject


70
71
# File 'lib/foreman/engine/cli.rb', line 70

def shutdown
end

#startupObject


50
51
52
53
54
# File 'lib/foreman/engine/cli.rb', line 50

def startup
  @colors = map_colors
  proctitle "foreman: master" unless Foreman.windows?
  Color.enable($stdout, options[:color])
end