producer-core 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/features/actions/echo.feature +2 -3
- data/features/actions/sh.feature +2 -2
- data/features/recipes/evaluation.feature +2 -3
- data/features/recipes/source.feature +2 -3
- data/features/recipes/target.feature +2 -3
- data/features/steps/recipe_steps.rb +5 -0
- data/features/tasks/condition.feature +2 -3
- data/features/tasks/evaluation.feature +2 -3
- data/features/tests/has_env.feature +4 -6
- data/lib/producer/core/tests/has_env.rb +1 -1
- data/lib/producer/core/version.rb +1 -1
- data/spec/producer/core/actions/echo_spec.rb +0 -1
- data/spec/producer/core/interpreter_spec.rb +1 -5
- data/spec/producer/core/recipe/dsl_spec.rb +3 -3
- data/spec/producer/core/task/dsl_spec.rb +5 -5
- data/spec/spec_helper.rb +1 -1
- metadata +3 -5
- data/features/support/env.rb +0 -0
data/features/actions/sh.feature
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
@sshd
|
2
|
-
Feature: sh task action
|
2
|
+
Feature: `sh' task action
|
3
3
|
|
4
4
|
Scenario: executes command
|
5
5
|
Given a recipe with:
|
@@ -22,7 +22,7 @@ Feature: sh task action
|
|
22
22
|
sh '\echo from remote'
|
23
23
|
end
|
24
24
|
"""
|
25
|
-
When I execute the recipe
|
25
|
+
When I successfully execute the recipe
|
26
26
|
Then the output must contain "from remote"
|
27
27
|
|
28
28
|
Scenario: aborts on failed command execution
|
@@ -5,6 +5,5 @@ Feature: recipe evaluation
|
|
5
5
|
"""
|
6
6
|
puts 'hello from recipe'
|
7
7
|
"""
|
8
|
-
When I execute the recipe
|
9
|
-
Then the
|
10
|
-
And the output must contain exactly "hello from recipe\n"
|
8
|
+
When I successfully execute the recipe
|
9
|
+
Then the output must contain exactly "hello from recipe\n"
|
@@ -11,6 +11,5 @@ Feature: `source' recipe keyword
|
|
11
11
|
"""
|
12
12
|
puts 'sourced recipe'
|
13
13
|
"""
|
14
|
-
When I execute the recipe
|
15
|
-
Then the
|
16
|
-
And the output must contain "sourced recipe"
|
14
|
+
When I successfully execute the recipe
|
15
|
+
Then the output must contain "sourced recipe"
|
@@ -7,6 +7,5 @@ Feature: `target' recipe keyword
|
|
7
7
|
|
8
8
|
puts env.target
|
9
9
|
"""
|
10
|
-
When I execute the recipe
|
11
|
-
Then the
|
12
|
-
And the output must contain exactly "some_host.example\n"
|
10
|
+
When I successfully execute the recipe
|
11
|
+
Then the output must contain exactly "some_host.example\n"
|
@@ -9,6 +9,5 @@ Feature: `condition' task keyword
|
|
9
9
|
echo 'evaluated'
|
10
10
|
end
|
11
11
|
"""
|
12
|
-
When I execute the recipe
|
13
|
-
Then the
|
14
|
-
And the output must not contain "evaluated"
|
12
|
+
When I successfully execute the recipe
|
13
|
+
Then the output must not contain "evaluated"
|
@@ -7,6 +7,5 @@ Feature: task evaluation
|
|
7
7
|
puts 'hello from recipe'
|
8
8
|
end
|
9
9
|
"""
|
10
|
-
When I execute the recipe
|
11
|
-
Then the
|
12
|
-
And the output must contain exactly "hello from recipe\n"
|
10
|
+
When I successfully execute the recipe
|
11
|
+
Then the output must contain exactly "hello from recipe\n"
|
@@ -12,9 +12,8 @@ Feature: `has_env' condition keyword
|
|
12
12
|
echo 'evaluated'
|
13
13
|
end
|
14
14
|
"""
|
15
|
-
When I execute the recipe
|
16
|
-
Then the
|
17
|
-
And the output must contain "evaluated"
|
15
|
+
When I successfully execute the recipe
|
16
|
+
Then the output must contain "evaluated"
|
18
17
|
|
19
18
|
Scenario: fails when remote environment variable is not defined
|
20
19
|
Given a recipe with:
|
@@ -27,6 +26,5 @@ Feature: `has_env' condition keyword
|
|
27
26
|
echo 'evaluated'
|
28
27
|
end
|
29
28
|
"""
|
30
|
-
When I execute the recipe
|
31
|
-
Then the
|
32
|
-
And the output must not contain "evaluated"
|
29
|
+
When I successfully execute the recipe
|
30
|
+
Then the output must not contain "evaluated"
|
@@ -13,11 +13,7 @@ module Producer::Core
|
|
13
13
|
|
14
14
|
describe '#process_task' do
|
15
15
|
let(:action) { double('action') }
|
16
|
-
let(:task) { double('task').as_null_object }
|
17
|
-
|
18
|
-
before do
|
19
|
-
allow(task).to receive(:actions) { [action] }
|
20
|
-
end
|
16
|
+
let(:task) { double('task', actions: [action]).as_null_object }
|
21
17
|
|
22
18
|
context 'when task condition is met' do
|
23
19
|
it 'applies the actions' do
|
@@ -6,13 +6,13 @@ module Producer::Core
|
|
6
6
|
|
7
7
|
let(:code) { proc { } }
|
8
8
|
let(:env) { double('env').as_null_object }
|
9
|
-
subject(:dsl) { Recipe::DSL.new
|
9
|
+
subject(:dsl) { Recipe::DSL.new(&code) }
|
10
10
|
|
11
11
|
describe '.evaluate' do
|
12
12
|
let(:code) { 'nil' }
|
13
13
|
|
14
14
|
it 'builds a new DSL sandbox with given code' do
|
15
|
-
expect(Recipe::DSL).to receive(:new).
|
15
|
+
expect(Recipe::DSL).to receive(:new).with(code).and_call_original
|
16
16
|
Recipe::DSL.evaluate(code, env)
|
17
17
|
end
|
18
18
|
|
@@ -93,7 +93,7 @@ module Producer::Core
|
|
93
93
|
describe '#source' do
|
94
94
|
let(:filepath) { fixture_path_for 'recipes/throw' }
|
95
95
|
let(:code) { "source '#{filepath}'" }
|
96
|
-
subject(:dsl) { Recipe::DSL.new
|
96
|
+
subject(:dsl) { Recipe::DSL.new(code) }
|
97
97
|
|
98
98
|
it 'sources the recipe given as argument' do
|
99
99
|
expect { dsl.evaluate(env) }.to throw_symbol :recipe_code
|
@@ -4,7 +4,7 @@ module Producer::Core
|
|
4
4
|
describe Task::DSL do
|
5
5
|
let(:block) { proc { } }
|
6
6
|
let(:env) { double('env') }
|
7
|
-
subject(:dsl) { Task::DSL.new
|
7
|
+
subject(:dsl) { Task::DSL.new(&block) }
|
8
8
|
|
9
9
|
%w[echo sh].each do |action|
|
10
10
|
it "has `#{action}' action defined" do
|
@@ -16,7 +16,7 @@ module Producer::Core
|
|
16
16
|
let(:name) { :some_task }
|
17
17
|
|
18
18
|
it 'builds a new DSL sandbox with given code' do
|
19
|
-
expect(Task::DSL).to receive(:new).
|
19
|
+
expect(Task::DSL).to receive(:new).with(&block).and_call_original
|
20
20
|
Task::DSL.evaluate(name, env, &block)
|
21
21
|
end
|
22
22
|
|
@@ -28,10 +28,10 @@ module Producer::Core
|
|
28
28
|
end
|
29
29
|
|
30
30
|
it 'builds a task with its name, actions and condition' do
|
31
|
-
dsl = double(
|
31
|
+
dsl = double(
|
32
|
+
'dsl', actions: [:some_action], condition: :some_condition
|
33
|
+
).as_null_object
|
32
34
|
allow(Task::DSL).to receive(:new) { dsl }
|
33
|
-
allow(dsl).to receive(:actions) { [:some_action] }
|
34
|
-
allow(dsl).to receive(:condition) { :some_condition }
|
35
35
|
expect(Task)
|
36
36
|
.to receive(:new).with(:some_task, [:some_action], :some_condition)
|
37
37
|
Task::DSL.evaluate(name, env, &block)
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: producer-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ssh
|
@@ -114,7 +114,6 @@ files:
|
|
114
114
|
- features/recipes/source.feature
|
115
115
|
- features/recipes/target.feature
|
116
116
|
- features/steps/recipe_steps.rb
|
117
|
-
- features/support/env.rb
|
118
117
|
- features/support/env_aruba.rb
|
119
118
|
- features/support/env_cucumber-doc_string.rb
|
120
119
|
- features/support/ssh.rb
|
@@ -187,7 +186,7 @@ rubyforge_project:
|
|
187
186
|
rubygems_version: 1.8.23
|
188
187
|
signing_key:
|
189
188
|
specification_version: 3
|
190
|
-
summary: producer-core-0.1.
|
189
|
+
summary: producer-core-0.1.2
|
191
190
|
test_files:
|
192
191
|
- features/actions/echo.feature
|
193
192
|
- features/actions/sh.feature
|
@@ -197,7 +196,6 @@ test_files:
|
|
197
196
|
- features/recipes/source.feature
|
198
197
|
- features/recipes/target.feature
|
199
198
|
- features/steps/recipe_steps.rb
|
200
|
-
- features/support/env.rb
|
201
199
|
- features/support/env_aruba.rb
|
202
200
|
- features/support/env_cucumber-doc_string.rb
|
203
201
|
- features/support/ssh.rb
|
data/features/support/env.rb
DELETED
File without changes
|