foreman 0.22.0 → 0.23.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/foreman/engine.rb +15 -12
- data/lib/foreman/version.rb +1 -1
- data/man/foreman.1 +3 -3
- data/spec/foreman/engine_spec.rb +10 -0
- metadata +8 -8
data/lib/foreman/engine.rb
CHANGED
@@ -22,7 +22,7 @@ class Foreman::Engine
|
|
22
22
|
@procfile = read_procfile(procfile)
|
23
23
|
@directory = File.expand_path(File.dirname(procfile))
|
24
24
|
@options = options
|
25
|
-
@environment =
|
25
|
+
@environment = read_environment_files(options[:env])
|
26
26
|
end
|
27
27
|
|
28
28
|
def processes
|
@@ -202,24 +202,27 @@ private ######################################################################
|
|
202
202
|
puts "!!! e.g. web: thin start"
|
203
203
|
end
|
204
204
|
|
205
|
-
def
|
206
|
-
error "No such file: #{filename}" if filename && !File.exists?(filename)
|
207
|
-
filename ||= ".env"
|
205
|
+
def read_environment_files(filenames)
|
208
206
|
environment = {}
|
209
207
|
|
210
|
-
|
211
|
-
File.
|
212
|
-
|
213
|
-
environment[$1] = $2
|
214
|
-
end
|
215
|
-
end
|
208
|
+
(filenames || "").split(",").map(&:strip).each do |filename|
|
209
|
+
error "No such file: #{filename}" unless File.exists?(filename)
|
210
|
+
environment.merge!(read_environment(filename))
|
216
211
|
end
|
217
212
|
|
213
|
+
environment.merge!(read_environment(".env")) unless filenames
|
218
214
|
environment
|
219
215
|
end
|
220
216
|
|
221
|
-
def
|
222
|
-
File.
|
217
|
+
def read_environment(filename)
|
218
|
+
return {} unless File.exists?(filename)
|
219
|
+
|
220
|
+
File.read(filename).split("\n").inject({}) do |hash, line|
|
221
|
+
if line =~ /\A([A-Za-z_]+)=(.*)\z/
|
222
|
+
hash[$1] = $2
|
223
|
+
end
|
224
|
+
hash
|
225
|
+
end
|
223
226
|
end
|
224
227
|
|
225
228
|
def terminate_gracefully
|
data/lib/foreman/version.rb
CHANGED
data/man/foreman.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "FOREMAN" "1" "September 2011" "Foreman 0.
|
4
|
+
.TH "FOREMAN" "1" "September 2011" "Foreman 0.23.0" "Foreman Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBforeman\fR \- manage Procfile\-based applications
|
@@ -69,7 +69,7 @@ These options control all modes of foreman\'s operation\.
|
|
69
69
|
.
|
70
70
|
.TP
|
71
71
|
\fB\-e\fR, \fB\-\-env\fR
|
72
|
-
Specify an alternate environment file\.
|
72
|
+
Specify an alternate environment file\. You can specify more than one file by using: \fB\-\-env file1,file2\fR\.
|
73
73
|
.
|
74
74
|
.TP
|
75
75
|
\fB\-f\fR, \fB\-\-procfile\fR
|
@@ -165,7 +165,7 @@ If a \fB\.foreman\fR file exists in the current directory, default options will
|
|
165
165
|
.
|
166
166
|
.nf
|
167
167
|
|
168
|
-
concurrency: alpha=0
|
168
|
+
concurrency: alpha=0,bravo=1
|
169
169
|
port: 15000
|
170
170
|
.
|
171
171
|
.fi
|
data/spec/foreman/engine_spec.rb
CHANGED
@@ -79,6 +79,16 @@ describe "Foreman::Engine" do
|
|
79
79
|
engine.execute("alpha")
|
80
80
|
end
|
81
81
|
|
82
|
+
it "should read more than one if specified" do
|
83
|
+
File.open("/tmp/env1", "w") { |f| f.puts("FOO=bar") }
|
84
|
+
File.open("/tmp/env2", "w") { |f| f.puts("BAZ=qux") }
|
85
|
+
engine = Foreman::Engine.new("Procfile", :env => "/tmp/env1,/tmp/env2")
|
86
|
+
stub(engine).info
|
87
|
+
mock(engine).watch_for_termination
|
88
|
+
engine.environment.should == { "FOO"=>"bar", "BAZ"=>"qux" }
|
89
|
+
engine.execute("alpha")
|
90
|
+
end
|
91
|
+
|
82
92
|
it "should fail if specified and doesnt exist" do
|
83
93
|
mock.instance_of(Foreman::Engine).error("No such file: /tmp/env")
|
84
94
|
engine = Foreman::Engine.new("Procfile", :env => "/tmp/env")
|
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.
|
4
|
+
version: 0.23.1
|
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: 2011-
|
12
|
+
date: 2011-10-04 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: term-ansicolor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70129124490300 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.5
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70129124490300
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70129124481440 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 0.13.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70129124481440
|
36
36
|
description: Process manager for applications with multiple components
|
37
37
|
email: ddollar@gmail.com
|
38
38
|
executables:
|
@@ -93,7 +93,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
93
93
|
version: '0'
|
94
94
|
segments:
|
95
95
|
- 0
|
96
|
-
hash:
|
96
|
+
hash: 4036267716300472320
|
97
97
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
98
98
|
none: false
|
99
99
|
requirements:
|
@@ -102,7 +102,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
102
102
|
version: '0'
|
103
103
|
segments:
|
104
104
|
- 0
|
105
|
-
hash:
|
105
|
+
hash: 4036267716300472320
|
106
106
|
requirements: []
|
107
107
|
rubyforge_project:
|
108
108
|
rubygems_version: 1.8.10
|