Class: Foreman::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/foreman/cli.rb

Instance Method Summary collapse

Instance Method Details

#checkObject



55
56
57
58
# File 'lib/foreman/cli.rb', line 55

def check
  error "no processes defined" unless engine.processes.length > 0
  display "valid procfile detected (#{engine.processes.map(&:name).join(', ')})"
end

#export(format, location = nil) ⇒ Object



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/foreman/cli.rb', line 37

def export(format, location=nil)
  check_procfile!

  formatter = case format
    when "inittab" then Foreman::Export::Inittab
    when "upstart" then Foreman::Export::Upstart
    when "bluepill" then Foreman::Export::Bluepill
    else error "Unknown export format: #{format}."
  end

  formatter.new(engine).export(location, options)

rescue Foreman::Export::Exception => ex
  error ex.message
end

#start(process = nil) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/foreman/cli.rb', line 17

def start(process=nil)
  check_procfile!

  if process
    engine.execute(process)
  else
    engine.start
  end
end