change back to Procfile

This commit is contained in:
David Dollar
2010-11-03 14:05:06 -07:00
parent eca48170a5
commit 9e42dfb253
6 changed files with 34 additions and 34 deletions
+10 -10
View File
@@ -5,7 +5,7 @@ require "thor"
class Foreman::CLI < Thor
class_option :psfile, :type => :string, :aliases => "-f", :desc => "Default: Psfile"
class_option :procfile, :type => :string, :aliases => "-f", :desc => "Default: Procfile"
desc "start [PROCESS]", "Start the application, or a specific process"
@@ -14,7 +14,7 @@ class Foreman::CLI < Thor
:banner => '"alpha=5,bar=3"'
def start(process=nil)
check_psfile!
check_procfile!
if process
engine.execute(process, options)
@@ -33,7 +33,7 @@ class Foreman::CLI < Thor
:banner => '"alpha=5,bar=3"'
def export(format, location=nil)
check_psfile!
check_procfile!
formatter = case format
when "upstart" then Foreman::Export::Upstart
@@ -49,16 +49,16 @@ class Foreman::CLI < Thor
private ######################################################################
def check_psfile!
error("#{psfile} does not exist.") unless File.exist?(psfile)
def check_procfile!
error("#{procfile} does not exist.") unless File.exist?(procfile)
end
def engine
@engine ||= Foreman::Engine.new(psfile)
@engine ||= Foreman::Engine.new(procfile)
end
def psfile
options[:psfile] || "Psfile"
def procfile
options[:procfile] || "Procfile"
end
private ######################################################################
@@ -68,8 +68,8 @@ private ######################################################################
exit 1
end
def psfile_exists?(psfile)
File.exist?(psfile)
def procfile_exists?(procfile)
File.exist?(procfile)
end
end
+7 -7
View File
@@ -8,21 +8,21 @@ require "fileutils"
class Foreman::Engine
attr_reader :psfile
attr_reader :procfile
attr_reader :directory
extend Term::ANSIColor
COLORS = [ cyan, yellow, green, magenta, red ]
def initialize(psfile)
@psfile = read_psfile(psfile)
@directory = File.expand_path(File.dirname(psfile))
def initialize(procfile)
@procfile = read_procfile(procfile)
@directory = File.expand_path(File.dirname(procfile))
end
def processes
@processes ||= begin
psfile.split("\n").inject({}) do |hash, line|
procfile.split("\n").inject({}) do |hash, line|
next if line.strip == ""
name, command = line.split(" ", 2)
process = Foreman::Process.new(name, command)
@@ -144,8 +144,8 @@ private ######################################################################
$0 = title
end
def read_psfile(psfile)
File.read(psfile)
def read_procfile(procfile)
File.read(procfile)
end
def watch_for_termination