foreman 0.45.0-mingw32 → 0.46.0-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/foreman/engine.rb +1 -1
- data/lib/foreman/procfile.rb +24 -4
- data/lib/foreman/procfile_entry.rb +4 -0
- data/lib/foreman/version.rb +1 -1
- data/spec/foreman/engine_spec.rb +0 -6
- data/spec/foreman/procfile_entry_spec.rb +13 -0
- data/spec/foreman/procfile_spec.rb +31 -0
- metadata +8 -6
data/lib/foreman/engine.rb
CHANGED
@@ -21,7 +21,7 @@ class Foreman::Engine
|
|
21
21
|
Foreman::Color.enable($stdout)
|
22
22
|
|
23
23
|
def initialize(procfile, options={})
|
24
|
-
@procfile = Foreman::Procfile.new(procfile)
|
24
|
+
@procfile = Foreman::Procfile.new(procfile) if File.exists?(procfile)
|
25
25
|
@directory = options[:app_root] || File.expand_path(File.dirname(procfile))
|
26
26
|
@options = options.dup
|
27
27
|
@output_mutex = Mutex.new
|
data/lib/foreman/procfile.rb
CHANGED
@@ -13,8 +13,9 @@ class Foreman::Procfile
|
|
13
13
|
|
14
14
|
attr_reader :entries
|
15
15
|
|
16
|
-
def initialize(filename)
|
17
|
-
@entries =
|
16
|
+
def initialize(filename=nil)
|
17
|
+
@entries = []
|
18
|
+
load(filename) if filename
|
18
19
|
end
|
19
20
|
|
20
21
|
def [](name)
|
@@ -25,12 +26,31 @@ class Foreman::Procfile
|
|
25
26
|
entries.map(&:name)
|
26
27
|
end
|
27
28
|
|
28
|
-
|
29
|
+
def load(filename)
|
30
|
+
entries.clear
|
31
|
+
parse_procfile(filename)
|
32
|
+
end
|
33
|
+
|
34
|
+
def write(filename)
|
35
|
+
File.open(filename, 'w') do |io|
|
36
|
+
entries.each do |ent|
|
37
|
+
io.puts(ent)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
def <<(entry)
|
43
|
+
entries << Foreman::ProcfileEntry.new(*entry)
|
44
|
+
self
|
45
|
+
end
|
46
|
+
|
47
|
+
|
48
|
+
protected
|
29
49
|
|
30
50
|
def parse_procfile(filename)
|
31
51
|
File.read(filename).split("\n").map do |line|
|
32
52
|
if line =~ /^([A-Za-z0-9_]+):\s*(.+)$/
|
33
|
-
|
53
|
+
self << [ $1, $2 ]
|
34
54
|
end
|
35
55
|
end.compact
|
36
56
|
end
|
data/lib/foreman/version.rb
CHANGED
data/spec/foreman/engine_spec.rb
CHANGED
@@ -12,12 +12,6 @@ describe "Foreman::Engine", :fakefs do
|
|
12
12
|
end
|
13
13
|
|
14
14
|
describe "initialize" do
|
15
|
-
describe "without an existing Procfile" do
|
16
|
-
it "raises an error" do
|
17
|
-
lambda { subject }.should raise_error
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
15
|
describe "with a Procfile" do
|
22
16
|
before { write_procfile }
|
23
17
|
|
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'foreman/procfile_entry'
|
3
|
+
require 'pathname'
|
4
|
+
require 'tmpdir'
|
5
|
+
|
6
|
+
describe Foreman::ProcfileEntry do
|
7
|
+
subject { described_class.new('alpha', './alpha') }
|
8
|
+
|
9
|
+
it "stringifies as a Procfile line" do
|
10
|
+
subject.to_s.should == 'alpha: ./alpha'
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'foreman/procfile'
|
3
|
+
require 'pathname'
|
4
|
+
require 'tmpdir'
|
5
|
+
|
6
|
+
describe Foreman::Procfile do
|
7
|
+
subject { described_class.new }
|
8
|
+
|
9
|
+
let(:testdir) { Pathname(Dir.tmpdir) }
|
10
|
+
let(:procfile) { testdir + 'Procfile' }
|
11
|
+
|
12
|
+
it "can have a process appended to it" do
|
13
|
+
subject << ['alpha', './alpha']
|
14
|
+
subject['alpha'].should be_a(Foreman::ProcfileEntry)
|
15
|
+
end
|
16
|
+
|
17
|
+
it "can write itself out to a file" do
|
18
|
+
subject << ['alpha', './alpha']
|
19
|
+
subject.write(procfile)
|
20
|
+
procfile.read.should == "alpha: ./alpha\n"
|
21
|
+
end
|
22
|
+
|
23
|
+
it "can re-read entries from a file" do
|
24
|
+
procfile.open('w') { |io| io.puts "gamma: ./radiation", "theta: ./rate" }
|
25
|
+
subject << ['alpha', './alpha']
|
26
|
+
subject.load(procfile)
|
27
|
+
subject.process_names.should have(2).members
|
28
|
+
subject.process_names.should include('gamma', 'theta')
|
29
|
+
end
|
30
|
+
|
31
|
+
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.46.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-05-02 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: thor
|
16
|
-
requirement: &
|
16
|
+
requirement: &70240372039860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: 0.13.6
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70240372039860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: win32console
|
27
|
-
requirement: &
|
27
|
+
requirement: &70240372039200 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ~>
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: 1.3.0
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70240372039200
|
36
36
|
description: Process manager for applications with multiple components
|
37
37
|
email: ddollar@gmail.com
|
38
38
|
executables:
|
@@ -86,6 +86,8 @@ files:
|
|
86
86
|
- spec/foreman/export_spec.rb
|
87
87
|
- spec/foreman/helpers_spec.rb
|
88
88
|
- spec/foreman/process_spec.rb
|
89
|
+
- spec/foreman/procfile_entry_spec.rb
|
90
|
+
- spec/foreman/procfile_spec.rb
|
89
91
|
- spec/foreman_spec.rb
|
90
92
|
- spec/helper_spec.rb
|
91
93
|
- spec/resources/bin/utf8
|