foreman 0.37.0-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +39 -0
- data/bin/foreman +7 -0
- data/bin/runner +36 -0
- data/data/example/Procfile +2 -0
- data/data/example/Procfile.without_colon +2 -0
- data/data/example/error +7 -0
- data/data/example/log/neverdie.log +4 -0
- data/data/example/ticker +14 -0
- data/data/export/bluepill/master.pill.erb +27 -0
- data/data/export/runit/log_run.erb +7 -0
- data/data/export/runit/run.erb +3 -0
- data/data/export/upstart/master.conf.erb +8 -0
- data/data/export/upstart/process.conf.erb +5 -0
- data/data/export/upstart/process_master.conf.erb +2 -0
- data/lib/foreman.rb +25 -0
- data/lib/foreman/cli.rb +98 -0
- data/lib/foreman/distribution.rb +9 -0
- data/lib/foreman/engine.rb +234 -0
- data/lib/foreman/export.rb +32 -0
- data/lib/foreman/export/base.rb +51 -0
- data/lib/foreman/export/bluepill.rb +26 -0
- data/lib/foreman/export/inittab.rb +36 -0
- data/lib/foreman/export/runit.rb +59 -0
- data/lib/foreman/export/upstart.rb +41 -0
- data/lib/foreman/helpers.rb +45 -0
- data/lib/foreman/process.rb +96 -0
- data/lib/foreman/procfile.rb +38 -0
- data/lib/foreman/procfile_entry.rb +22 -0
- data/lib/foreman/utils.rb +18 -0
- data/lib/foreman/version.rb +5 -0
- data/man/foreman.1 +222 -0
- data/spec/foreman/cli_spec.rb +163 -0
- data/spec/foreman/engine_spec.rb +86 -0
- data/spec/foreman/export/base_spec.rb +22 -0
- data/spec/foreman/export/bluepill_spec.rb +36 -0
- data/spec/foreman/export/inittab_spec.rb +40 -0
- data/spec/foreman/export/runit_spec.rb +41 -0
- data/spec/foreman/export/upstart_spec.rb +87 -0
- data/spec/foreman/export_spec.rb +24 -0
- data/spec/foreman/helpers_spec.rb +26 -0
- data/spec/foreman/process_spec.rb +131 -0
- data/spec/foreman_spec.rb +34 -0
- data/spec/helper_spec.rb +18 -0
- data/spec/resources/export/bluepill/app-concurrency.pill +47 -0
- data/spec/resources/export/bluepill/app.pill +44 -0
- data/spec/resources/export/inittab/inittab.concurrency +4 -0
- data/spec/resources/export/inittab/inittab.default +4 -0
- data/spec/resources/export/runit/app-alpha-1-log-run +7 -0
- data/spec/resources/export/runit/app-alpha-1-run +3 -0
- data/spec/resources/export/runit/app-alpha-2-log-run +7 -0
- data/spec/resources/export/runit/app-alpha-2-run +3 -0
- data/spec/resources/export/runit/app-bravo-1-log-run +7 -0
- data/spec/resources/export/runit/app-bravo-1-run +3 -0
- data/spec/resources/export/upstart/app-alpha-1.conf +5 -0
- data/spec/resources/export/upstart/app-alpha-2.conf +5 -0
- data/spec/resources/export/upstart/app-alpha.conf +2 -0
- data/spec/resources/export/upstart/app-bravo-1.conf +5 -0
- data/spec/resources/export/upstart/app-bravo.conf +2 -0
- data/spec/resources/export/upstart/app.conf +8 -0
- data/spec/spec_helper.rb +98 -0
- metadata +138 -0
data/spec/helper_spec.rb
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe "spec helpers" do
|
4
|
+
describe "#preserving_env" do
|
5
|
+
after { ENV.delete "FOO" }
|
6
|
+
|
7
|
+
it "should remove added environment vars" do
|
8
|
+
preserving_env { ENV["FOO"] = "baz" }
|
9
|
+
ENV["FOO"].should == nil
|
10
|
+
end
|
11
|
+
|
12
|
+
it "should reset modified environment vars" do
|
13
|
+
ENV["FOO"] = "bar"
|
14
|
+
preserving_env { ENV["FOO"] = "baz"}
|
15
|
+
ENV["FOO"].should == "bar"
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -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
|
@@ -0,0 +1,44 @@
|
|
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
|
+
app.process("bravo-1") do |process|
|
27
|
+
process.start_command = "./bravo"
|
28
|
+
|
29
|
+
process.working_dir = "/tmp/app"
|
30
|
+
process.daemonize = true
|
31
|
+
process.environment = {"PORT" => "5100"}
|
32
|
+
process.stop_signals = [:quit, 30.seconds, :term, 5.seconds, :kill]
|
33
|
+
|
34
|
+
process.stdout = process.stderr = "/var/log/app/app-bravo-1.log"
|
35
|
+
|
36
|
+
process.monitor_children do |children|
|
37
|
+
children.stop_command "kill -QUIT {{PID}}"
|
38
|
+
end
|
39
|
+
|
40
|
+
process.group = "app-bravo"
|
41
|
+
end
|
42
|
+
|
43
|
+
|
44
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,98 @@
|
|
1
|
+
require "rubygems"
|
2
|
+
|
3
|
+
require "simplecov"
|
4
|
+
SimpleCov.start do
|
5
|
+
add_filter "/spec/"
|
6
|
+
end
|
7
|
+
|
8
|
+
require "rspec"
|
9
|
+
require "fakefs/safe"
|
10
|
+
require "fakefs/spec_helpers"
|
11
|
+
|
12
|
+
$:.unshift File.expand_path("../../lib", __FILE__)
|
13
|
+
|
14
|
+
def mock_export_error(message)
|
15
|
+
lambda { yield }.should raise_error(Foreman::Export::Exception, message)
|
16
|
+
end
|
17
|
+
|
18
|
+
def mock_error(subject, message)
|
19
|
+
mock_exit do
|
20
|
+
mock(subject).puts("ERROR: #{message}")
|
21
|
+
yield
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
def foreman(args)
|
26
|
+
Foreman::CLI.start(args.split(" "))
|
27
|
+
end
|
28
|
+
|
29
|
+
def mock_exit(&block)
|
30
|
+
block.should raise_error(SystemExit)
|
31
|
+
end
|
32
|
+
|
33
|
+
def write_foreman_config(app)
|
34
|
+
File.open("/etc/foreman/#{app}.conf", "w") do |file|
|
35
|
+
file.puts %{#{app}_processes="alpha bravo"}
|
36
|
+
file.puts %{#{app}_alpha="1"}
|
37
|
+
file.puts %{#{app}_bravo="2"}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def write_procfile(procfile="Procfile", alpha_env="")
|
42
|
+
File.open(procfile, "w") do |file|
|
43
|
+
file.puts "alpha: ./alpha" + " #{alpha_env}".rstrip
|
44
|
+
file.puts "\n"
|
45
|
+
file.puts "bravo:\t./bravo"
|
46
|
+
end
|
47
|
+
File.expand_path(procfile)
|
48
|
+
end
|
49
|
+
|
50
|
+
def write_env(env=".env", options={"FOO"=>"bar"})
|
51
|
+
File.open(env, "w") do |file|
|
52
|
+
options.each do |key, val|
|
53
|
+
file.puts "#{key}=#{val}"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def load_export_templates_into_fakefs(type)
|
59
|
+
FakeFS.deactivate!
|
60
|
+
files = Dir[File.expand_path("../../data/export/#{type}/**", __FILE__)].inject({}) do |hash, file|
|
61
|
+
hash.update(file => File.read(file))
|
62
|
+
end
|
63
|
+
FakeFS.activate!
|
64
|
+
files.each do |filename, contents|
|
65
|
+
File.open(filename, "w") do |f|
|
66
|
+
f.puts contents
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
def example_export_file(filename)
|
72
|
+
FakeFS.deactivate!
|
73
|
+
data = File.read(File.expand_path("../resources/export/#{filename}", __FILE__))
|
74
|
+
FakeFS.activate!
|
75
|
+
data
|
76
|
+
end
|
77
|
+
|
78
|
+
def preserving_env
|
79
|
+
old_env = ENV.to_hash
|
80
|
+
begin
|
81
|
+
yield
|
82
|
+
ensure
|
83
|
+
ENV.clear
|
84
|
+
ENV.update(old_env)
|
85
|
+
end
|
86
|
+
end
|
87
|
+
|
88
|
+
def normalize_space(s)
|
89
|
+
s.gsub(/\n[\n\s]*/, "\n")
|
90
|
+
end
|
91
|
+
|
92
|
+
RSpec.configure do |config|
|
93
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
94
|
+
config.color_enabled = true
|
95
|
+
config.order = 'rand'
|
96
|
+
config.include FakeFS::SpecHelpers, :fakefs
|
97
|
+
config.mock_with :rr
|
98
|
+
end
|
metadata
ADDED
@@ -0,0 +1,138 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: foreman
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.37.0
|
5
|
+
prerelease:
|
6
|
+
platform: mingw32
|
7
|
+
authors:
|
8
|
+
- David Dollar
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-29 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: term-ansicolor
|
16
|
+
requirement: &70190243737480 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 1.0.7
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70190243737480
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: thor
|
27
|
+
requirement: &70190243736540 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.13.6
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70190243736540
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: win32console
|
38
|
+
requirement: &70190243735620 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.3.0
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70190243735620
|
47
|
+
description: Process manager for applications with multiple components
|
48
|
+
email: ddollar@gmail.com
|
49
|
+
executables:
|
50
|
+
- foreman
|
51
|
+
extensions: []
|
52
|
+
extra_rdoc_files: []
|
53
|
+
files:
|
54
|
+
- bin/foreman
|
55
|
+
- bin/runner
|
56
|
+
- data/example/error
|
57
|
+
- data/example/log/neverdie.log
|
58
|
+
- data/example/Procfile
|
59
|
+
- data/example/Procfile.without_colon
|
60
|
+
- data/example/ticker
|
61
|
+
- data/export/bluepill/master.pill.erb
|
62
|
+
- data/export/runit/log_run.erb
|
63
|
+
- data/export/runit/run.erb
|
64
|
+
- data/export/upstart/master.conf.erb
|
65
|
+
- data/export/upstart/process.conf.erb
|
66
|
+
- data/export/upstart/process_master.conf.erb
|
67
|
+
- lib/foreman/cli.rb
|
68
|
+
- lib/foreman/distribution.rb
|
69
|
+
- lib/foreman/engine.rb
|
70
|
+
- lib/foreman/export/base.rb
|
71
|
+
- lib/foreman/export/bluepill.rb
|
72
|
+
- lib/foreman/export/inittab.rb
|
73
|
+
- lib/foreman/export/runit.rb
|
74
|
+
- lib/foreman/export/upstart.rb
|
75
|
+
- lib/foreman/export.rb
|
76
|
+
- lib/foreman/helpers.rb
|
77
|
+
- lib/foreman/process.rb
|
78
|
+
- lib/foreman/procfile.rb
|
79
|
+
- lib/foreman/procfile_entry.rb
|
80
|
+
- lib/foreman/utils.rb
|
81
|
+
- lib/foreman/version.rb
|
82
|
+
- lib/foreman.rb
|
83
|
+
- README.md
|
84
|
+
- spec/foreman/cli_spec.rb
|
85
|
+
- spec/foreman/engine_spec.rb
|
86
|
+
- spec/foreman/export/base_spec.rb
|
87
|
+
- spec/foreman/export/bluepill_spec.rb
|
88
|
+
- spec/foreman/export/inittab_spec.rb
|
89
|
+
- spec/foreman/export/runit_spec.rb
|
90
|
+
- spec/foreman/export/upstart_spec.rb
|
91
|
+
- spec/foreman/export_spec.rb
|
92
|
+
- spec/foreman/helpers_spec.rb
|
93
|
+
- spec/foreman/process_spec.rb
|
94
|
+
- spec/foreman_spec.rb
|
95
|
+
- spec/helper_spec.rb
|
96
|
+
- spec/resources/export/bluepill/app-concurrency.pill
|
97
|
+
- spec/resources/export/bluepill/app.pill
|
98
|
+
- spec/resources/export/inittab/inittab.concurrency
|
99
|
+
- spec/resources/export/inittab/inittab.default
|
100
|
+
- spec/resources/export/runit/app-alpha-1-log-run
|
101
|
+
- spec/resources/export/runit/app-alpha-1-run
|
102
|
+
- spec/resources/export/runit/app-alpha-2-log-run
|
103
|
+
- spec/resources/export/runit/app-alpha-2-run
|
104
|
+
- spec/resources/export/runit/app-bravo-1-log-run
|
105
|
+
- spec/resources/export/runit/app-bravo-1-run
|
106
|
+
- spec/resources/export/upstart/app-alpha-1.conf
|
107
|
+
- spec/resources/export/upstart/app-alpha-2.conf
|
108
|
+
- spec/resources/export/upstart/app-alpha.conf
|
109
|
+
- spec/resources/export/upstart/app-bravo-1.conf
|
110
|
+
- spec/resources/export/upstart/app-bravo.conf
|
111
|
+
- spec/resources/export/upstart/app.conf
|
112
|
+
- spec/spec_helper.rb
|
113
|
+
- man/foreman.1
|
114
|
+
homepage: http://github.com/ddollar/foreman
|
115
|
+
licenses: []
|
116
|
+
post_install_message:
|
117
|
+
rdoc_options: []
|
118
|
+
require_paths:
|
119
|
+
- lib
|
120
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ! '>='
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
requirements: []
|
133
|
+
rubyforge_project:
|
134
|
+
rubygems_version: 1.8.15
|
135
|
+
signing_key:
|
136
|
+
specification_version: 3
|
137
|
+
summary: Process manager for applications with multiple components
|
138
|
+
test_files: []
|