first attempt at screen-based running
This commit is contained in:
@@ -20,6 +20,13 @@ class Foreman::CLI < Thor
|
||||
Foreman::Engine.new(procfile).execute(process)
|
||||
end
|
||||
|
||||
desc "screen [PROCFILE]", "Run the app described in PROCFILE as screen windows"
|
||||
|
||||
def screen(procfile="Procfile")
|
||||
error "#{procfile} does not exist." unless procfile_exists?(procfile)
|
||||
Foreman::Engine.new(procfile).screen
|
||||
end
|
||||
|
||||
desc "export APP [PROCFILE] [FORMAT]", "Export the app described in PROCFILE as APP to another FORMAT"
|
||||
|
||||
def export(app, procfile="Procfile", format="upstart")
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
require "foreman"
|
||||
require "foreman/process"
|
||||
require "tempfile"
|
||||
|
||||
class Foreman::Engine
|
||||
|
||||
@@ -34,6 +35,19 @@ class Foreman::Engine
|
||||
run_loop
|
||||
end
|
||||
|
||||
def screen
|
||||
tempfile = Tempfile.new("foreman")
|
||||
tempfile.puts "sessionname foreman"
|
||||
processes.each do |name, process|
|
||||
tempfile.puts "screen -t #{name} #{process.command}"
|
||||
end
|
||||
tempfile.close
|
||||
|
||||
system "screen -c #{tempfile.path}"
|
||||
|
||||
tempfile.delete
|
||||
end
|
||||
|
||||
def execute(name)
|
||||
run(processes[name], false)
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user