foreman 0.67.0-mingw32 → 0.69.0-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +14 -0
- data/data/export/upstart/process.conf.erb +1 -1
- data/lib/foreman.rb +0 -2
- data/lib/foreman/cli.rb +0 -9
- data/lib/foreman/engine.rb +28 -22
- data/lib/foreman/process.rb +2 -51
- data/lib/foreman/version.rb +1 -1
- data/man/foreman.1 +1 -1
- data/spec/foreman/cli_spec.rb +18 -26
- data/spec/foreman/engine_spec.rb +13 -13
- data/spec/foreman/export/base_spec.rb +1 -1
- data/spec/foreman/export/bluepill_spec.rb +2 -2
- data/spec/foreman/export/daemon_spec.rb +12 -12
- data/spec/foreman/export/inittab_spec.rb +2 -2
- data/spec/foreman/export/launchd_spec.rb +3 -3
- data/spec/foreman/export/runit_spec.rb +12 -12
- data/spec/foreman/export/supervisord_spec.rb +2 -2
- data/spec/foreman/export/systemd_spec.rb +13 -13
- data/spec/foreman/export/upstart_spec.rb +14 -14
- data/spec/foreman/helpers_spec.rb +4 -4
- data/spec/foreman/process_spec.rb +29 -6
- data/spec/foreman/procfile_spec.rb +9 -9
- data/spec/foreman_spec.rb +1 -1
- data/spec/helper_spec.rb +3 -2
- data/spec/resources/export/bluepill/app-concurrency.pill +2 -2
- data/spec/resources/export/bluepill/app.pill +4 -4
- data/spec/resources/export/runit/app-alpha-1/run +1 -0
- data/spec/resources/export/runit/app-alpha-2/run +1 -0
- data/spec/resources/export/runit/app-bravo-1/run +1 -0
- data/spec/resources/export/systemd/{app-alpha-1.service → concurrency/app-alpha-1.service} +0 -3
- data/spec/resources/export/systemd/{app-alpha-2.service → concurrency/app-alpha-2.service} +0 -3
- data/spec/resources/export/systemd/concurrency/app-alpha.target +3 -0
- data/spec/resources/export/systemd/concurrency/app.target +6 -0
- data/spec/resources/export/systemd/standard/app-alpha-1.service +14 -0
- data/spec/resources/export/systemd/standard/app-alpha.target +3 -0
- data/spec/resources/export/systemd/{app-bravo-1.service → standard/app-bravo-1.service} +0 -3
- data/spec/resources/export/systemd/standard/app-bravo.target +3 -0
- data/spec/resources/export/systemd/standard/app.target +6 -0
- data/spec/resources/export/upstart/app-alpha-1.conf +7 -1
- data/spec/resources/export/upstart/app-alpha-2.conf +7 -1
- data/spec/resources/export/upstart/app-bravo-1.conf +7 -1
- data/spec/resources/export/upstart/app.conf +1 -11
- data/spec/spec_helper.rb +8 -23
- metadata +16 -21
- data/spec/resources/export/systemd/app-alpha.target +0 -5
- data/spec/resources/export/systemd/app-bravo.target +0 -5
- data/spec/resources/export/systemd/app.target +0 -1
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1e3f0ce389e868ec19b47ed04ec78d0405d538bb
|
4
|
+
data.tar.gz: 2e0ee712ccc6f8e4ab192518f3ba4ddb840b22b2
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 6a34b4e3e790bd5f8d609dceb55f66c50fc295a5ab1ad3589f31be7be53471c21c44e7c99c09134b2745597ccfa9bb411bccbb6bbf390282c8177e81b47bca07
|
7
|
+
data.tar.gz: 680a8057e0d6c6ef0aa9f2e90f2c7f55bf3b1b551255ea355c08aafed72ae7f8279d4c39c32880adca244f20c54f7a538ff2a2dd168851bd99187e882d5736d9
|
data/README.md
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
# Foreman
|
2
2
|
|
3
|
+
[![Build Status](https://travis-ci.org/ddollar/foreman.svg?branch=master)](https://travis-ci.org/ddollar/foreman)
|
4
|
+
[![Code Climate](https://codeclimate.com/github/ddollar/foreman.png)](https://codeclimate.com/github/ddollar/foreman)
|
5
|
+
|
3
6
|
Manage Procfile-based applications
|
4
7
|
|
5
8
|
<table>
|
@@ -17,10 +20,21 @@ Manage Procfile-based applications
|
|
17
20
|
</tr>
|
18
21
|
</table>
|
19
22
|
|
23
|
+
## Installation
|
24
|
+
|
25
|
+
$ gem install foreman
|
26
|
+
|
27
|
+
Ruby users should take care *not* to install foreman in their project's `Gemfile`.
|
28
|
+
|
20
29
|
## Getting Started
|
21
30
|
|
22
31
|
* http://blog.daviddollar.org/2011/05/06/introducing-foreman.html
|
23
32
|
|
33
|
+
## Supported Ruby versions
|
34
|
+
|
35
|
+
* 1.9.3
|
36
|
+
* 2.0.0
|
37
|
+
|
24
38
|
## Documentation
|
25
39
|
|
26
40
|
* [man page](http://ddollar.github.com/foreman)
|
data/lib/foreman.rb
CHANGED
data/lib/foreman/cli.rb
CHANGED
@@ -34,7 +34,6 @@ class Foreman::CLI < Thor
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def start(process=nil)
|
37
|
-
require_posix_spawn_for_ruby_18!
|
38
37
|
check_procfile!
|
39
38
|
load_environment!
|
40
39
|
engine.load_procfile(procfile)
|
@@ -139,14 +138,6 @@ private ######################################################################
|
|
139
138
|
end
|
140
139
|
end
|
141
140
|
|
142
|
-
def require_posix_spawn_for_ruby_18!
|
143
|
-
begin
|
144
|
-
Kernel.require 'posix/spawn' # Use Kernel explicitly so we can mock the require call in the spec
|
145
|
-
rescue LoadError
|
146
|
-
error "foreman requires gem `posix-spawn` on Ruby #{RUBY_VERSION}. Please `gem install posix-spawn`."
|
147
|
-
end if Foreman.ruby_18?
|
148
|
-
end
|
149
|
-
|
150
141
|
def procfile
|
151
142
|
case
|
152
143
|
when options[:procfile] then options[:procfile]
|
data/lib/foreman/engine.rb
CHANGED
@@ -367,33 +367,39 @@ private
|
|
367
367
|
end
|
368
368
|
end
|
369
369
|
|
370
|
+
def read_self_pipe
|
371
|
+
@selfpipe[:reader].read_nonblock(11)
|
372
|
+
rescue Errno::EAGAIN, Errno::EINTR => err
|
373
|
+
# ignore
|
374
|
+
end
|
375
|
+
|
376
|
+
def handle_signals
|
377
|
+
while sig = Thread.main[:signal_queue].shift
|
378
|
+
self.handle_signal(sig)
|
379
|
+
end
|
380
|
+
end
|
381
|
+
|
382
|
+
def handle_io(readers)
|
383
|
+
readers.each do |reader|
|
384
|
+
next if reader == @selfpipe[:reader]
|
385
|
+
|
386
|
+
if reader.eof?
|
387
|
+
@readers.delete_if { |key, value| value == reader }
|
388
|
+
else
|
389
|
+
data = reader.gets
|
390
|
+
output_with_mutex name_for(@readers.invert[reader]), data
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
|
370
395
|
def watch_for_output
|
371
396
|
Thread.new do
|
372
397
|
begin
|
373
398
|
loop do
|
374
399
|
io = IO.select([@selfpipe[:reader]] + @readers.values, nil, nil, 30)
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
rescue Errno::EAGAIN, Errno::EINTR => err
|
379
|
-
# ignore
|
380
|
-
end
|
381
|
-
|
382
|
-
# Look for any signals that arrived and handle them
|
383
|
-
while sig = Thread.main[:signal_queue].shift
|
384
|
-
self.handle_signal(sig)
|
385
|
-
end
|
386
|
-
|
387
|
-
(io.nil? ? [] : io.first).each do |reader|
|
388
|
-
next if reader == @selfpipe[:reader]
|
389
|
-
|
390
|
-
if reader.eof?
|
391
|
-
@readers.delete_if { |key, value| value == reader }
|
392
|
-
else
|
393
|
-
data = reader.gets
|
394
|
-
output_with_mutex name_for(@readers.invert[reader]), data
|
395
|
-
end
|
396
|
-
end
|
400
|
+
read_self_pipe
|
401
|
+
handle_signals
|
402
|
+
handle_io(io ? io.first : [])
|
397
403
|
end
|
398
404
|
rescue Exception => ex
|
399
405
|
puts ex.message
|
data/lib/foreman/process.rb
CHANGED
@@ -50,17 +50,8 @@ class Foreman::Process
|
|
50
50
|
output = options[:output] || $stdout
|
51
51
|
runner = "#{Foreman.runner}".shellescape
|
52
52
|
|
53
|
-
|
54
|
-
|
55
|
-
Process.spawn env, expanded_command(env), :out => output, :err => output
|
56
|
-
end
|
57
|
-
elsif Foreman.jruby_18? || Foreman.ruby_18?
|
58
|
-
require "posix/spawn"
|
59
|
-
wrapped_command = "#{runner} -d '#{cwd.shellescape}' -p -- #{expanded_command(env)}"
|
60
|
-
POSIX::Spawn.spawn(*spawn_args(env, wrapped_command.shellsplit, {:out => output, :err => output}))
|
61
|
-
else
|
62
|
-
wrapped_command = "exec #{runner} -d '#{cwd.shellescape}' -p -- #{command}"
|
63
|
-
Process.spawn env, wrapped_command, :out => output, :err => output
|
53
|
+
Dir.chdir(cwd) do
|
54
|
+
Process.spawn env, expanded_command(env), :out => output, :err => output
|
64
55
|
end
|
65
56
|
end
|
66
57
|
|
@@ -78,36 +69,6 @@ class Foreman::Process
|
|
78
69
|
Kernel.exec expanded_command(env)
|
79
70
|
end
|
80
71
|
|
81
|
-
# Send a signal to this +Process+
|
82
|
-
#
|
83
|
-
# @param [String] signal The signal to send
|
84
|
-
#
|
85
|
-
def kill(signal)
|
86
|
-
if Foreman.windows?
|
87
|
-
pid && Process.kill(signal, pid)
|
88
|
-
else
|
89
|
-
pid && Process.kill("-#{signal}", pid)
|
90
|
-
end
|
91
|
-
rescue Errno::ESRCH
|
92
|
-
false
|
93
|
-
end
|
94
|
-
|
95
|
-
# Test whether or not this +Process+ is still running
|
96
|
-
#
|
97
|
-
# @returns [Boolean]
|
98
|
-
#
|
99
|
-
def alive?
|
100
|
-
kill(0)
|
101
|
-
end
|
102
|
-
|
103
|
-
# Test whether or not this +Process+ has terminated
|
104
|
-
#
|
105
|
-
# @returns [Boolean]
|
106
|
-
#
|
107
|
-
def dead?
|
108
|
-
!alive?
|
109
|
-
end
|
110
|
-
|
111
72
|
# Returns the working directory for this +Process+
|
112
73
|
#
|
113
74
|
# @returns [String]
|
@@ -116,14 +77,4 @@ class Foreman::Process
|
|
116
77
|
File.expand_path(@options[:cwd] || ".")
|
117
78
|
end
|
118
79
|
|
119
|
-
private
|
120
|
-
|
121
|
-
def spawn_args(env, argv, options)
|
122
|
-
args = []
|
123
|
-
args << env
|
124
|
-
args += argv
|
125
|
-
args << options
|
126
|
-
args
|
127
|
-
end
|
128
|
-
|
129
80
|
end
|
data/lib/foreman/version.rb
CHANGED
data/man/foreman.1
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
.\" generated with Ronn/v0.7.3
|
2
2
|
.\" http://github.com/rtomayko/ronn/tree/0.7.3
|
3
3
|
.
|
4
|
-
.TH "FOREMAN" "1" "
|
4
|
+
.TH "FOREMAN" "1" "May 2014" "Foreman 0.69.0" "Foreman Manual"
|
5
5
|
.
|
6
6
|
.SH "NAME"
|
7
7
|
\fBforeman\fR \- manage Procfile\-based applications
|
data/spec/foreman/cli_spec.rb
CHANGED
@@ -8,12 +8,12 @@ describe "Foreman::CLI", :fakefs do
|
|
8
8
|
before { File.open(".foreman", "w") { |f| f.puts "formation: alpha=2" } }
|
9
9
|
|
10
10
|
it "provides default options" do
|
11
|
-
subject.send(:options)["formation"].
|
11
|
+
expect(subject.send(:options)["formation"]).to eq("alpha=2")
|
12
12
|
end
|
13
13
|
|
14
14
|
it "is overridden by options at the cli" do
|
15
15
|
subject = Foreman::CLI.new([], :formation => "alpha=3")
|
16
|
-
subject.send(:options)["formation"].
|
16
|
+
expect(subject.send(:options)["formation"]).to eq("alpha=3")
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
@@ -31,24 +31,24 @@ describe "Foreman::CLI", :fakefs do
|
|
31
31
|
it "can run a single command" do
|
32
32
|
without_fakefs do
|
33
33
|
output = foreman("start env -f #{resource_path("Procfile")}")
|
34
|
-
output.
|
35
|
-
output.
|
34
|
+
expect(output).to match(/env.1/)
|
35
|
+
expect(output).not_to match(/test.1/)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
39
39
|
it "can run all commands" do
|
40
40
|
without_fakefs do
|
41
41
|
output = foreman("start -f #{resource_path("Procfile")} -e #{resource_path(".env")}")
|
42
|
-
output.
|
43
|
-
output.
|
44
|
-
output.
|
42
|
+
expect(output).to match(/echo.1 \| echoing/)
|
43
|
+
expect(output).to match(/env.1 \| bar/)
|
44
|
+
expect(output).to match(/test.1 \| testing/)
|
45
45
|
end
|
46
46
|
end
|
47
47
|
|
48
48
|
it "sets PS variable with the process name" do
|
49
49
|
without_fakefs do
|
50
50
|
output = foreman("start -f #{resource_path("Procfile")}")
|
51
|
-
output.
|
51
|
+
expect(output).to match(/ps.1 \| PS env var is ps.1/)
|
52
52
|
end
|
53
53
|
end
|
54
54
|
end
|
@@ -57,55 +57,47 @@ describe "Foreman::CLI", :fakefs do
|
|
57
57
|
describe "check" do
|
58
58
|
it "with a valid Procfile displays the jobs" do
|
59
59
|
write_procfile
|
60
|
-
foreman("check").
|
60
|
+
expect(foreman("check")).to eq("valid procfile detected (alpha, bravo, foo_bar, foo-bar)\n")
|
61
61
|
end
|
62
62
|
|
63
63
|
it "with a blank Procfile displays an error" do
|
64
64
|
FileUtils.touch "Procfile"
|
65
|
-
foreman("check").
|
65
|
+
expect(foreman("check")).to eq("ERROR: no processes defined\n")
|
66
66
|
end
|
67
67
|
|
68
68
|
it "without a Procfile displays an error" do
|
69
69
|
FileUtils.rm_f "Procfile"
|
70
|
-
foreman("check").
|
70
|
+
expect(foreman("check")).to eq("ERROR: Procfile does not exist.\n")
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
74
|
describe "run" do
|
75
75
|
it "can run a command" do
|
76
|
-
forked_foreman("run echo 1").
|
76
|
+
expect(forked_foreman("run echo 1")).to eq("1\n")
|
77
77
|
end
|
78
78
|
|
79
79
|
it "includes the environment" do
|
80
|
-
forked_foreman("run #{resource_path("bin/env FOO")} -e #{resource_path(".env")}").
|
80
|
+
expect(forked_foreman("run #{resource_path("bin/env FOO")} -e #{resource_path(".env")}")).to eq("bar\n")
|
81
81
|
end
|
82
82
|
|
83
83
|
it "can run a command from the Procfile" do
|
84
|
-
forked_foreman("run -f #{resource_path("Procfile")} test").
|
84
|
+
expect(forked_foreman("run -f #{resource_path("Procfile")} test")).to eq("testing\n")
|
85
85
|
end
|
86
86
|
|
87
87
|
it "exits with the same exit code as the command" do
|
88
|
-
fork_and_get_exitstatus("run echo 1").
|
89
|
-
fork_and_get_exitstatus("run date 'invalid_date'").
|
88
|
+
expect(fork_and_get_exitstatus("run echo 1")).to eq(0)
|
89
|
+
expect(fork_and_get_exitstatus("run date 'invalid_date'")).to eq(1)
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
93
|
describe "version" do
|
94
94
|
it "displays gem version" do
|
95
|
-
foreman("version").chomp.
|
95
|
+
expect(foreman("version").chomp).to eq(Foreman::VERSION)
|
96
96
|
end
|
97
97
|
|
98
98
|
it "displays gem version on shortcut command" do
|
99
|
-
foreman("-v").chomp.
|
99
|
+
expect(foreman("-v").chomp).to eq(Foreman::VERSION)
|
100
100
|
end
|
101
101
|
end
|
102
102
|
|
103
|
-
describe "when posix-spawn is not present on ruby 1.8" do
|
104
|
-
it "should fail with an error" do
|
105
|
-
mock(Kernel).require('posix/spawn') { raise LoadError }
|
106
|
-
output = foreman("start -f #{resource_path("Procfile")}")
|
107
|
-
output.should == "ERROR: foreman requires gem `posix-spawn` on Ruby #{RUBY_VERSION}. Please `gem install posix-spawn`.\n"
|
108
|
-
end
|
109
|
-
end if running_ruby_18?
|
110
|
-
|
111
103
|
end
|
data/spec/foreman/engine_spec.rb
CHANGED
@@ -27,8 +27,8 @@ describe "Foreman::Engine", :fakefs do
|
|
27
27
|
before { write_procfile }
|
28
28
|
|
29
29
|
it "reads the processes" do
|
30
|
-
subject.process("alpha").command.
|
31
|
-
subject.process("bravo").command.
|
30
|
+
expect(subject.process("alpha").command).to eq("./alpha")
|
31
|
+
expect(subject.process("bravo").command).to eq("./bravo")
|
32
32
|
end
|
33
33
|
end
|
34
34
|
end
|
@@ -56,7 +56,7 @@ describe "Foreman::Engine", :fakefs do
|
|
56
56
|
it "has the directory default relative to the Procfile" do
|
57
57
|
write_procfile "/some/app/Procfile"
|
58
58
|
engine = Foreman::Engine.new.load_procfile("/some/app/Procfile")
|
59
|
-
engine.root.
|
59
|
+
expect(engine.root).to eq("/some/app")
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -64,7 +64,7 @@ describe "Foreman::Engine", :fakefs do
|
|
64
64
|
it "should read env files" do
|
65
65
|
File.open("/tmp/env", "w") { |f| f.puts("FOO=baz") }
|
66
66
|
subject.load_env("/tmp/env")
|
67
|
-
subject.env["FOO"].
|
67
|
+
expect(subject.env["FOO"]).to eq("baz")
|
68
68
|
end
|
69
69
|
|
70
70
|
it "should read more than one if specified" do
|
@@ -72,8 +72,8 @@ describe "Foreman::Engine", :fakefs do
|
|
72
72
|
File.open("/tmp/env2", "w") { |f| f.puts("BAZ=qux") }
|
73
73
|
subject.load_env "/tmp/env1"
|
74
74
|
subject.load_env "/tmp/env2"
|
75
|
-
subject.env["FOO"].
|
76
|
-
subject.env["BAZ"].
|
75
|
+
expect(subject.env["FOO"]).to eq("bar")
|
76
|
+
expect(subject.env["BAZ"]).to eq("qux")
|
77
77
|
end
|
78
78
|
|
79
79
|
it "should handle quoted values" do
|
@@ -84,10 +84,10 @@ describe "Foreman::Engine", :fakefs do
|
|
84
84
|
f.puts 'OTHER="escaped\"quote"'
|
85
85
|
end
|
86
86
|
subject.load_env "/tmp/env"
|
87
|
-
subject.env["FOO"].
|
88
|
-
subject.env["BAZ"].
|
89
|
-
subject.env["FRED"].
|
90
|
-
subject.env["OTHER"].
|
87
|
+
expect(subject.env["FOO"]).to eq("bar")
|
88
|
+
expect(subject.env["BAZ"]).to eq("qux")
|
89
|
+
expect(subject.env["FRED"]).to eq("barney")
|
90
|
+
expect(subject.env["OTHER"]).to eq('escaped"quote')
|
91
91
|
end
|
92
92
|
|
93
93
|
it "should handle multiline strings" do
|
@@ -95,17 +95,17 @@ describe "Foreman::Engine", :fakefs do
|
|
95
95
|
f.puts 'FOO="bar\nbaz"'
|
96
96
|
end
|
97
97
|
subject.load_env "/tmp/env"
|
98
|
-
subject.env["FOO"].
|
98
|
+
expect(subject.env["FOO"]).to eq("bar\nbaz")
|
99
99
|
end
|
100
100
|
|
101
101
|
it "should fail if specified and doesnt exist" do
|
102
|
-
|
102
|
+
expect { subject.load_env "/tmp/env" }.to raise_error(Errno::ENOENT)
|
103
103
|
end
|
104
104
|
|
105
105
|
it "should set port from .env if specified" do
|
106
106
|
File.open("/tmp/env", "w") { |f| f.puts("PORT=9000") }
|
107
107
|
subject.load_env "/tmp/env"
|
108
|
-
subject.send(:base_port).
|
108
|
+
expect(subject.send(:base_port)).to eq(9000)
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
@@ -14,6 +14,6 @@ describe "Foreman::Export::Base", :fakefs do
|
|
14
14
|
end
|
15
15
|
|
16
16
|
it "raises errors as a Foreman::Export::Exception" do
|
17
|
-
|
17
|
+
expect { subject.send(:error, "foo") }.to raise_error(Foreman::Export::Exception, "foo")
|
18
18
|
end
|
19
19
|
end
|
@@ -15,7 +15,7 @@ describe Foreman::Export::Bluepill, :fakefs do
|
|
15
15
|
|
16
16
|
it "exports to the filesystem" do
|
17
17
|
bluepill.export
|
18
|
-
normalize_space(File.read("/tmp/init/app.pill")).
|
18
|
+
expect(normalize_space(File.read("/tmp/init/app.pill"))).to eq(normalize_space(example_export_file("bluepill/app.pill")))
|
19
19
|
end
|
20
20
|
|
21
21
|
it "cleans up if exporting into an existing dir" do
|
@@ -30,7 +30,7 @@ describe Foreman::Export::Bluepill, :fakefs do
|
|
30
30
|
|
31
31
|
it "exports to the filesystem with concurrency" do
|
32
32
|
bluepill.export
|
33
|
-
normalize_space(File.read("/tmp/init/app.pill")).
|
33
|
+
expect(normalize_space(File.read("/tmp/init/app.pill"))).to eq(normalize_space(example_export_file("bluepill/app-concurrency.pill")))
|
34
34
|
end
|
35
35
|
end
|
36
36
|
|
@@ -16,11 +16,11 @@ describe Foreman::Export::Daemon, :fakefs do
|
|
16
16
|
it "exports to the filesystem" do
|
17
17
|
daemon.export
|
18
18
|
|
19
|
-
File.read("/tmp/init/app.conf").
|
20
|
-
File.read("/tmp/init/app-alpha.conf").
|
21
|
-
File.read("/tmp/init/app-alpha-1.conf").
|
22
|
-
File.read("/tmp/init/app-bravo.conf").
|
23
|
-
File.read("/tmp/init/app-bravo-1.conf").
|
19
|
+
expect(File.read("/tmp/init/app.conf")).to eq(example_export_file("daemon/app.conf"))
|
20
|
+
expect(File.read("/tmp/init/app-alpha.conf")).to eq(example_export_file("daemon/app-alpha.conf"))
|
21
|
+
expect(File.read("/tmp/init/app-alpha-1.conf")).to eq(example_export_file("daemon/app-alpha-1.conf"))
|
22
|
+
expect(File.read("/tmp/init/app-bravo.conf")).to eq(example_export_file("daemon/app-bravo.conf"))
|
23
|
+
expect(File.read("/tmp/init/app-bravo-1.conf")).to eq(example_export_file("daemon/app-bravo-1.conf"))
|
24
24
|
end
|
25
25
|
|
26
26
|
it "cleans up if exporting into an existing dir" do
|
@@ -56,11 +56,11 @@ describe Foreman::Export::Daemon, :fakefs do
|
|
56
56
|
it "exports to the filesystem with concurrency" do
|
57
57
|
daemon.export
|
58
58
|
|
59
|
-
File.read("/tmp/init/app.conf").
|
60
|
-
File.read("/tmp/init/app-alpha.conf").
|
61
|
-
File.read("/tmp/init/app-alpha-1.conf").
|
62
|
-
File.read("/tmp/init/app-alpha-2.conf").
|
63
|
-
File.exists?("/tmp/init/app-bravo-1.conf").
|
59
|
+
expect(File.read("/tmp/init/app.conf")).to eq(example_export_file("daemon/app.conf"))
|
60
|
+
expect(File.read("/tmp/init/app-alpha.conf")).to eq(example_export_file("daemon/app-alpha.conf"))
|
61
|
+
expect(File.read("/tmp/init/app-alpha-1.conf")).to eq(example_export_file("daemon/app-alpha-1.conf"))
|
62
|
+
expect(File.read("/tmp/init/app-alpha-2.conf")).to eq(example_export_file("daemon/app-alpha-2.conf"))
|
63
|
+
expect(File.exists?("/tmp/init/app-bravo-1.conf")).to eq(false)
|
64
64
|
end
|
65
65
|
end
|
66
66
|
|
@@ -75,7 +75,7 @@ describe Foreman::Export::Daemon, :fakefs do
|
|
75
75
|
|
76
76
|
it "can export with alternate template files" do
|
77
77
|
daemon.export
|
78
|
-
File.read("/tmp/init/app.conf").
|
78
|
+
expect(File.read("/tmp/init/app.conf")).to eq("alternate_template\n")
|
79
79
|
end
|
80
80
|
end
|
81
81
|
|
@@ -90,7 +90,7 @@ describe Foreman::Export::Daemon, :fakefs do
|
|
90
90
|
|
91
91
|
it "can export with alternate template files" do
|
92
92
|
daemon.export
|
93
|
-
File.read("/tmp/init/app.conf").
|
93
|
+
expect(File.read("/tmp/init/app.conf")).to eq("default_alternate_template\n")
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|