Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8b49256175 | ||
|
|
37d777f224 | ||
|
|
73fc059634 | ||
|
|
f7b7029cc0 | ||
|
|
3a101ec7dd | ||
|
|
6c931ea15e | ||
|
|
d173570d98 | ||
|
|
0cd41fee7f | ||
|
|
9da4e38209 | ||
|
|
5d9dfd294e | ||
|
|
8998e9a47c | ||
|
|
8238a86942 | ||
|
|
1153fb0f0c | ||
|
|
f69c755d9a | ||
|
|
e99f3173ef |
@@ -19,4 +19,3 @@ rvm:
|
|||||||
- 1.9.2
|
- 1.9.2
|
||||||
- 1.9.3
|
- 1.9.3
|
||||||
- jruby
|
- jruby
|
||||||
- ree
|
|
||||||
|
|||||||
@@ -1,3 +1,29 @@
|
|||||||
|
## 0.60.1 (2012-10-08)
|
||||||
|
|
||||||
|
* sleep on select() to avoid spinning the cpu [Silvio Relli]
|
||||||
|
|
||||||
|
## 0.60.0 (2012-09-25)
|
||||||
|
|
||||||
|
* foreman run can run things from the Procfile like heroku run. [Dan Peterson]
|
||||||
|
|
||||||
|
## 0.59.0 (2012-09-15)
|
||||||
|
|
||||||
|
* Use /bin/sh instead of bash for foreman-runner [Jeremy Evans]
|
||||||
|
|
||||||
|
## 0.58.0 (2012-09-14)
|
||||||
|
|
||||||
|
* dont set HOME [David Dollar]
|
||||||
|
* Add StandardOutPath to launchd export [Aaron Kalin]
|
||||||
|
* Add command argument string splitting [Aaron Kalin]
|
||||||
|
* Cleanup launchd exporter [Aaron Kalin]
|
||||||
|
* Enable trim_mode via '-' in ERB templates [Aaron Kalin]
|
||||||
|
* Add support for setting environment variables [Aaron Kalin]
|
||||||
|
* foreman run should exit with the same code as its command [Omar Khan]
|
||||||
|
* Handle multiline strings in .env file [Szymon Nowak]
|
||||||
|
* Use path and env variables in the inittab export [Indrek Juhkam]
|
||||||
|
* fixed the directory option [Arnaud Lachaume]
|
||||||
|
* Add capistrano export support [Daniel Farrell]
|
||||||
|
|
||||||
## 0.57.0 (2012-08-21)
|
## 0.57.0 (2012-08-21)
|
||||||
|
|
||||||
* fix startup checks for upstart exporter [Aditya Sanghi]
|
* fix startup checks for upstart exporter [Aditya Sanghi]
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
PATH
|
PATH
|
||||||
remote: .
|
remote: .
|
||||||
specs:
|
specs:
|
||||||
foreman (0.59.0)
|
foreman (0.60.2)
|
||||||
thor (>= 0.13.6)
|
thor (>= 0.13.6)
|
||||||
|
|
||||||
GEM
|
GEM
|
||||||
|
|||||||
+10
-1
@@ -75,10 +75,19 @@ class Foreman::CLI < Thor
|
|||||||
|
|
||||||
def run(*args)
|
def run(*args)
|
||||||
load_environment!
|
load_environment!
|
||||||
|
|
||||||
|
if File.exist?(procfile)
|
||||||
|
engine.load_procfile(procfile)
|
||||||
|
end
|
||||||
|
|
||||||
pid = fork do
|
pid = fork do
|
||||||
begin
|
begin
|
||||||
engine.env.each { |k,v| ENV[k] = v }
|
engine.env.each { |k,v| ENV[k] = v }
|
||||||
exec args.shelljoin
|
if args.size == 1 && process = engine.process(args.first)
|
||||||
|
process.exec(:env => engine.env)
|
||||||
|
else
|
||||||
|
exec args.shelljoin
|
||||||
|
end
|
||||||
rescue Errno::EACCES
|
rescue Errno::EACCES
|
||||||
error "not executable: #{args.first}"
|
error "not executable: #{args.first}"
|
||||||
rescue Errno::ENOENT
|
rescue Errno::ENOENT
|
||||||
|
|||||||
@@ -273,7 +273,8 @@ private
|
|||||||
Thread.new do
|
Thread.new do
|
||||||
begin
|
begin
|
||||||
loop do
|
loop do
|
||||||
(IO.select(@readers.values).first || []).each do |reader|
|
io = IO.select(@readers.values, nil, nil, 30)
|
||||||
|
(io.nil? ? [] : io.first).each do |reader|
|
||||||
data = reader.gets
|
data = reader.gets
|
||||||
output_with_mutex name_for(@readers.invert[reader]), data
|
output_with_mutex name_for(@readers.invert[reader]), data
|
||||||
end
|
end
|
||||||
|
|||||||
+32
-7
@@ -21,6 +21,21 @@ class Foreman::Process
|
|||||||
@options[:env] ||= {}
|
@options[:env] ||= {}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Get environment-expanded command for a +Process+
|
||||||
|
#
|
||||||
|
# @param [Hash] custom_env ({}) Environment variables to merge with defaults
|
||||||
|
#
|
||||||
|
# @return [String] The expanded command
|
||||||
|
#
|
||||||
|
def expanded_command(custom_env={})
|
||||||
|
env = @options[:env].merge(custom_env)
|
||||||
|
expanded_command = command.dup
|
||||||
|
env.each do |key, val|
|
||||||
|
expanded_command.gsub!("$#{key}", val)
|
||||||
|
end
|
||||||
|
expanded_command
|
||||||
|
end
|
||||||
|
|
||||||
# Run a +Process+
|
# Run a +Process+
|
||||||
#
|
#
|
||||||
# @param [Hash] options
|
# @param [Hash] options
|
||||||
@@ -31,16 +46,12 @@ class Foreman::Process
|
|||||||
# @returns [Fixnum] pid The +pid+ of the process
|
# @returns [Fixnum] pid The +pid+ of the process
|
||||||
#
|
#
|
||||||
def run(options={})
|
def run(options={})
|
||||||
env = options[:env] ? @options[:env].merge(options[:env]) : @options[:env]
|
env = @options[:env].merge(options[:env] || {})
|
||||||
output = options[:output] || $stdout
|
output = options[:output] || $stdout
|
||||||
|
|
||||||
if Foreman.windows?
|
if Foreman.windows?
|
||||||
Dir.chdir(cwd) do
|
Dir.chdir(cwd) do
|
||||||
expanded_command = command.dup
|
Process.spawn env, expanded_command(env), :out => output, :err => output
|
||||||
env.each do |key, val|
|
|
||||||
expanded_command.gsub!("$#{key}", val)
|
|
||||||
end
|
|
||||||
Process.spawn env, expanded_command, :out => output, :err => output
|
|
||||||
end
|
end
|
||||||
elsif Foreman.jruby?
|
elsif Foreman.jruby?
|
||||||
require "posix/spawn"
|
require "posix/spawn"
|
||||||
@@ -52,7 +63,7 @@ class Foreman::Process
|
|||||||
$stderr.reopen output
|
$stderr.reopen output
|
||||||
env.each { |k,v| ENV[k] = v }
|
env.each { |k,v| ENV[k] = v }
|
||||||
wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
|
wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
|
||||||
exec wrapped_command
|
Kernel.exec wrapped_command
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
|
wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
|
||||||
@@ -60,6 +71,20 @@ class Foreman::Process
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Exec a +Process+
|
||||||
|
#
|
||||||
|
# @param [Hash] options
|
||||||
|
#
|
||||||
|
# @option options :env ({}) Environment variables to set for this execution
|
||||||
|
#
|
||||||
|
# @return Does not return
|
||||||
|
def exec(options={})
|
||||||
|
env = @options[:env].merge(options[:env] || {})
|
||||||
|
env.each { |k, v| ENV[k] = v }
|
||||||
|
Dir.chdir(cwd)
|
||||||
|
Kernel.exec expanded_command(env)
|
||||||
|
end
|
||||||
|
|
||||||
# Send a signal to this +Process+
|
# Send a signal to this +Process+
|
||||||
#
|
#
|
||||||
# @param [String] signal The signal to send
|
# @param [String] signal The signal to send
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
module Foreman
|
module Foreman
|
||||||
|
|
||||||
VERSION = "0.59.0"
|
VERSION = "0.60.2"
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
.\" generated with Ronn/v0.7.3
|
.\" generated with Ronn/v0.7.3
|
||||||
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
||||||
.
|
.
|
||||||
.TH "FOREMAN" "1" "July 2012" "Foreman 0.57.0" "Foreman Manual"
|
.TH "FOREMAN" "1" "August 2012" "Foreman 0.60.1" "Foreman Manual"
|
||||||
.
|
.
|
||||||
.SH "NAME"
|
.SH "NAME"
|
||||||
\fBforeman\fR \- manage Procfile\-based applications
|
\fBforeman\fR \- manage Procfile\-based applications
|
||||||
|
|||||||
@@ -73,6 +73,10 @@ describe "Foreman::CLI", :fakefs do
|
|||||||
forked_foreman("run #{resource_path("bin/env FOO")} -e #{resource_path(".env")}").should == "bar\n"
|
forked_foreman("run #{resource_path("bin/env FOO")} -e #{resource_path(".env")}").should == "bar\n"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it "can run a command from the Procfile" do
|
||||||
|
forked_foreman("run -f #{resource_path("Procfile")} test").should == "testing\n"
|
||||||
|
end
|
||||||
|
|
||||||
it "exits with the same exit code as the command" do
|
it "exits with the same exit code as the command" do
|
||||||
fork_and_get_exitstatus("run echo 1").should == 0
|
fork_and_get_exitstatus("run echo 1").should == 0
|
||||||
fork_and_get_exitstatus("run date 'invalid_date'").should == 1
|
fork_and_get_exitstatus("run date 'invalid_date'").should == 1
|
||||||
|
|||||||
Reference in New Issue
Block a user