foreman 0.26.1 → 0.40.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/README.md +40 -0
- data/bin/foreman-runner +36 -0
- data/data/example/Procfile +1 -0
- data/data/example/utf8 +11 -0
- data/data/export/bluepill/master.pill.erb +3 -3
- data/lib/foreman/cli.rb +35 -31
- data/lib/foreman/engine.rb +109 -82
- data/lib/foreman/export/base.rb +12 -5
- data/lib/foreman/export/bluepill.rb +5 -7
- data/lib/foreman/export/inittab.rb +11 -13
- data/lib/foreman/export/runit.rb +24 -25
- data/lib/foreman/export/upstart.rb +9 -11
- data/lib/foreman/export.rb +21 -0
- data/lib/foreman/helpers.rb +45 -0
- data/lib/foreman/process.rb +88 -6
- data/lib/foreman/procfile.rb +8 -7
- data/lib/foreman/procfile_entry.rb +22 -0
- data/lib/foreman/utils.rb +4 -1
- data/lib/foreman/version.rb +1 -1
- data/lib/foreman.rb +12 -1
- data/man/foreman.1 +17 -3
- data/spec/foreman/cli_spec.rb +96 -7
- data/spec/foreman/engine_spec.rb +52 -31
- data/spec/foreman/export/base_spec.rb +22 -0
- data/spec/foreman/export/bluepill_spec.rb +23 -7
- data/spec/foreman/export/inittab_spec.rb +40 -0
- data/spec/foreman/export/runit_spec.rb +18 -12
- data/spec/foreman/export/upstart_spec.rb +40 -8
- data/spec/foreman/export_spec.rb +22 -0
- data/spec/foreman/helpers_spec.rb +26 -0
- data/spec/foreman/process_spec.rb +131 -2
- data/spec/foreman_spec.rb +5 -0
- data/spec/helper_spec.rb +18 -0
- data/spec/resources/bin/utf8 +2 -0
- data/spec/resources/export/bluepill/app-concurrency.pill +47 -0
- data/spec/resources/export/bluepill/app.pill +1 -22
- data/spec/resources/export/inittab/inittab.concurrency +4 -0
- data/spec/resources/export/inittab/inittab.default +4 -0
- data/spec/spec_helper.rb +36 -4
- metadata +23 -11
- data/README.markdown +0 -49
|
@@ -19,31 +19,10 @@ Bluepill.application("app", :foreground => false, :log_file => "/var/log/bluepil
|
|
|
19
19
|
process.monitor_children do |children|
|
|
20
20
|
children.stop_command "kill -QUIT {{PID}}"
|
|
21
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
22
|
|
|
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
23
|
process.group = "app-alpha"
|
|
42
24
|
end
|
|
43
25
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
26
|
app.process("bravo-1") do |process|
|
|
48
27
|
process.start_command = "./bravo"
|
|
49
28
|
|
|
@@ -57,7 +36,7 @@ Bluepill.application("app", :foreground => false, :log_file => "/var/log/bluepil
|
|
|
57
36
|
process.monitor_children do |children|
|
|
58
37
|
children.stop_command "kill -QUIT {{PID}}"
|
|
59
38
|
end
|
|
60
|
-
|
|
39
|
+
|
|
61
40
|
process.group = "app-bravo"
|
|
62
41
|
end
|
|
63
42
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
1
|
require "rubygems"
|
|
2
|
+
|
|
3
|
+
require "simplecov"
|
|
4
|
+
SimpleCov.start do
|
|
5
|
+
add_filter "/spec/"
|
|
6
|
+
end
|
|
7
|
+
|
|
2
8
|
require "rspec"
|
|
3
9
|
require "fakefs/safe"
|
|
4
10
|
require "fakefs/spec_helpers"
|
|
5
11
|
|
|
6
12
|
$:.unshift File.expand_path("../../lib", __FILE__)
|
|
7
13
|
|
|
14
|
+
def mock_export_error(message)
|
|
15
|
+
lambda { yield }.should raise_error(Foreman::Export::Exception, message)
|
|
16
|
+
end
|
|
17
|
+
|
|
8
18
|
def mock_error(subject, message)
|
|
9
19
|
mock_exit do
|
|
10
20
|
mock(subject).puts("ERROR: #{message}")
|
|
@@ -37,9 +47,11 @@ def write_procfile(procfile="Procfile", alpha_env="")
|
|
|
37
47
|
File.expand_path(procfile)
|
|
38
48
|
end
|
|
39
49
|
|
|
40
|
-
def write_env(env=".env")
|
|
50
|
+
def write_env(env=".env", options={"FOO"=>"bar"})
|
|
41
51
|
File.open(env, "w") do |file|
|
|
42
|
-
|
|
52
|
+
options.each do |key, val|
|
|
53
|
+
file.puts "#{key}=#{val}"
|
|
54
|
+
end
|
|
43
55
|
end
|
|
44
56
|
end
|
|
45
57
|
|
|
@@ -56,15 +68,35 @@ def load_export_templates_into_fakefs(type)
|
|
|
56
68
|
end
|
|
57
69
|
end
|
|
58
70
|
|
|
71
|
+
def resource_path(filename)
|
|
72
|
+
File.expand_path("../resources/#{filename}", __FILE__)
|
|
73
|
+
end
|
|
74
|
+
|
|
59
75
|
def example_export_file(filename)
|
|
60
76
|
FakeFS.deactivate!
|
|
61
|
-
data = File.read(File.expand_path("
|
|
77
|
+
data = File.read(File.expand_path(resource_path("export/#{filename}"), __FILE__))
|
|
62
78
|
FakeFS.activate!
|
|
63
79
|
data
|
|
64
80
|
end
|
|
65
81
|
|
|
82
|
+
def preserving_env
|
|
83
|
+
old_env = ENV.to_hash
|
|
84
|
+
begin
|
|
85
|
+
yield
|
|
86
|
+
ensure
|
|
87
|
+
ENV.clear
|
|
88
|
+
ENV.update(old_env)
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
def normalize_space(s)
|
|
93
|
+
s.gsub(/\n[\n\s]*/, "\n")
|
|
94
|
+
end
|
|
95
|
+
|
|
66
96
|
RSpec.configure do |config|
|
|
97
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
|
67
98
|
config.color_enabled = true
|
|
68
|
-
config.
|
|
99
|
+
config.order = 'rand'
|
|
100
|
+
config.include FakeFS::SpecHelpers, :fakefs
|
|
69
101
|
config.mock_with :rr
|
|
70
102
|
end
|
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.40.0
|
|
5
5
|
prerelease:
|
|
6
6
|
platform: ruby
|
|
7
7
|
authors:
|
|
@@ -9,22 +9,22 @@ authors:
|
|
|
9
9
|
autorequire:
|
|
10
10
|
bindir: bin
|
|
11
11
|
cert_chain: []
|
|
12
|
-
date:
|
|
12
|
+
date: 2012-02-24 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
|
14
14
|
- !ruby/object:Gem::Dependency
|
|
15
15
|
name: term-ansicolor
|
|
16
|
-
requirement: &
|
|
16
|
+
requirement: &70330442658940 !ruby/object:Gem::Requirement
|
|
17
17
|
none: false
|
|
18
18
|
requirements:
|
|
19
19
|
- - ~>
|
|
20
20
|
- !ruby/object:Gem::Version
|
|
21
|
-
version: 1.0.
|
|
21
|
+
version: 1.0.7
|
|
22
22
|
type: :runtime
|
|
23
23
|
prerelease: false
|
|
24
|
-
version_requirements: *
|
|
24
|
+
version_requirements: *70330442658940
|
|
25
25
|
- !ruby/object:Gem::Dependency
|
|
26
26
|
name: thor
|
|
27
|
-
requirement: &
|
|
27
|
+
requirement: &70330442658420 !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: *70330442658420
|
|
36
36
|
description: Process manager for applications with multiple components
|
|
37
37
|
email: ddollar@gmail.com
|
|
38
38
|
executables:
|
|
@@ -41,11 +41,13 @@ extensions: []
|
|
|
41
41
|
extra_rdoc_files: []
|
|
42
42
|
files:
|
|
43
43
|
- bin/foreman
|
|
44
|
+
- bin/foreman-runner
|
|
44
45
|
- data/example/error
|
|
45
46
|
- data/example/log/neverdie.log
|
|
46
47
|
- data/example/Procfile
|
|
47
48
|
- data/example/Procfile.without_colon
|
|
48
49
|
- data/example/ticker
|
|
50
|
+
- data/example/utf8
|
|
49
51
|
- data/export/bluepill/master.pill.erb
|
|
50
52
|
- data/export/runit/log_run.erb
|
|
51
53
|
- data/export/runit/run.erb
|
|
@@ -61,21 +63,31 @@ files:
|
|
|
61
63
|
- lib/foreman/export/runit.rb
|
|
62
64
|
- lib/foreman/export/upstart.rb
|
|
63
65
|
- lib/foreman/export.rb
|
|
66
|
+
- lib/foreman/helpers.rb
|
|
64
67
|
- lib/foreman/process.rb
|
|
65
68
|
- lib/foreman/procfile.rb
|
|
69
|
+
- lib/foreman/procfile_entry.rb
|
|
66
70
|
- lib/foreman/utils.rb
|
|
67
71
|
- lib/foreman/version.rb
|
|
68
72
|
- lib/foreman.rb
|
|
69
|
-
- README.
|
|
73
|
+
- README.md
|
|
70
74
|
- spec/foreman/cli_spec.rb
|
|
71
75
|
- spec/foreman/engine_spec.rb
|
|
76
|
+
- spec/foreman/export/base_spec.rb
|
|
72
77
|
- spec/foreman/export/bluepill_spec.rb
|
|
78
|
+
- spec/foreman/export/inittab_spec.rb
|
|
73
79
|
- spec/foreman/export/runit_spec.rb
|
|
74
80
|
- spec/foreman/export/upstart_spec.rb
|
|
75
81
|
- spec/foreman/export_spec.rb
|
|
82
|
+
- spec/foreman/helpers_spec.rb
|
|
76
83
|
- spec/foreman/process_spec.rb
|
|
77
84
|
- spec/foreman_spec.rb
|
|
85
|
+
- spec/helper_spec.rb
|
|
86
|
+
- spec/resources/bin/utf8
|
|
87
|
+
- spec/resources/export/bluepill/app-concurrency.pill
|
|
78
88
|
- spec/resources/export/bluepill/app.pill
|
|
89
|
+
- spec/resources/export/inittab/inittab.concurrency
|
|
90
|
+
- spec/resources/export/inittab/inittab.default
|
|
79
91
|
- spec/resources/export/runit/app-alpha-1-log-run
|
|
80
92
|
- spec/resources/export/runit/app-alpha-1-run
|
|
81
93
|
- spec/resources/export/runit/app-alpha-2-log-run
|
|
@@ -104,7 +116,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
104
116
|
version: '0'
|
|
105
117
|
segments:
|
|
106
118
|
- 0
|
|
107
|
-
hash:
|
|
119
|
+
hash: 4516446218853691019
|
|
108
120
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
109
121
|
none: false
|
|
110
122
|
requirements:
|
|
@@ -113,10 +125,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
113
125
|
version: '0'
|
|
114
126
|
segments:
|
|
115
127
|
- 0
|
|
116
|
-
hash:
|
|
128
|
+
hash: 4516446218853691019
|
|
117
129
|
requirements: []
|
|
118
130
|
rubyforge_project:
|
|
119
|
-
rubygems_version: 1.8.
|
|
131
|
+
rubygems_version: 1.8.11
|
|
120
132
|
signing_key:
|
|
121
133
|
specification_version: 3
|
|
122
134
|
summary: Process manager for applications with multiple components
|
data/README.markdown
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
# Foreman
|
|
2
|
-
|
|
3
|
-
## Installation
|
|
4
|
-
|
|
5
|
-
* Rubygems
|
|
6
|
-
|
|
7
|
-
gem install foreman
|
|
8
|
-
|
|
9
|
-
* OSX
|
|
10
|
-
|
|
11
|
-
http://assets.foreman.io/foreman/foreman.pkg
|
|
12
|
-
|
|
13
|
-
* Standalone Tarball
|
|
14
|
-
|
|
15
|
-
http://assets.foreman.io/foreman/foreman.tgz
|
|
16
|
-
|
|
17
|
-
## Description
|
|
18
|
-
|
|
19
|
-
http://blog.daviddollar.org/2011/05/06/introducing-foreman.html
|
|
20
|
-
|
|
21
|
-
## Manual
|
|
22
|
-
|
|
23
|
-
See the [man page](http://ddollar.github.com/foreman) for usage.
|
|
24
|
-
|
|
25
|
-
## Authorship
|
|
26
|
-
|
|
27
|
-
Created by David Dollar
|
|
28
|
-
|
|
29
|
-
Patches contributed by:
|
|
30
|
-
|
|
31
|
-
* Adam Wiggins
|
|
32
|
-
* Dan Peterson
|
|
33
|
-
* Hunter Nield
|
|
34
|
-
* Jay Zeschin
|
|
35
|
-
* Keith Rarick
|
|
36
|
-
* Khaja Minhajuddin
|
|
37
|
-
* Matt Haynes
|
|
38
|
-
* Michael van Rooijen
|
|
39
|
-
* Mike Javorski
|
|
40
|
-
* Nathan L Smith
|
|
41
|
-
* Nick Zadrozny
|
|
42
|
-
* Ricardo Chimal, Jr
|
|
43
|
-
* Thom May
|
|
44
|
-
* clifff
|
|
45
|
-
* Greg Reinacker
|
|
46
|
-
|
|
47
|
-
## License
|
|
48
|
-
|
|
49
|
-
MIT
|