Class: Jefe::CLI

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

Instance Method Summary collapse

Instance Method Details

#help(*args) ⇒ Object



39
40
41
42
43
44
# File 'lib/jefe/cli.rb', line 39

def help(*args)
	puts "Jefe #{Jefe::VERSION}, the featherweight Procfile manager"
	puts "By default, calling `jefe' acts as `jefe start'. Your other options are:"
	puts
	super
end

#start(*args) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/jefe/cli.rb', line 19

def start(*args)
	if ! File.exists? procfile
		help
		error("#{procfile} does not exist")
	end
	
	loader = Jefe::Loader.new File.read procfile
	engine = Jefe::EM.new(Jefe::ColorPrinter.new)
	
	trap("INT") do
		puts
		engine.stop
	end
	engine.start do
		loader.scale(concurrency_options(args), port).each do |(name, command)|
			engine.add name, command
		end
	end
end