foreman 0.43.0 → 0.44.0
Sign up to get free protection for your applications and to get access to all the features.
- data/data/export/supervisord/app.conf.erb +1 -1
- data/lib/foreman/cli.rb +5 -1
- data/lib/foreman/engine.rb +9 -2
- data/lib/foreman/version.rb +1 -1
- data/man/foreman.1 +9 -1
- data/spec/foreman/cli_spec.rb +9 -0
- data/spec/foreman/engine_spec.rb +17 -0
- metadata +4 -4
@@ -5,7 +5,7 @@ engine.procfile.entries.each do |process|
|
|
5
5
|
1.upto(self.concurrency[process.name]) do |num|
|
6
6
|
port = engine.port_for(process, num, self.port)
|
7
7
|
name = if (conc > 1); "#{process.name}-#{num}" else process.name; end
|
8
|
-
environment = (engine.environment.map{ |var
|
8
|
+
environment = (engine.environment.keys.sort.map{ |var| %{#{var.upcase}="#{engine.environment[var]}"} } + [%{PORT="#{port}"}])
|
9
9
|
app_name = "#{app}-#{name}"
|
10
10
|
app_names << app_name
|
11
11
|
%>
|
data/lib/foreman/cli.rb
CHANGED
@@ -83,7 +83,11 @@ private ######################################################################
|
|
83
83
|
end
|
84
84
|
|
85
85
|
def procfile
|
86
|
-
|
86
|
+
case
|
87
|
+
when options[:procfile] then options[:procfile]
|
88
|
+
when options[:app_root] then File.expand_path(File.join(options[:app_root], "Procfile"))
|
89
|
+
else "Procfile"
|
90
|
+
end
|
87
91
|
end
|
88
92
|
|
89
93
|
def error(message)
|
data/lib/foreman/engine.rb
CHANGED
@@ -24,8 +24,10 @@ class Foreman::Engine
|
|
24
24
|
@procfile = Foreman::Procfile.new(procfile)
|
25
25
|
@directory = options[:app_root] || File.expand_path(File.dirname(procfile))
|
26
26
|
@options = options.dup
|
27
|
-
@environment = read_environment_files(options[:env])
|
28
27
|
@output_mutex = Mutex.new
|
28
|
+
|
29
|
+
@options[:env] ||= default_env
|
30
|
+
@environment = read_environment_files(@options[:env])
|
29
31
|
end
|
30
32
|
|
31
33
|
def start
|
@@ -214,7 +216,12 @@ private ######################################################################
|
|
214
216
|
environment.merge!(Foreman::Engine.read_environment(filename))
|
215
217
|
end
|
216
218
|
|
217
|
-
environment.merge!(Foreman::Engine.read_environment(".env")) unless filenames
|
218
219
|
environment
|
219
220
|
end
|
221
|
+
|
222
|
+
def default_env
|
223
|
+
env = File.join(directory, ".env")
|
224
|
+
File.exists?(env) ? env : ""
|
225
|
+
end
|
226
|
+
|
220
227
|
end
|
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" "
|
4
|
+
.TH "FOREMAN" "1" "April 2012" "Foreman 0.44.0" "Foreman Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBforeman\fR \- manage Procfile\-based applications
|
@@ -35,6 +35,14 @@ The following options control how the application is run:
|
|
35
35
|
Specify the number of each process type to run\. The value passed in should be in the format \fBprocess=num,process=num\fR
|
36
36
|
.
|
37
37
|
.TP
|
38
|
+
\fB\-e\fR, \fB\-\-env\fR
|
39
|
+
Specify one or more \.env files to load
|
40
|
+
.
|
41
|
+
.TP
|
42
|
+
\fB\-f\fR, \fB\-\-procfile\fR
|
43
|
+
Specify an alternate Procfile to load, implies \fB\-d\fR at the Procfile root\.
|
44
|
+
.
|
45
|
+
.TP
|
38
46
|
\fB\-p\fR, \fB\-\-port\fR
|
39
47
|
Specify which port to use as the base for this application\. Should be a multiple of 1000\.
|
40
48
|
.
|
data/spec/foreman/cli_spec.rb
CHANGED
@@ -34,6 +34,15 @@ describe "Foreman::CLI", :fakefs do
|
|
34
34
|
subject.start("alpha")
|
35
35
|
end
|
36
36
|
end
|
37
|
+
|
38
|
+
describe "with an alternate root" do
|
39
|
+
it "reads the Procfile from that root" do
|
40
|
+
write_procfile "/some/app/Procfile"
|
41
|
+
mock(Foreman::Procfile).new("/some/app/Procfile")
|
42
|
+
mock.instance_of(Foreman::Engine).start
|
43
|
+
foreman %{ start -d /some/app }
|
44
|
+
end
|
45
|
+
end
|
37
46
|
end
|
38
47
|
|
39
48
|
describe "export" do
|
data/spec/foreman/engine_spec.rb
CHANGED
@@ -49,6 +49,14 @@ describe "Foreman::Engine", :fakefs do
|
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
|
+
describe "directories" do
|
53
|
+
it "has the directory default relative to the Procfile" do
|
54
|
+
write_procfile "/some/app/Procfile"
|
55
|
+
engine = Foreman::Engine.new("/some/app/Procfile")
|
56
|
+
engine.directory.should == "/some/app"
|
57
|
+
end
|
58
|
+
end
|
59
|
+
|
52
60
|
describe "environment" do
|
53
61
|
before(:each) do
|
54
62
|
write_procfile
|
@@ -97,6 +105,15 @@ describe "Foreman::Engine", :fakefs do
|
|
97
105
|
engine.environment.should == {"FOO"=>"qoo"}
|
98
106
|
engine.start
|
99
107
|
end
|
108
|
+
|
109
|
+
it "should be loaded relative to the Procfile" do
|
110
|
+
FileUtils.mkdir_p "/some/app"
|
111
|
+
File.open("/some/app/.env", "w") { |f| f.puts("FOO=qoo") }
|
112
|
+
write_procfile "/some/app/Procfile"
|
113
|
+
engine = Foreman::Engine.new("/some/app/Procfile")
|
114
|
+
engine.environment.should == {"FOO"=>"qoo"}
|
115
|
+
engine.start
|
116
|
+
end
|
100
117
|
end
|
101
118
|
|
102
119
|
describe "utf8" do
|
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.44.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-04-
|
12
|
+
date: 2012-04-23 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70204085019820 !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: *
|
24
|
+
version_requirements: *70204085019820
|
25
25
|
description: Process manager for applications with multiple components
|
26
26
|
email: ddollar@gmail.com
|
27
27
|
executables:
|