foreman 0.37.0.pre2-java → 0.37.0.pre3-java
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/foreman.rb +8 -1
- data/lib/foreman/engine.rb +2 -2
- data/lib/foreman/process.rb +6 -7
- data/lib/foreman/version.rb +1 -1
- data/spec/foreman/engine_spec.rb +4 -4
- metadata +110 -117
data/lib/foreman.rb
CHANGED
@@ -14,5 +14,12 @@ module Foreman
|
|
14
14
|
File.expand_path("../../bin/runner", __FILE__)
|
15
15
|
end
|
16
16
|
|
17
|
-
|
17
|
+
def self.jruby?
|
18
|
+
defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
|
19
|
+
end
|
18
20
|
|
21
|
+
def self.windows?
|
22
|
+
defined?(RUBY_PLATFORM) and RUBY_PLATFORM =~ /(win|w)32$/
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
data/lib/foreman/engine.rb
CHANGED
@@ -2,7 +2,6 @@ require "foreman"
|
|
2
2
|
require "foreman/process"
|
3
3
|
require "foreman/procfile"
|
4
4
|
require "foreman/utils"
|
5
|
-
require "pty"
|
6
5
|
require "tempfile"
|
7
6
|
require "timeout"
|
8
7
|
require "term/ansicolor"
|
@@ -89,6 +88,7 @@ private ######################################################################
|
|
89
88
|
|
90
89
|
def watch_for_output
|
91
90
|
Thread.new do
|
91
|
+
require "win32console" if Foreman.windows?
|
92
92
|
begin
|
93
93
|
loop do
|
94
94
|
rs, ws = IO.select(readers.values, [], [], 1)
|
@@ -156,7 +156,7 @@ private ######################################################################
|
|
156
156
|
end
|
157
157
|
|
158
158
|
def termtitle(title)
|
159
|
-
printf("\033]0;#{title}\007")
|
159
|
+
printf("\033]0;#{title}\007") unless Foreman.windows?
|
160
160
|
end
|
161
161
|
|
162
162
|
def running_processes
|
data/lib/foreman/process.rb
CHANGED
@@ -26,27 +26,26 @@ class Foreman::Process
|
|
26
26
|
|
27
27
|
private
|
28
28
|
|
29
|
-
def jruby?
|
30
|
-
defined?(RUBY_PLATFORM) and RUBY_PLATFORM == "java"
|
31
|
-
end
|
32
|
-
|
33
29
|
def fork_with_io(command, basedir)
|
34
30
|
reader, writer = IO.pipe
|
35
31
|
command = replace_command_env(command)
|
36
|
-
pid = if
|
32
|
+
pid = if Foreman.windows?
|
33
|
+
Dir.chdir(basedir) do
|
34
|
+
Process.spawn command, :out => writer, :err => writer
|
35
|
+
end
|
36
|
+
elsif Foreman.jruby?
|
37
37
|
require "posix/spawn"
|
38
38
|
POSIX::Spawn.spawn(Foreman.runner, "-d", basedir, command, {
|
39
39
|
:out => writer, :err => writer
|
40
40
|
})
|
41
41
|
else
|
42
42
|
fork do
|
43
|
-
trap("INT", "IGNORE")
|
44
43
|
writer.sync = true
|
45
44
|
$stdout.reopen writer
|
46
45
|
$stderr.reopen writer
|
47
46
|
reader.close
|
48
47
|
exec Foreman.runner, "-d", basedir, command
|
49
|
-
|
48
|
+
end
|
50
49
|
end
|
51
50
|
[ reader, pid ]
|
52
51
|
end
|
data/lib/foreman/version.rb
CHANGED
data/spec/foreman/engine_spec.rb
CHANGED
@@ -24,8 +24,8 @@ describe "Foreman::Engine" do
|
|
24
24
|
describe "start" do
|
25
25
|
it "forks the processes" do
|
26
26
|
write_procfile
|
27
|
-
mock.instance_of(Foreman::Process).run_process("./alpha", is_a(IO))
|
28
|
-
mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO))
|
27
|
+
mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./alpha", is_a(IO))
|
28
|
+
mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./bravo", is_a(IO))
|
29
29
|
mock(subject).watch_for_output
|
30
30
|
mock(subject).watch_for_termination
|
31
31
|
subject.start
|
@@ -34,8 +34,8 @@ describe "Foreman::Engine" do
|
|
34
34
|
it "handles concurrency" do
|
35
35
|
write_procfile
|
36
36
|
engine = Foreman::Engine.new("Procfile",:concurrency => "alpha=2")
|
37
|
-
mock.instance_of(Foreman::Process).run_process("./alpha", is_a(IO)).twice
|
38
|
-
mock.instance_of(Foreman::Process).run_process("./bravo", is_a(IO)).never
|
37
|
+
mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./alpha", is_a(IO)).twice
|
38
|
+
mock.instance_of(Foreman::Process).run_process(Dir.pwd, "./bravo", is_a(IO)).never
|
39
39
|
mock(engine).watch_for_output
|
40
40
|
mock(engine).watch_for_termination
|
41
41
|
engine.start
|
metadata
CHANGED
@@ -1,139 +1,132 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: foreman
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.37.0.pre3
|
4
5
|
prerelease: 7
|
5
|
-
version: 0.37.0.pre2
|
6
6
|
platform: java
|
7
|
-
authors:
|
8
|
-
|
7
|
+
authors:
|
8
|
+
- David Dollar
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
version_requirements: *id003
|
12
|
+
date: 2012-01-23 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: term-ansicolor
|
16
|
+
requirement: &70363556093680 !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: *70363556093680
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: thor
|
27
|
+
requirement: &70363556092880 !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: *70363556092880
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: posix-spawn
|
38
|
+
requirement: &70363556092120 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 0.3.6
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70363556092120
|
48
47
|
description: Process manager for applications with multiple components
|
49
48
|
email: ddollar@gmail.com
|
50
|
-
executables:
|
51
|
-
|
49
|
+
executables:
|
50
|
+
- foreman
|
52
51
|
extensions: []
|
53
|
-
|
54
52
|
extra_rdoc_files: []
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
- man/foreman.1
|
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/process.rb
|
77
|
+
- lib/foreman/procfile.rb
|
78
|
+
- lib/foreman/procfile_entry.rb
|
79
|
+
- lib/foreman/utils.rb
|
80
|
+
- lib/foreman/version.rb
|
81
|
+
- lib/foreman.rb
|
82
|
+
- README.markdown
|
83
|
+
- spec/foreman/cli_spec.rb
|
84
|
+
- spec/foreman/engine_spec.rb
|
85
|
+
- spec/foreman/export/bluepill_spec.rb
|
86
|
+
- spec/foreman/export/runit_spec.rb
|
87
|
+
- spec/foreman/export/upstart_spec.rb
|
88
|
+
- spec/foreman/export_spec.rb
|
89
|
+
- spec/foreman/process_spec.rb
|
90
|
+
- spec/foreman_spec.rb
|
91
|
+
- spec/helper_spec.rb
|
92
|
+
- spec/resources/export/bluepill/app-concurrency.pill
|
93
|
+
- spec/resources/export/bluepill/app.pill
|
94
|
+
- spec/resources/export/runit/app-alpha-1-log-run
|
95
|
+
- spec/resources/export/runit/app-alpha-1-run
|
96
|
+
- spec/resources/export/runit/app-alpha-2-log-run
|
97
|
+
- spec/resources/export/runit/app-alpha-2-run
|
98
|
+
- spec/resources/export/runit/app-bravo-1-log-run
|
99
|
+
- spec/resources/export/runit/app-bravo-1-run
|
100
|
+
- spec/resources/export/upstart/app-alpha-1.conf
|
101
|
+
- spec/resources/export/upstart/app-alpha-2.conf
|
102
|
+
- spec/resources/export/upstart/app-alpha.conf
|
103
|
+
- spec/resources/export/upstart/app-bravo-1.conf
|
104
|
+
- spec/resources/export/upstart/app-bravo.conf
|
105
|
+
- spec/resources/export/upstart/app.conf
|
106
|
+
- spec/spec_helper.rb
|
107
|
+
- man/foreman.1
|
111
108
|
homepage: http://github.com/ddollar/foreman
|
112
109
|
licenses: []
|
113
|
-
|
114
110
|
post_install_message:
|
115
111
|
rdoc_options: []
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
112
|
+
require_paths:
|
113
|
+
- lib
|
114
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
120
115
|
none: false
|
121
|
-
requirements:
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ! '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
126
121
|
none: false
|
127
|
-
requirements:
|
128
|
-
|
129
|
-
|
130
|
-
|
122
|
+
requirements:
|
123
|
+
- - ! '>'
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: 1.3.1
|
131
126
|
requirements: []
|
132
|
-
|
133
127
|
rubyforge_project:
|
134
|
-
rubygems_version: 1.8.
|
128
|
+
rubygems_version: 1.8.10
|
135
129
|
signing_key:
|
136
130
|
specification_version: 3
|
137
131
|
summary: Process manager for applications with multiple components
|
138
132
|
test_files: []
|
139
|
-
|