producer-core 0.2.7 → 0.2.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/features/cli_usage.feature +1 -1
- data/features/cli_verbose.feature +8 -6
- data/lib/producer/core/cli.rb +2 -1
- data/lib/producer/core/version.rb +1 -1
- data/lib/producer/core/worker.rb +2 -3
- data/spec/producer/core/worker_spec.rb +5 -5
- data/spec/support/test_env_helpers.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e4762ed57bd74293a1017f2ca3410b27642eae90
|
4
|
+
data.tar.gz: ad1cd8fa2f52b877951503497c5207eb8a39c92e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3b81d877cf394644a533673c78f11078446c0f2392178e258e3496eb9a9d29420b017c26efde01250f4f924ecff163a75e9bf92b92f04828c2dba70f3705e6a
|
7
|
+
data.tar.gz: 02368fc9778bded5100a90a28e1e6ec3bebc1941db706581151d829d6042e9e7ff3a1cd1fea343b0aaed73237d7e58f6e173cbff8a4b25a24a418186fd1a14c8
|
data/features/cli_usage.feature
CHANGED
@@ -6,7 +6,7 @@ Feature: CLI verbose option
|
|
6
6
|
task :task_ok do
|
7
7
|
condition { true }
|
8
8
|
|
9
|
-
echo 'some
|
9
|
+
echo 'some message'
|
10
10
|
end
|
11
11
|
|
12
12
|
task :task_ko do
|
@@ -16,16 +16,18 @@ Feature: CLI verbose option
|
|
16
16
|
|
17
17
|
Scenario: prints tasks name
|
18
18
|
When I successfully execute the recipe with option -v
|
19
|
-
Then the output must match
|
19
|
+
Then the output must match /^Task:.+`task_ok'/
|
20
|
+
And the output must match /^Task:.+`task_ko'/
|
20
21
|
|
21
|
-
Scenario:
|
22
|
+
Scenario: appends `applying' or `skipped' after tasks name
|
22
23
|
When I successfully execute the recipe with option -v
|
23
|
-
Then the output must match /task_ok.+
|
24
|
+
Then the output must match /task_ok.+applying...$/
|
25
|
+
And the output must match /task_ko.+skipped$/
|
24
26
|
|
25
27
|
Scenario: prints actions info
|
26
28
|
When I successfully execute the recipe with option -v
|
27
|
-
Then the output must match
|
29
|
+
Then the output must match /^ action: echo/
|
28
30
|
|
29
31
|
Scenario: formats message with our simple logger
|
30
32
|
When I successfully execute the recipe with option -v
|
31
|
-
Then the output must match /\ATask
|
33
|
+
Then the output must match /\ATask:/
|
data/lib/producer/core/cli.rb
CHANGED
@@ -3,7 +3,8 @@ module Producer
|
|
3
3
|
class CLI
|
4
4
|
ArgumentError = Class.new(::ArgumentError)
|
5
5
|
|
6
|
-
|
6
|
+
OPTIONS_USAGE = '[-v] [-n] [-t host.example]'.freeze
|
7
|
+
USAGE = "Usage: #{File.basename $0} #{OPTIONS_USAGE} recipe_file".freeze
|
7
8
|
|
8
9
|
EX_USAGE = 64
|
9
10
|
EX_SOFTWARE = 70
|
data/lib/producer/core/worker.rb
CHANGED
@@ -12,15 +12,14 @@ module Producer
|
|
12
12
|
end
|
13
13
|
|
14
14
|
def process_task(task)
|
15
|
-
env.log "Task: #{task} applying"
|
16
15
|
if task.condition_met?
|
17
|
-
env.log
|
16
|
+
env.log "Task: `#{task}' applying..."
|
18
17
|
task.actions.each do |e|
|
19
18
|
env.log " action: #{e} applying"
|
20
19
|
e.apply unless env.dry_run?
|
21
20
|
end
|
22
21
|
else
|
23
|
-
env.log
|
22
|
+
env.log "Task: `#{task}' skipped"
|
24
23
|
end
|
25
24
|
end
|
26
25
|
end
|
@@ -18,7 +18,7 @@ module Producer::Core
|
|
18
18
|
let(:task) { Task.new(task_name, [action]) }
|
19
19
|
|
20
20
|
it 'logs task info' do
|
21
|
-
expect(env).to receive(:log).with /\ATask:
|
21
|
+
expect(env).to receive(:log).with /\ATask: `#{task_name}'/
|
22
22
|
worker.process_task task
|
23
23
|
end
|
24
24
|
|
@@ -28,8 +28,8 @@ module Producer::Core
|
|
28
28
|
worker.process_task task
|
29
29
|
end
|
30
30
|
|
31
|
-
it 'logs
|
32
|
-
expect(env).to receive(:log).with
|
31
|
+
it 'logs the task as beeing applied' do
|
32
|
+
expect(env).to receive(:log).with /#{task_name}.+applying\.\.\.\z/
|
33
33
|
worker.process_task task
|
34
34
|
end
|
35
35
|
|
@@ -56,8 +56,8 @@ module Producer::Core
|
|
56
56
|
worker.process_task task
|
57
57
|
end
|
58
58
|
|
59
|
-
it 'logs
|
60
|
-
expect(env).to receive(:log).with
|
59
|
+
it 'logs the task as beeing skipped' do
|
60
|
+
expect(env).to receive(:log).with /#{task_name}.+skipped\z/
|
61
61
|
worker.process_task task
|
62
62
|
end
|
63
63
|
end
|
@@ -28,7 +28,7 @@ module TestEnvHelpers
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def build_remote
|
31
|
-
fs = RSpec::Mocks::
|
31
|
+
fs = RSpec::Mocks::Double.new('remote fs')
|
32
32
|
remote = Producer::Core::Testing::MockRemote.new('some_host.test')
|
33
33
|
remote.define_singleton_method(:fs) { fs }
|
34
34
|
remote
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: producer-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thibault Jouan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ssh
|
@@ -251,7 +251,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
251
|
version: '0'
|
252
252
|
requirements: []
|
253
253
|
rubyforge_project:
|
254
|
-
rubygems_version: 2.
|
254
|
+
rubygems_version: 2.4.5
|
255
255
|
signing_key:
|
256
256
|
specification_version: 4
|
257
257
|
summary: Provisioning tool
|