Add "exec" action to allow execution of arbitrary commands with the app's environment.

This commit is contained in:
Matt Griffin
2012-01-04 15:22:10 -05:00
parent fff15bc627
commit a34bc59721
4 changed files with 88 additions and 0 deletions
+11
View File
@@ -53,7 +53,18 @@ class Foreman::CLI < Thor
error "no processes defined" unless engine.procfile.entries.length > 0
display "valid procfile detected (#{engine.procfile.process_names.join(', ')})"
end
desc "exec COMMAND", "Run a command using your application's environment"
def exec(*args)
engine.apply_environment!
Kernel.exec args.join(" ")
rescue Errno::EACCES
error "not executable: #{args.first}"
rescue Errno::ENOENT
error "command not found: #{args.first}"
end
private ######################################################################
def check_procfile!