foreman 0.13.1 → 0.14.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -3,4 +3,4 @@ stop on stopping <%= app %>-<%= process.name %>
3
3
  respawn
4
4
 
5
5
  chdir <%= engine.directory %>
6
- exec su - <%= user %> -c 'export PORT=<%= port %>; <%= process.command %> >> <%= log_root %>/<%=process.name%>-<%=num%>.log 2>&1'
6
+ exec su <%= user %> -c 'export PORT=<%= port %>; <%= process.command %> >> <%= log_root %>/<%=process.name%>-<%=num%>.log 2>&1'
@@ -1,5 +1,5 @@
1
1
  module Foreman
2
2
 
3
- VERSION = "0.13.1"
3
+ VERSION = "0.14.0"
4
4
 
5
5
  end
@@ -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
@@ -0,0 +1,6 @@
1
+ start on starting foreman-alpha
2
+ stop on stopping foreman-alpha
3
+ respawn
4
+
5
+ chdir /Users/david/Code/foreman
6
+ exec su foreman -c 'export PORT=5000; ./alpha >> /var/log/foreman/alpha-1.log 2>&1'
@@ -0,0 +1,6 @@
1
+ start on starting foreman-alpha
2
+ stop on stopping foreman-alpha
3
+ respawn
4
+
5
+ chdir /Users/david/Code/foreman
6
+ exec su foreman -c 'export PORT=5001; ./alpha >> /var/log/foreman/alpha-2.log 2>&1'
@@ -0,0 +1,2 @@
1
+ start on starting foreman
2
+ stop on stopping foreman
@@ -0,0 +1,6 @@
1
+ start on starting foreman-bravo
2
+ stop on stopping foreman-bravo
3
+ respawn
4
+
5
+ chdir /Users/david/Code/foreman
6
+ exec su foreman -c 'export PORT=5100; ./bravo >> /var/log/foreman/bravo-1.log 2>&1'
@@ -0,0 +1,2 @@
1
+ start on starting foreman
2
+ stop on stopping foreman
@@ -0,0 +1,8 @@
1
+ pre-start script
2
+
3
+ bash << "EOF"
4
+ mkdir -p /var/log/foreman
5
+ chown -R foreman /var/log/foreman
6
+ EOF
7
+
8
+ end script
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.13.1
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-10 00:00:00 -04:00
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