Compare commits

...
7 Commits
Author SHA1 Message Date
David Dollar 359d6f1c34 0.52.0 2012-07-24 11:10:16 -04:00
David Dollar 584f251e4a wrap command in a runner that sources .profile.d scripts 2012-07-24 11:09:54 -04:00
David Dollar 7d9c2b2ac4 fix upstart export specs 2012-07-24 10:50:34 -04:00
David Dollar fba4d9beff Merge pull request #229 from danielfarrell/autostart-upstart
Make upstart export start/stop with network
2012-07-18 13:55:01 -07:00
Daniel Farrell 0bde5fdab5 Make upstart export start/stop with network 2012-07-18 16:50:49 -04:00
David Dollar 1beab80c1f update docs 2012-07-11 18:33:13 -04:00
David Dollar 7b270f9f4a changelog 2012-07-11 18:33:10 -04:00
9 changed files with 42 additions and 21 deletions
+4
View File
@@ -1,3 +1,7 @@
## 0.51.0 (2012-07-11)
* dont try to colorize windows [David Dollar]
## 0.50.0 (2012-07-11) ## 0.50.0 (2012-07-11)
* handle windows [David Dollar] * handle windows [David Dollar]
+1 -1
View File
@@ -1,7 +1,7 @@
PATH PATH
remote: . remote: .
specs: specs:
foreman (0.51.0) foreman (0.52.0)
thor (>= 0.13.6) thor (>= 0.13.6)
GEM GEM
+15 -3
View File
@@ -1,6 +1,6 @@
#!/bin/sh #!/bin/bash
# #
#/ Usage: foreman-runner [-d <dir>] <command> [<args>...] #/ Usage: foreman-runner [-d <dir>] [-p] <command> [<args>...]
#/ #/
#/ Run a command with exec, optionally changing directory first #/ Run a command with exec, optionally changing directory first
@@ -16,9 +16,12 @@ usage() {
exit exit
} }
while getopts ":hd:" OPT; do read_profiled=""
while getopts ":hd:p" OPT; do
case $OPT in case $OPT in
d) cd "$OPTARG" ;; d) cd "$OPTARG" ;;
p) read_profiled="1" ;;
h) usage ;; h) usage ;;
\?) error "invalid option: -$OPTARG" ;; \?) error "invalid option: -$OPTARG" ;;
:) error "option -$OPTARG requires an argument" ;; :) error "option -$OPTARG requires an argument" ;;
@@ -29,4 +32,13 @@ shift $((OPTIND-1))
[ -z "$1" ] && usage [ -z "$1" ] && usage
if [ "$read_profiled" == "1" ]; then
shopt -s nullglob
for script in .profile.d/*; do
echo "sourcing $script"
source $script
done
shopt -u nullglob
fi
exec "$@" exec "$@"
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
export FOO=bar
+3
View File
@@ -6,3 +6,6 @@ bash << "EOF"
EOF EOF
end script end script
start on started network
stop on stopping network
+12 -15
View File
@@ -43,23 +43,20 @@ class Foreman::Process
Process.spawn env, expanded_command, :out => output, :err => output Process.spawn env, expanded_command, :out => output, :err => output
end end
elsif Foreman.jruby? elsif Foreman.jruby?
Dir.chdir(cwd) do require "posix/spawn"
require "posix/spawn" wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
POSIX::Spawn.spawn env, command, :out => output, :err => output POSIX::Spawn.spawn env, wrapped_command, :out => output, :err => output
end
elsif Foreman.ruby_18? elsif Foreman.ruby_18?
Dir.chdir(cwd) do fork do
fork do $stdout.reopen output
$stdout.reopen output $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}"
exec command exec wrapped_command
end
end end
else else
Dir.chdir(cwd) do wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
Process.spawn env, command, :out => output, :err => output Process.spawn env, wrapped_command, :out => output, :err => output
end
end end
end end
@@ -96,7 +93,7 @@ class Foreman::Process
private private
def cwd def cwd
@options[:cwd] || "." File.expand_path(@options[:cwd] || ".")
end end
end end
+1 -1
View File
@@ -1,5 +1,5 @@
module Foreman module Foreman
VERSION = "0.51.0" VERSION = "0.52.0"
end end
+1 -1
View File
@@ -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.50.0" "Foreman Manual" .TH "FOREMAN" "1" "July 2012" "Foreman 0.51.0" "Foreman Manual"
. .
.SH "NAME" .SH "NAME"
\fBforeman\fR \- manage Procfile\-based applications \fBforeman\fR \- manage Procfile\-based applications
+3
View File
@@ -6,3 +6,6 @@ bash << "EOF"
EOF EOF
end script end script
start on started network
stop on stopping network