add execute command
This commit is contained in:
@@ -13,6 +13,13 @@ class Foreman::CLI < Thor
|
|||||||
Foreman::Engine.new(procfile).start
|
Foreman::Engine.new(procfile).start
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc "execute PROCESS [PROCFILE]", "Run an instance of the specified process from PROCFILE"
|
||||||
|
|
||||||
|
def execute(process, procfile="Procfile")
|
||||||
|
error "#{procfile} does not exist." unless procfile_exists?(procfile)
|
||||||
|
Foreman::Engine.new(procfile).execute(process)
|
||||||
|
end
|
||||||
|
|
||||||
desc "export APP [PROCFILE] [FORMAT]", "Export the app described in PROCFILE as APP to another FORMAT"
|
desc "export APP [PROCFILE] [FORMAT]", "Export the app described in PROCFILE as APP to another FORMAT"
|
||||||
|
|
||||||
def export(app, procfile="Procfile", format="upstart")
|
def export(app, procfile="Procfile", format="upstart")
|
||||||
|
|||||||
@@ -25,6 +25,27 @@ describe "Foreman::CLI" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "execute" do
|
||||||
|
describe "with a non-existent Procfile" do
|
||||||
|
it "prints an error" do
|
||||||
|
mock_error(subject, "Procfile does not exist.") do
|
||||||
|
dont_allow.instance_of(Foreman::Engine).start
|
||||||
|
subject.execute("alpha")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "with a Procfile" do
|
||||||
|
before(:each) { write_procfile }
|
||||||
|
|
||||||
|
it "runs successfully" do
|
||||||
|
dont_allow(subject).error
|
||||||
|
mock.instance_of(Foreman::Engine).execute("alpha")
|
||||||
|
subject.execute("alpha")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
describe "export" do
|
describe "export" do
|
||||||
describe "with a non-existent Procfile" do
|
describe "with a non-existent Procfile" do
|
||||||
it "prints an error" do
|
it "prints an error" do
|
||||||
|
|||||||
@@ -29,4 +29,12 @@ describe "Foreman::Engine" do
|
|||||||
subject.start
|
subject.start
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe "execute" do
|
||||||
|
it "runs the processes" do
|
||||||
|
write_procfile
|
||||||
|
mock(subject).run(subject.processes["alpha"], false)
|
||||||
|
subject.execute("alpha")
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user