foreman 0.67.0 → 0.69.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (48) hide show
  1. checksums.yaml +7 -0
  2. data/README.md +14 -0
  3. data/data/export/upstart/process.conf.erb +1 -1
  4. data/lib/foreman.rb +0 -2
  5. data/lib/foreman/cli.rb +0 -9
  6. data/lib/foreman/engine.rb +28 -22
  7. data/lib/foreman/process.rb +2 -51
  8. data/lib/foreman/version.rb +1 -1
  9. data/man/foreman.1 +1 -1
  10. data/spec/foreman/cli_spec.rb +18 -26
  11. data/spec/foreman/engine_spec.rb +13 -13
  12. data/spec/foreman/export/base_spec.rb +1 -1
  13. data/spec/foreman/export/bluepill_spec.rb +2 -2
  14. data/spec/foreman/export/daemon_spec.rb +12 -12
  15. data/spec/foreman/export/inittab_spec.rb +2 -2
  16. data/spec/foreman/export/launchd_spec.rb +3 -3
  17. data/spec/foreman/export/runit_spec.rb +12 -12
  18. data/spec/foreman/export/supervisord_spec.rb +2 -2
  19. data/spec/foreman/export/systemd_spec.rb +13 -13
  20. data/spec/foreman/export/upstart_spec.rb +14 -14
  21. data/spec/foreman/helpers_spec.rb +4 -4
  22. data/spec/foreman/process_spec.rb +29 -6
  23. data/spec/foreman/procfile_spec.rb +9 -9
  24. data/spec/foreman_spec.rb +1 -1
  25. data/spec/helper_spec.rb +3 -2
  26. data/spec/resources/export/bluepill/app-concurrency.pill +2 -2
  27. data/spec/resources/export/bluepill/app.pill +4 -4
  28. data/spec/resources/export/runit/app-alpha-1/run +1 -0
  29. data/spec/resources/export/runit/app-alpha-2/run +1 -0
  30. data/spec/resources/export/runit/app-bravo-1/run +1 -0
  31. data/spec/resources/export/systemd/{app-alpha-1.service → concurrency/app-alpha-1.service} +0 -3
  32. data/spec/resources/export/systemd/{app-alpha-2.service → concurrency/app-alpha-2.service} +0 -3
  33. data/spec/resources/export/systemd/concurrency/app-alpha.target +3 -0
  34. data/spec/resources/export/systemd/concurrency/app.target +6 -0
  35. data/spec/resources/export/systemd/standard/app-alpha-1.service +14 -0
  36. data/spec/resources/export/systemd/standard/app-alpha.target +3 -0
  37. data/spec/resources/export/systemd/{app-bravo-1.service → standard/app-bravo-1.service} +0 -3
  38. data/spec/resources/export/systemd/standard/app-bravo.target +3 -0
  39. data/spec/resources/export/systemd/standard/app.target +6 -0
  40. data/spec/resources/export/upstart/app-alpha-1.conf +7 -1
  41. data/spec/resources/export/upstart/app-alpha-2.conf +7 -1
  42. data/spec/resources/export/upstart/app-bravo-1.conf +7 -1
  43. data/spec/resources/export/upstart/app.conf +1 -11
  44. data/spec/spec_helper.rb +8 -23
  45. metadata +16 -25
  46. data/spec/resources/export/systemd/app-alpha.target +0 -5
  47. data/spec/resources/export/systemd/app-bravo.target +0 -5
  48. data/spec/resources/export/systemd/app.target +0 -1
@@ -12,6 +12,3 @@ StandardOutput=syslog
12
12
  StandardError=syslog
13
13
  SyslogIdentifier=%n
14
14
  KillMode=process
15
-
16
- [Install]
17
- WantedBy=app-alpha.target
@@ -0,0 +1,3 @@
1
+ [Unit]
2
+ StopWhenUnneeded=true
3
+ Wants=app-alpha-1.service app-alpha-2.service
@@ -0,0 +1,6 @@
1
+ [Unit]
2
+ StopWhenUnneeded=true
3
+ Wants=app-alpha.target
4
+
5
+ [Install]
6
+ WantedBy=multi-user.target
@@ -0,0 +1,14 @@
1
+ [Unit]
2
+ StopWhenUnneeded=true
3
+
4
+ [Service]
5
+ User=app
6
+ WorkingDirectory=/tmp/app
7
+ Environment=PORT=5000
8
+ ExecStart=/bin/bash -lc './alpha'
9
+ Restart=always
10
+ StandardInput=null
11
+ StandardOutput=syslog
12
+ StandardError=syslog
13
+ SyslogIdentifier=%n
14
+ KillMode=process
@@ -0,0 +1,3 @@
1
+ [Unit]
2
+ StopWhenUnneeded=true
3
+ Wants=app-alpha-1.service
@@ -12,6 +12,3 @@ StandardOutput=syslog
12
12
  StandardError=syslog
13
13
  SyslogIdentifier=%n
14
14
  KillMode=process
15
-
16
- [Install]
17
- WantedBy=app-bravo.target
@@ -0,0 +1,3 @@
1
+ [Unit]
2
+ StopWhenUnneeded=true
3
+ Wants=app-bravo-1.service
@@ -0,0 +1,6 @@
1
+ [Unit]
2
+ StopWhenUnneeded=true
3
+ Wants=app-alpha.target app-bravo.target app-foo_bar.target app-foo-bar.target
4
+
5
+ [Install]
6
+ WantedBy=multi-user.target
@@ -2,4 +2,10 @@ start on starting app-alpha
2
2
  stop on stopping app-alpha
3
3
  respawn
4
4
 
5
- exec su - app -c 'cd /tmp/app; export PORT=5000; ./alpha >> /var/log/app/alpha-1.log 2>&1'
5
+ env PORT=5000
6
+
7
+ setuid app
8
+
9
+ chdir /tmp/app
10
+
11
+ exec ./alpha >> /var/log/app/alpha-1.log 2>&1
@@ -2,4 +2,10 @@ start on starting app-alpha
2
2
  stop on stopping app-alpha
3
3
  respawn
4
4
 
5
- exec su - app -c 'cd /tmp/app; export PORT=5001; ./alpha >> /var/log/app/alpha-2.log 2>&1'
5
+ env PORT=5001
6
+
7
+ setuid app
8
+
9
+ chdir /tmp/app
10
+
11
+ exec ./alpha >> /var/log/app/alpha-2.log 2>&1
@@ -2,4 +2,10 @@ start on starting app-bravo
2
2
  stop on stopping app-bravo
3
3
  respawn
4
4
 
5
- exec su - app -c 'cd /tmp/app; export PORT=5100; ./bravo >> /var/log/app/bravo-1.log 2>&1'
5
+ env PORT=5100
6
+
7
+ setuid app
8
+
9
+ chdir /tmp/app
10
+
11
+ exec ./bravo >> /var/log/app/bravo-1.log 2>&1
@@ -1,12 +1,2 @@
1
- pre-start script
2
-
3
- bash << "EOF"
4
- mkdir -p /var/log/app
5
- chown -R app /var/log/app
6
- EOF
7
-
8
- end script
9
-
10
1
  start on runlevel [2345]
11
-
12
- stop on runlevel [016]
2
+ stop on runlevel [!2345]
data/spec/spec_helper.rb CHANGED
@@ -1,3 +1,6 @@
1
+ require "codeclimate-test-reporter"
2
+ CodeClimate::TestReporter.start
3
+
1
4
  require "simplecov"
2
5
  SimpleCov.start do
3
6
  add_filter "/spec/"
@@ -10,17 +13,8 @@ require "fakefs/spec_helpers"
10
13
 
11
14
  $:.unshift File.expand_path("../../lib", __FILE__)
12
15
 
13
- begin
14
- def running_ruby_18?
15
- defined?(RUBY_VERSION) and RUBY_VERSION =~ /^1\.8\.\d+/
16
- end
17
- require 'posix/spawn' if running_ruby_18?
18
- rescue LoadError
19
- STDERR.puts "WARNING: foreman requires gem `posix-spawn` on Ruby #{RUBY_VERSION}. Please `gem install posix-spawn`."
20
- end
21
-
22
16
  def mock_export_error(message)
23
- lambda { yield }.should raise_error(Foreman::Export::Exception, message)
17
+ expect { yield }.to raise_error(Foreman::Export::Exception, message)
24
18
  end
25
19
 
26
20
  def mock_error(subject, message)
@@ -45,11 +39,7 @@ end
45
39
 
46
40
  def forked_foreman(args)
47
41
  rd, wr = make_pipe
48
- if running_ruby_18?
49
- POSIX::Spawn.spawn({}, "bundle exec bin/foreman #{args}", :out => wr, :err => wr)
50
- else
51
- Process.spawn("bundle exec bin/foreman #{args}", :out => wr, :err => wr)
52
- end
42
+ Process.spawn("bundle exec bin/foreman #{args}", :out => wr, :err => wr)
53
43
  wr.close
54
44
  rd.read
55
45
  end
@@ -74,17 +64,13 @@ def fork_and_capture(&blk)
74
64
  end
75
65
 
76
66
  def fork_and_get_exitstatus(args)
77
- pid = if running_ruby_18?
78
- POSIX::Spawn.spawn({}, "bundle exec bin/foreman #{args}", :out => "/dev/null", :err => "/dev/null")
79
- else
80
- Process.spawn("bundle exec bin/foreman #{args}", :out => "/dev/null", :err => "/dev/null")
81
- end
67
+ pid = Process.spawn("bundle exec bin/foreman #{args}", :out => "/dev/null", :err => "/dev/null")
82
68
  Process.wait(pid)
83
69
  $?.exitstatus
84
70
  end
85
71
 
86
72
  def mock_exit(&block)
87
- block.should raise_error(SystemExit)
73
+ expect(block).to raise_error(SystemExit)
88
74
  end
89
75
 
90
76
  def write_foreman_config(app)
@@ -173,9 +159,8 @@ end
173
159
 
174
160
  RSpec.configure do |config|
175
161
  config.treat_symbols_as_metadata_keys_with_true_values = true
176
- config.color_enabled = true
162
+ config.color = true
177
163
  config.order = 'rand'
178
164
  config.include FakeFS::SpecHelpers, :fakefs
179
165
  config.mock_with :rr
180
- config.backtrace_clean_patterns = []
181
166
  end
metadata CHANGED
@@ -1,20 +1,18 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foreman
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.67.0
5
- prerelease:
4
+ version: 0.69.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - David Dollar
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2014-04-24 00:00:00.000000000 Z
11
+ date: 2014-06-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: thor
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
17
  - - ~>
20
18
  - !ruby/object:Gem::Version
@@ -22,7 +20,6 @@ dependencies:
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
24
  - - ~>
28
25
  - !ruby/object:Gem::Version
@@ -30,7 +27,6 @@ dependencies:
30
27
  - !ruby/object:Gem::Dependency
31
28
  name: dotenv
32
29
  requirement: !ruby/object:Gem::Requirement
33
- none: false
34
30
  requirements:
35
31
  - - ~>
36
32
  - !ruby/object:Gem::Version
@@ -38,7 +34,6 @@ dependencies:
38
34
  type: :runtime
39
35
  prerelease: false
40
36
  version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
37
  requirements:
43
38
  - - ~>
44
39
  - !ruby/object:Gem::Version
@@ -136,12 +131,15 @@ files:
136
131
  - spec/resources/export/runit/app-bravo-1/run
137
132
  - spec/resources/export/supervisord/app-alpha-1.conf
138
133
  - spec/resources/export/supervisord/app-alpha-2.conf
139
- - spec/resources/export/systemd/app-alpha-1.service
140
- - spec/resources/export/systemd/app-alpha-2.service
141
- - spec/resources/export/systemd/app-alpha.target
142
- - spec/resources/export/systemd/app-bravo-1.service
143
- - spec/resources/export/systemd/app-bravo.target
144
- - spec/resources/export/systemd/app.target
134
+ - spec/resources/export/systemd/concurrency/app-alpha-1.service
135
+ - spec/resources/export/systemd/concurrency/app-alpha-2.service
136
+ - spec/resources/export/systemd/concurrency/app-alpha.target
137
+ - spec/resources/export/systemd/concurrency/app.target
138
+ - spec/resources/export/systemd/standard/app-alpha-1.service
139
+ - spec/resources/export/systemd/standard/app-alpha.target
140
+ - spec/resources/export/systemd/standard/app-bravo-1.service
141
+ - spec/resources/export/systemd/standard/app-bravo.target
142
+ - spec/resources/export/systemd/standard/app.target
145
143
  - spec/resources/export/upstart/app-alpha-1.conf
146
144
  - spec/resources/export/upstart/app-alpha-2.conf
147
145
  - spec/resources/export/upstart/app-alpha.conf
@@ -154,33 +152,26 @@ files:
154
152
  homepage: http://github.com/ddollar/foreman
155
153
  licenses:
156
154
  - MIT
155
+ metadata: {}
157
156
  post_install_message:
158
157
  rdoc_options: []
159
158
  require_paths:
160
159
  - lib
161
160
  required_ruby_version: !ruby/object:Gem::Requirement
162
- none: false
163
161
  requirements:
164
- - - ! '>='
162
+ - - '>='
165
163
  - !ruby/object:Gem::Version
166
164
  version: '0'
167
- segments:
168
- - 0
169
- hash: -2084842679123985083
170
165
  required_rubygems_version: !ruby/object:Gem::Requirement
171
- none: false
172
166
  requirements:
173
- - - ! '>='
167
+ - - '>='
174
168
  - !ruby/object:Gem::Version
175
169
  version: '0'
176
- segments:
177
- - 0
178
- hash: -2084842679123985083
179
170
  requirements: []
180
171
  rubyforge_project:
181
- rubygems_version: 1.8.23
172
+ rubygems_version: 2.0.14
182
173
  signing_key:
183
- specification_version: 3
174
+ specification_version: 4
184
175
  summary: Process manager for applications with multiple components
185
176
  test_files: []
186
177
  has_rdoc:
@@ -1,5 +0,0 @@
1
- [Unit]
2
- StopWhenUnneeded=true
3
-
4
- [Install]
5
- WantedBy=app.target
@@ -1,5 +0,0 @@
1
- [Unit]
2
- StopWhenUnneeded=true
3
-
4
- [Install]
5
- WantedBy=app.target
@@ -1 +0,0 @@
1
- [Unit]