foreman 0.51.0 → 0.52.0

Sign up to get free protection for your applications and to get access to all the features.
data/bin/foreman-runner CHANGED
@@ -1,6 +1,6 @@
1
- #!/bin/sh
1
+ #!/bin/bash
2
2
  #
3
- #/ Usage: foreman-runner [-d <dir>] <command> [<args>...]
3
+ #/ Usage: foreman-runner [-d <dir>] [-p] <command> [<args>...]
4
4
  #/
5
5
  #/ Run a command with exec, optionally changing directory first
6
6
 
@@ -16,9 +16,12 @@ usage() {
16
16
  exit
17
17
  }
18
18
 
19
- while getopts ":hd:" OPT; do
19
+ read_profiled=""
20
+
21
+ while getopts ":hd:p" OPT; do
20
22
  case $OPT in
21
23
  d) cd "$OPTARG" ;;
24
+ p) read_profiled="1" ;;
22
25
  h) usage ;;
23
26
  \?) error "invalid option: -$OPTARG" ;;
24
27
  :) error "option -$OPTARG requires an argument" ;;
@@ -29,4 +32,13 @@ shift $((OPTIND-1))
29
32
 
30
33
  [ -z "$1" ] && usage
31
34
 
35
+ if [ "$read_profiled" == "1" ]; then
36
+ shopt -s nullglob
37
+ for script in .profile.d/*; do
38
+ echo "sourcing $script"
39
+ source $script
40
+ done
41
+ shopt -u nullglob
42
+ fi
43
+
32
44
  exec "$@"
@@ -6,3 +6,6 @@ bash << "EOF"
6
6
  EOF
7
7
 
8
8
  end script
9
+
10
+ start on started network
11
+ stop on stopping network
@@ -43,23 +43,20 @@ class Foreman::Process
43
43
  Process.spawn env, expanded_command, :out => output, :err => output
44
44
  end
45
45
  elsif Foreman.jruby?
46
- Dir.chdir(cwd) do
47
- require "posix/spawn"
48
- POSIX::Spawn.spawn env, command, :out => output, :err => output
49
- end
46
+ require "posix/spawn"
47
+ wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
48
+ POSIX::Spawn.spawn env, wrapped_command, :out => output, :err => output
50
49
  elsif Foreman.ruby_18?
51
- Dir.chdir(cwd) do
52
- fork do
53
- $stdout.reopen output
54
- $stderr.reopen output
55
- env.each { |k,v| ENV[k] = v }
56
- exec command
57
- end
50
+ fork do
51
+ $stdout.reopen output
52
+ $stderr.reopen output
53
+ env.each { |k,v| ENV[k] = v }
54
+ wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
55
+ exec wrapped_command
58
56
  end
59
57
  else
60
- Dir.chdir(cwd) do
61
- Process.spawn env, command, :out => output, :err => output
62
- end
58
+ wrapped_command = "#{Foreman.runner} -d '#{cwd}' -p -- #{command}"
59
+ Process.spawn env, wrapped_command, :out => output, :err => output
63
60
  end
64
61
  end
65
62
 
@@ -96,7 +93,7 @@ class Foreman::Process
96
93
  private
97
94
 
98
95
  def cwd
99
- @options[:cwd] || "."
96
+ File.expand_path(@options[:cwd] || ".")
100
97
  end
101
98
 
102
99
  end
@@ -1,5 +1,5 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.51.0"
3
+ VERSION = "0.52.0"
4
4
 
5
5
  end
@@ -6,3 +6,6 @@ bash << "EOF"
6
6
  EOF
7
7
 
8
8
  end script
9
+
10
+ start on started network
11
+ stop on stopping network
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.51.0
4
+ version: 0.52.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-07-11 00:00:00.000000000 Z
12
+ date: 2012-07-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: thor
16
- requirement: &70176192351000 !ruby/object:Gem::Requirement
16
+ requirement: &70304141675920 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: 0.13.6
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70176192351000
24
+ version_requirements: *70304141675920
25
25
  description: Process manager for applications with multiple components
26
26
  email: ddollar@gmail.com
27
27
  executables:
@@ -121,18 +121,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
121
121
  - - ! '>='
122
122
  - !ruby/object:Gem::Version
123
123
  version: '0'
124
- segments:
125
- - 0
126
- hash: -718384800535143884
127
124
  required_rubygems_version: !ruby/object:Gem::Requirement
128
125
  none: false
129
126
  requirements:
130
127
  - - ! '>='
131
128
  - !ruby/object:Gem::Version
132
129
  version: '0'
133
- segments:
134
- - 0
135
- hash: -718384800535143884
136
130
  requirements: []
137
131
  rubyforge_project:
138
132
  rubygems_version: 1.8.11
@@ -140,4 +134,3 @@ signing_key:
140
134
  specification_version: 3
141
135
  summary: Process manager for applications with multiple components
142
136
  test_files: []
143
- has_rdoc: