foreman 0.34.1 → 0.35.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/foreman/utils.rb +4 -1
- data/lib/foreman/version.rb +1 -1
- data/spec/foreman/engine_spec.rb +1 -1
- data/spec/foreman/export/bluepill_spec.rb +8 -3
- data/spec/foreman/export/runit_spec.rb +1 -1
- data/spec/foreman/export/upstart_spec.rb +11 -2
- data/spec/resources/export/bluepill/app-concurrency.pill +47 -0
- data/spec/resources/export/bluepill/app.pill +0 -21
- data/spec/spec_helper.rb +4 -0
- metadata +8 -7
data/lib/foreman/utils.rb
CHANGED
@@ -5,7 +5,10 @@ class Foreman::Utils
|
|
5
5
|
def self.parse_concurrency(concurrency)
|
6
6
|
begin
|
7
7
|
pairs = concurrency.to_s.gsub(/\s/, "").split(",")
|
8
|
-
|
8
|
+
|
9
|
+
default = concurrency.nil? ? 1 : 0
|
10
|
+
|
11
|
+
pairs.inject(Hash.new(default)) do |hash, pair|
|
9
12
|
process, amount = pair.split("=")
|
10
13
|
hash.update(process => amount.to_i)
|
11
14
|
end
|
data/lib/foreman/version.rb
CHANGED
data/spec/foreman/engine_spec.rb
CHANGED
@@ -35,7 +35,7 @@ describe "Foreman::Engine" do
|
|
35
35
|
write_procfile
|
36
36
|
engine = Foreman::Engine.new("Procfile",:concurrency => "alpha=2")
|
37
37
|
mock.instance_of(Foreman::Process).run_process("./alpha", is_a(IO)).twice
|
38
|
-
mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO))
|
38
|
+
mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO)).never
|
39
39
|
mock(engine).watch_for_output
|
40
40
|
mock(engine).watch_for_termination
|
41
41
|
engine.start
|
@@ -12,8 +12,13 @@ describe Foreman::Export::Bluepill do
|
|
12
12
|
before(:each) { stub(bluepill).say }
|
13
13
|
|
14
14
|
it "exports to the filesystem" do
|
15
|
-
bluepill.export("/tmp/init"
|
16
|
-
File.read("/tmp/init/app.pill").should == example_export_file("bluepill/app.pill")
|
15
|
+
bluepill.export("/tmp/init")
|
16
|
+
normalize_space(File.read("/tmp/init/app.pill")).should == normalize_space(example_export_file("bluepill/app.pill"))
|
17
17
|
end
|
18
18
|
|
19
|
-
|
19
|
+
it "exports to the filesystem with concurrency" do
|
20
|
+
bluepill.export("/tmp/init", :concurrency => "alpha=2")
|
21
|
+
|
22
|
+
normalize_space(File.read("/tmp/init/app.pill")).should == normalize_space(example_export_file("bluepill/app-concurrency.pill"))
|
23
|
+
end
|
24
|
+
end
|
@@ -14,7 +14,7 @@ describe Foreman::Export::Runit do
|
|
14
14
|
|
15
15
|
it "exports to the filesystem" do
|
16
16
|
FileUtils.mkdir_p('/tmp/init')
|
17
|
-
runit.export('/tmp/init', :concurrency =>
|
17
|
+
runit.export('/tmp/init', :concurrency => "alpha=2,bravo=1")
|
18
18
|
|
19
19
|
File.read("/tmp/init/app-alpha-1/run").should == example_export_file('runit/app-alpha-1-run')
|
20
20
|
File.read("/tmp/init/app-alpha-1/log/run").should ==
|
@@ -12,16 +12,25 @@ describe Foreman::Export::Upstart do
|
|
12
12
|
before(:each) { stub(upstart).say }
|
13
13
|
|
14
14
|
it "exports to the filesystem" do
|
15
|
-
upstart.export("/tmp/init"
|
15
|
+
upstart.export("/tmp/init")
|
16
16
|
|
17
17
|
File.read("/tmp/init/app.conf").should == example_export_file("upstart/app.conf")
|
18
18
|
File.read("/tmp/init/app-alpha.conf").should == example_export_file("upstart/app-alpha.conf")
|
19
19
|
File.read("/tmp/init/app-alpha-1.conf").should == example_export_file("upstart/app-alpha-1.conf")
|
20
|
-
File.read("/tmp/init/app-alpha-2.conf").should == example_export_file("upstart/app-alpha-2.conf")
|
21
20
|
File.read("/tmp/init/app-bravo.conf").should == example_export_file("upstart/app-bravo.conf")
|
22
21
|
File.read("/tmp/init/app-bravo-1.conf").should == example_export_file("upstart/app-bravo-1.conf")
|
23
22
|
end
|
24
23
|
|
24
|
+
it "exports to the filesystem with concurrency" do
|
25
|
+
upstart.export("/tmp/init", :concurrency => "alpha=2")
|
26
|
+
|
27
|
+
File.read("/tmp/init/app.conf").should == example_export_file("upstart/app.conf")
|
28
|
+
File.read("/tmp/init/app-alpha.conf").should == example_export_file("upstart/app-alpha.conf")
|
29
|
+
File.read("/tmp/init/app-alpha-1.conf").should == example_export_file("upstart/app-alpha-1.conf")
|
30
|
+
File.read("/tmp/init/app-alpha-2.conf").should == example_export_file("upstart/app-alpha-2.conf")
|
31
|
+
File.exists?("/tmp/init/app-bravo-1.conf").should == false
|
32
|
+
end
|
33
|
+
|
25
34
|
context "with alternate templates" do
|
26
35
|
let(:template_root) { "/tmp/alternate" }
|
27
36
|
|
@@ -0,0 +1,47 @@
|
|
1
|
+
Bluepill.application("app", :foreground => false, :log_file => "/var/log/bluepill.log") do |app|
|
2
|
+
|
3
|
+
app.uid = "app"
|
4
|
+
app.gid = "app"
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
|
9
|
+
app.process("alpha-1") do |process|
|
10
|
+
process.start_command = "./alpha"
|
11
|
+
|
12
|
+
process.working_dir = "/tmp/app"
|
13
|
+
process.daemonize = true
|
14
|
+
process.environment = {"PORT" => "5000"}
|
15
|
+
process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
|
16
|
+
|
17
|
+
process.stdout = process.stderr = "/var/log/app/app-alpha-1.log"
|
18
|
+
|
19
|
+
process.monitor_children do |children|
|
20
|
+
children.stop_command "kill -QUIT {{PID}}"
|
21
|
+
end
|
22
|
+
|
23
|
+
process.group = "app-alpha"
|
24
|
+
end
|
25
|
+
|
26
|
+
|
27
|
+
app.process("alpha-2") do |process|
|
28
|
+
process.start_command = "./alpha"
|
29
|
+
|
30
|
+
process.working_dir = "/tmp/app"
|
31
|
+
process.daemonize = true
|
32
|
+
process.environment = {"PORT" => "5001"}
|
33
|
+
process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
|
34
|
+
|
35
|
+
process.stdout = process.stderr = "/var/log/app/app-alpha-2.log"
|
36
|
+
|
37
|
+
process.monitor_children do |children|
|
38
|
+
children.stop_command "kill -QUIT {{PID}}"
|
39
|
+
end
|
40
|
+
|
41
|
+
process.group = "app-alpha"
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
47
|
+
end
|
@@ -23,27 +23,6 @@ Bluepill.application("app", :foreground => false, :log_file => "/var/log/bluepil
|
|
23
23
|
process.group = "app-alpha"
|
24
24
|
end
|
25
25
|
|
26
|
-
|
27
|
-
app.process("alpha-2") do |process|
|
28
|
-
process.start_command = "./alpha"
|
29
|
-
|
30
|
-
process.working_dir = "/tmp/app"
|
31
|
-
process.daemonize = true
|
32
|
-
process.environment = {"PORT" => "5001"}
|
33
|
-
process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
|
34
|
-
|
35
|
-
process.stdout = process.stderr = "/var/log/app/app-alpha-2.log"
|
36
|
-
|
37
|
-
process.monitor_children do |children|
|
38
|
-
children.stop_command "kill -QUIT {{PID}}"
|
39
|
-
end
|
40
|
-
|
41
|
-
process.group = "app-alpha"
|
42
|
-
end
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
26
|
app.process("bravo-1") do |process|
|
48
27
|
process.start_command = "./bravo"
|
49
28
|
|
data/spec/spec_helper.rb
CHANGED
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.35.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-01-16 00:00:00.000000000Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: term-ansicolor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70188055415460 !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: *70188055415460
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70188055414840 !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: *70188055414840
|
36
36
|
description: Process manager for applications with multiple components
|
37
37
|
email: ddollar@gmail.com
|
38
38
|
executables:
|
@@ -78,6 +78,7 @@ files:
|
|
78
78
|
- spec/foreman/process_spec.rb
|
79
79
|
- spec/foreman_spec.rb
|
80
80
|
- spec/helper_spec.rb
|
81
|
+
- spec/resources/export/bluepill/app-concurrency.pill
|
81
82
|
- spec/resources/export/bluepill/app.pill
|
82
83
|
- spec/resources/export/runit/app-alpha-1-log-run
|
83
84
|
- spec/resources/export/runit/app-alpha-1-run
|
@@ -107,7 +108,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
107
108
|
version: '0'
|
108
109
|
segments:
|
109
110
|
- 0
|
110
|
-
hash:
|
111
|
+
hash: 3146046631320794397
|
111
112
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
112
113
|
none: false
|
113
114
|
requirements:
|
@@ -116,7 +117,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
116
117
|
version: '0'
|
117
118
|
segments:
|
118
119
|
- 0
|
119
|
-
hash:
|
120
|
+
hash: 3146046631320794397
|
120
121
|
requirements: []
|
121
122
|
rubyforge_project:
|
122
123
|
rubygems_version: 1.8.10
|