foreman 0.13.1 → 0.14.0
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/data/export/upstart/process.conf.erb +1 -1
- data/lib/foreman/version.rb +1 -1
- data/spec/foreman/export/upstart_spec.rb +19 -0
- data/spec/resources/export/upstart/foreman-alpha-1.conf +6 -0
- data/spec/resources/export/upstart/foreman-alpha-2.conf +6 -0
- data/spec/resources/export/upstart/foreman-alpha.conf +2 -0
- data/spec/resources/export/upstart/foreman-bravo-1.conf +6 -0
- data/spec/resources/export/upstart/foreman.bravo.conf +2 -0
- data/spec/resources/export/upstart/foreman.conf +8 -0
- data/spec/spec_helper.rb +21 -0
- metadata +8 -2
@@ -3,4 +3,4 @@ stop on stopping <%= app %>-<%= process.name %>
|
|
3
3
|
respawn
|
4
4
|
|
5
5
|
chdir <%= engine.directory %>
|
6
|
-
exec su
|
6
|
+
exec su <%= user %> -c 'export PORT=<%= port %>; <%= process.command %> >> <%= log_root %>/<%=process.name%>-<%=num%>.log 2>&1'
|
data/lib/foreman/version.rb
CHANGED
@@ -1,2 +1,21 @@
|
|
1
1
|
require "spec_helper"
|
2
2
|
require "foreman/export/upstart"
|
3
|
+
|
4
|
+
describe Foreman::Export::Upstart do
|
5
|
+
let(:engine) { Foreman::Engine.new(write_procfile) }
|
6
|
+
let(:upstart) { Foreman::Export::Upstart.new(engine) }
|
7
|
+
|
8
|
+
before(:each) { load_export_templates_into_fakefs("upstart") }
|
9
|
+
before(:each) { stub(upstart).say }
|
10
|
+
|
11
|
+
it "exports to the filesystem" do
|
12
|
+
upstart.export("/tmp/init")
|
13
|
+
|
14
|
+
File.read("/tmp/init/foreman.conf").should == example_export_file("upstart/foreman.conf")
|
15
|
+
File.read("/tmp/init/foreman-alpha.conf").should == example_export_file("upstart/foreman-alpha.conf")
|
16
|
+
File.read("/tmp/init/foreman-alpha-1.conf").should == example_export_file("upstart/foreman-alpha-1.conf")
|
17
|
+
File.read("/tmp/init/foreman-alpha-2.conf").should == example_export_file("upstart/foreman-alpha-2.conf")
|
18
|
+
File.read("/tmp/init/foreman-bravo.conf").should == example_export_file("upstart/foreman.bravo.conf")
|
19
|
+
File.read("/tmp/init/foreman-bravo-1.conf").should == example_export_file("upstart/foreman-bravo-1.conf")
|
20
|
+
end
|
21
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -29,6 +29,27 @@ def write_procfile(procfile="Procfile")
|
|
29
29
|
file.puts "alpha: ./alpha"
|
30
30
|
file.puts "bravo: ./bravo"
|
31
31
|
end
|
32
|
+
File.expand_path(procfile)
|
33
|
+
end
|
34
|
+
|
35
|
+
def load_export_templates_into_fakefs(type)
|
36
|
+
FakeFS.deactivate!
|
37
|
+
files = Dir[File.expand_path("../../data/export/#{type}/**", __FILE__)].inject({}) do |hash, file|
|
38
|
+
hash.update(file => File.read(file))
|
39
|
+
end
|
40
|
+
FakeFS.activate!
|
41
|
+
files.each do |filename, contents|
|
42
|
+
File.open(filename, "w") do |f|
|
43
|
+
f.puts contents
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def example_export_file(filename)
|
49
|
+
FakeFS.deactivate!
|
50
|
+
data = File.read(File.expand_path("../resources/export/#{filename}", __FILE__))
|
51
|
+
FakeFS.activate!
|
52
|
+
data
|
32
53
|
end
|
33
54
|
|
34
55
|
Rspec.configure do |config|
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: foreman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.
|
5
|
+
version: 0.14.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- David Dollar
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-05-
|
13
|
+
date: 2011-05-11 00:00:00 -04:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -147,6 +147,12 @@ files:
|
|
147
147
|
- spec/foreman/export_spec.rb
|
148
148
|
- spec/foreman/process_spec.rb
|
149
149
|
- spec/foreman_spec.rb
|
150
|
+
- spec/resources/export/upstart/foreman-alpha-1.conf
|
151
|
+
- spec/resources/export/upstart/foreman-alpha-2.conf
|
152
|
+
- spec/resources/export/upstart/foreman-alpha.conf
|
153
|
+
- spec/resources/export/upstart/foreman-bravo-1.conf
|
154
|
+
- spec/resources/export/upstart/foreman.bravo.conf
|
155
|
+
- spec/resources/export/upstart/foreman.conf
|
150
156
|
- spec/spec_helper.rb
|
151
157
|
- man/foreman.1
|
152
158
|
has_rdoc: true
|