Class: Foreman::CLI

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

Instance Method Summary collapse

Instance Method Details

#execute(process, procfile = "Procfile") ⇒ Object



18
19
20
21
# File 'lib/foreman/cli.rb', line 18

def execute(process, procfile="Procfile")
  error "#{procfile} does not exist." unless procfile_exists?(procfile)
  Foreman::Engine.new(procfile).execute(process)
end

#export(app, procfile = "Procfile", format = "upstart") ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'lib/foreman/cli.rb', line 32

def export(app, procfile="Procfile", format="upstart")
  error "#{procfile} does not exist." unless procfile_exists?(procfile)

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

  formatter.new(Foreman::Engine.new(procfile)).export(app)
end

#scale(app, process, amount) ⇒ Object



45
46
47
48
49
# File 'lib/foreman/cli.rb', line 45

def scale(app, process, amount)
  config = Foreman::Configuration.new(app)
  error "No such process: #{process}." unless config.processes[process]
  config.scale(process, amount)
end

#screen(procfile = "Procfile") ⇒ Object



25
26
27
28
# File 'lib/foreman/cli.rb', line 25

def screen(procfile="Procfile")
  error "#{procfile} does not exist." unless procfile_exists?(procfile)
  Foreman::Engine.new(procfile).screen
end

#start(procfile = "Procfile") ⇒ Object



11
12
13
14
# File 'lib/foreman/cli.rb', line 11

def start(procfile="Procfile")
  error "#{procfile} does not exist." unless procfile_exists?(procfile)
  Foreman::Engine.new(procfile).start
end