foreman 0.37.2-mingw32 → 0.38.0-mingw32
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/lib/foreman/cli.rb +3 -2
- data/lib/foreman/engine.rb +2 -1
- data/lib/foreman/version.rb +1 -1
- data/spec/foreman/cli_spec.rb +11 -0
- data/spec/foreman/engine_spec.rb +8 -1
- metadata +9 -9
data/lib/foreman/cli.rb
CHANGED
@@ -10,7 +10,7 @@ class Foreman::CLI < Thor
|
|
10
10
|
|
11
11
|
class_option :procfile, :type => :string, :aliases => "-f", :desc => "Default: Procfile"
|
12
12
|
|
13
|
-
desc "start", "Start the application"
|
13
|
+
desc "start [PROCESS]", "Start the application (or a specific PROCESS)"
|
14
14
|
|
15
15
|
class_option :procfile, :type => :string, :aliases => "-f", :desc => "Default: Procfile"
|
16
16
|
class_option :app_root, :type => :string, :aliases => "-d", :desc => "Default: Procfile directory"
|
@@ -27,8 +27,9 @@ class Foreman::CLI < Thor
|
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
30
|
-
def start
|
30
|
+
def start(process=nil)
|
31
31
|
check_procfile!
|
32
|
+
engine.options[:concurrency] = "#{process}=1" if process
|
32
33
|
engine.start
|
33
34
|
end
|
34
35
|
|
data/lib/foreman/engine.rb
CHANGED
@@ -23,7 +23,7 @@ class Foreman::Engine
|
|
23
23
|
def initialize(procfile, options={})
|
24
24
|
@procfile = Foreman::Procfile.new(procfile)
|
25
25
|
@directory = options[:app_root] || File.expand_path(File.dirname(procfile))
|
26
|
-
@options = options
|
26
|
+
@options = options.dup
|
27
27
|
@environment = read_environment_files(options[:env])
|
28
28
|
@output_mutex = Mutex.new
|
29
29
|
end
|
@@ -99,6 +99,7 @@ private ######################################################################
|
|
99
99
|
(rs || []).each do |r|
|
100
100
|
data = r.gets
|
101
101
|
next unless data
|
102
|
+
data.force_encoding("BINARY") if data.respond_to?(:force_encoding)
|
102
103
|
ps, message = data.split(",", 2)
|
103
104
|
color = colors[ps.split(".").first]
|
104
105
|
info message, ps, color
|
data/lib/foreman/version.rb
CHANGED
data/spec/foreman/cli_spec.rb
CHANGED
@@ -3,6 +3,8 @@ require "foreman/cli"
|
|
3
3
|
|
4
4
|
describe "Foreman::CLI", :fakefs do
|
5
5
|
subject { Foreman::CLI.new }
|
6
|
+
let(:engine) { subject.send(:engine) }
|
7
|
+
let(:entries) { engine.procfile.entries.inject({}) { |h,e| h.update(e.name => e) } }
|
6
8
|
|
7
9
|
describe "start" do
|
8
10
|
describe "with a non-existent Procfile" do
|
@@ -22,6 +24,15 @@ describe "Foreman::CLI", :fakefs do
|
|
22
24
|
mock.instance_of(Foreman::Engine).start
|
23
25
|
subject.start
|
24
26
|
end
|
27
|
+
|
28
|
+
it "can run a single process" do
|
29
|
+
dont_allow(subject).error
|
30
|
+
stub(engine).watch_for_output
|
31
|
+
stub(engine).watch_for_termination
|
32
|
+
mock(entries["alpha"]).spawn(1, is_a(IO), engine.directory, {}, 5000) { [] }
|
33
|
+
mock(entries["bravo"]).spawn(0, is_a(IO), engine.directory, {}, 5100) { [] }
|
34
|
+
subject.start("alpha")
|
35
|
+
end
|
25
36
|
end
|
26
37
|
end
|
27
38
|
|
data/spec/foreman/engine_spec.rb
CHANGED
@@ -4,6 +4,13 @@ require "foreman/engine"
|
|
4
4
|
describe "Foreman::Engine", :fakefs do
|
5
5
|
subject { Foreman::Engine.new("Procfile", {}) }
|
6
6
|
|
7
|
+
before do
|
8
|
+
any_instance_of(Foreman::Engine) do |engine|
|
9
|
+
stub(engine).proctitle
|
10
|
+
stub(engine).termtitle
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
7
14
|
describe "initialize" do
|
8
15
|
describe "without an existing Procfile" do
|
9
16
|
it "raises an error" do
|
@@ -95,7 +102,7 @@ describe "Foreman::Engine", :fakefs do
|
|
95
102
|
stub(subject).watch_for_output
|
96
103
|
stub(subject).watch_for_termination
|
97
104
|
subject.start
|
98
|
-
|
105
|
+
Process.waitall
|
99
106
|
mock(subject).info(/started with pid \d+/, "utf8.1", anything)
|
100
107
|
mock(subject).info("\xff\x03\n", "utf8.1", anything)
|
101
108
|
subject.send(:poll_readers)
|
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.38.0
|
5
5
|
prerelease:
|
6
6
|
platform: mingw32
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-02-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: term-ansicolor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70273676709320 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 1.0.7
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70273676709320
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: thor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70273676708440 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: 0.13.6
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70273676708440
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: win32console
|
38
|
-
requirement: &
|
38
|
+
requirement: &70273676705680 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ~>
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: 1.3.0
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70273676705680
|
47
47
|
description: Process manager for applications with multiple components
|
48
48
|
email: ddollar@gmail.com
|
49
49
|
executables:
|
@@ -133,7 +133,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
133
133
|
version: '0'
|
134
134
|
requirements: []
|
135
135
|
rubyforge_project:
|
136
|
-
rubygems_version: 1.8.
|
136
|
+
rubygems_version: 1.8.11
|
137
137
|
signing_key:
|
138
138
|
specification_version: 3
|
139
139
|
summary: Process manager for applications with multiple components
|