producer-core 0.3.9 → 0.3.10
Sign up to get free protection for your applications and to get access to all the features.
- data/features/recipe_compose_macro.feature +16 -2
- data/features/steps/recipe_steps.rb +4 -0
- data/lib/producer/core/recipe.rb +6 -2
- data/lib/producer/core/version.rb +1 -1
- data/spec/producer/core/recipe_spec.rb +19 -0
- metadata +21 -6
- checksums.yaml +0 -7
@@ -1,15 +1,29 @@
|
|
1
1
|
Feature: `compose_macro' recipe keyword
|
2
2
|
|
3
|
-
|
4
|
-
Given a recipe with:
|
3
|
+
Background:
|
4
|
+
Given a recipe named "composed_macro.rb" with:
|
5
5
|
"""
|
6
6
|
macro :hello do |prefix, *args|
|
7
7
|
echo 'hello %s %s' % [prefix, args.join(', ')]
|
8
8
|
end
|
9
9
|
|
10
10
|
compose_macro :hello_composed, :hello, 'composed'
|
11
|
+
"""
|
11
12
|
|
13
|
+
Scenario: declares a composed macro as recipe keyword
|
14
|
+
Given a recipe with:
|
15
|
+
"""
|
16
|
+
source 'composed_macro'
|
12
17
|
hello_composed :foo, :bar
|
13
18
|
"""
|
14
19
|
When I successfully execute the recipe
|
15
20
|
Then the output must contain "hello composed foo, bar"
|
21
|
+
|
22
|
+
Scenario: declares a composed macro as task keyword
|
23
|
+
Given a recipe with:
|
24
|
+
"""
|
25
|
+
source 'composed_macro'
|
26
|
+
task(:some_task) { hello_composed :foo, :bar }
|
27
|
+
"""
|
28
|
+
When I successfully execute the recipe
|
29
|
+
Then the output must contain "hello composed foo, bar"
|
@@ -2,6 +2,10 @@ Given /^a recipe with:$/ do |recipe_body|
|
|
2
2
|
write_file 'recipe.rb', recipe_body
|
3
3
|
end
|
4
4
|
|
5
|
+
Given /^a recipe named "([^"]+)" with:$/ do |recipe_path, recipe_body|
|
6
|
+
write_file recipe_path, recipe_body
|
7
|
+
end
|
8
|
+
|
5
9
|
When /^I execute the recipe$/ do
|
6
10
|
run_simple 'producer recipe.rb', false
|
7
11
|
end
|
data/lib/producer/core/recipe.rb
CHANGED
@@ -11,7 +11,11 @@ module Producer
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def compose_macro(name, macro, *base_args)
|
14
|
-
|
14
|
+
[self, Task].each do |klass|
|
15
|
+
klass.class_eval do
|
16
|
+
define_method(name) { |*args| send macro, *(base_args + args) }
|
17
|
+
end
|
18
|
+
end
|
15
19
|
end
|
16
20
|
end
|
17
21
|
|
@@ -31,7 +35,7 @@ module Producer
|
|
31
35
|
end
|
32
36
|
|
33
37
|
def task(name, *args, &block)
|
34
|
-
|
38
|
+
Task.evaluate(env, name, *args, &block).tap { |o| @tasks << o }
|
35
39
|
end
|
36
40
|
|
37
41
|
def macro(name, &block)
|
@@ -52,6 +52,10 @@ module Producer::Core
|
|
52
52
|
expect { recipe.task(:some_task) { :some_task_code } }
|
53
53
|
.to change { recipe.tasks.count }.by 1
|
54
54
|
end
|
55
|
+
|
56
|
+
it 'returns the task' do
|
57
|
+
expect(recipe.task(:some_task) { }).to be_a Task
|
58
|
+
end
|
55
59
|
end
|
56
60
|
|
57
61
|
describe '#macro' do
|
@@ -83,6 +87,21 @@ module Producer::Core
|
|
83
87
|
end
|
84
88
|
end
|
85
89
|
|
90
|
+
describe '#compose_macro' do
|
91
|
+
before do
|
92
|
+
recipe.macro(:hello) { }
|
93
|
+
recipe.compose_macro :hello_composed, :some_arg
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'defines the new recipe keyword' do
|
97
|
+
expect(recipe).to respond_to(:hello_composed)
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'defines the new task keyword' do
|
101
|
+
expect(recipe.task(:some_task) { }).to respond_to(:hello_composed)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
86
105
|
describe '#test_macro' do
|
87
106
|
it 'defines the new test' do
|
88
107
|
recipe.test_macro(:some_test) { }
|
metadata
CHANGED
@@ -1,18 +1,20 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: producer-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.10
|
5
|
+
prerelease:
|
5
6
|
platform: ruby
|
6
7
|
authors:
|
7
8
|
- Thibault Jouan
|
8
9
|
autorequire:
|
9
10
|
bindir: bin
|
10
11
|
cert_chain: []
|
11
|
-
date: 2014-
|
12
|
+
date: 2014-10-02 00:00:00.000000000 Z
|
12
13
|
dependencies:
|
13
14
|
- !ruby/object:Gem::Dependency
|
14
15
|
name: net-ssh
|
15
16
|
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
16
18
|
requirements:
|
17
19
|
- - "~>"
|
18
20
|
- !ruby/object:Gem::Version
|
@@ -20,6 +22,7 @@ dependencies:
|
|
20
22
|
type: :runtime
|
21
23
|
prerelease: false
|
22
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
23
26
|
requirements:
|
24
27
|
- - "~>"
|
25
28
|
- !ruby/object:Gem::Version
|
@@ -27,6 +30,7 @@ dependencies:
|
|
27
30
|
- !ruby/object:Gem::Dependency
|
28
31
|
name: net-sftp
|
29
32
|
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
30
34
|
requirements:
|
31
35
|
- - "~>"
|
32
36
|
- !ruby/object:Gem::Version
|
@@ -34,6 +38,7 @@ dependencies:
|
|
34
38
|
type: :runtime
|
35
39
|
prerelease: false
|
36
40
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
37
42
|
requirements:
|
38
43
|
- - "~>"
|
39
44
|
- !ruby/object:Gem::Version
|
@@ -41,6 +46,7 @@ dependencies:
|
|
41
46
|
- !ruby/object:Gem::Dependency
|
42
47
|
name: rspec
|
43
48
|
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
44
50
|
requirements:
|
45
51
|
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
@@ -48,6 +54,7 @@ dependencies:
|
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
51
58
|
requirements:
|
52
59
|
- - "~>"
|
53
60
|
- !ruby/object:Gem::Version
|
@@ -55,6 +62,7 @@ dependencies:
|
|
55
62
|
- !ruby/object:Gem::Dependency
|
56
63
|
name: cucumber
|
57
64
|
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
58
66
|
requirements:
|
59
67
|
- - "~>"
|
60
68
|
- !ruby/object:Gem::Version
|
@@ -62,6 +70,7 @@ dependencies:
|
|
62
70
|
type: :development
|
63
71
|
prerelease: false
|
64
72
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
65
74
|
requirements:
|
66
75
|
- - "~>"
|
67
76
|
- !ruby/object:Gem::Version
|
@@ -69,6 +78,7 @@ dependencies:
|
|
69
78
|
- !ruby/object:Gem::Dependency
|
70
79
|
name: aruba
|
71
80
|
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
72
82
|
requirements:
|
73
83
|
- - "~>"
|
74
84
|
- !ruby/object:Gem::Version
|
@@ -76,6 +86,7 @@ dependencies:
|
|
76
86
|
type: :development
|
77
87
|
prerelease: false
|
78
88
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
79
90
|
requirements:
|
80
91
|
- - "~>"
|
81
92
|
- !ruby/object:Gem::Version
|
@@ -83,6 +94,7 @@ dependencies:
|
|
83
94
|
- !ruby/object:Gem::Dependency
|
84
95
|
name: cucumber-sshd
|
85
96
|
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
86
98
|
requirements:
|
87
99
|
- - "~>"
|
88
100
|
- !ruby/object:Gem::Version
|
@@ -90,6 +102,7 @@ dependencies:
|
|
90
102
|
type: :development
|
91
103
|
prerelease: false
|
92
104
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
93
106
|
requirements:
|
94
107
|
- - "~>"
|
95
108
|
- !ruby/object:Gem::Version
|
@@ -97,6 +110,7 @@ dependencies:
|
|
97
110
|
- !ruby/object:Gem::Dependency
|
98
111
|
name: rake
|
99
112
|
requirement: !ruby/object:Gem::Requirement
|
113
|
+
none: false
|
100
114
|
requirements:
|
101
115
|
- - "~>"
|
102
116
|
- !ruby/object:Gem::Version
|
@@ -104,6 +118,7 @@ dependencies:
|
|
104
118
|
type: :development
|
105
119
|
prerelease: false
|
106
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
107
122
|
requirements:
|
108
123
|
- - "~>"
|
109
124
|
- !ruby/object:Gem::Version
|
@@ -242,26 +257,27 @@ files:
|
|
242
257
|
- spec/support/test_env_helpers.rb
|
243
258
|
homepage: https://rubygems.org/gems/producer-core
|
244
259
|
licenses: []
|
245
|
-
metadata: {}
|
246
260
|
post_install_message:
|
247
261
|
rdoc_options: []
|
248
262
|
require_paths:
|
249
263
|
- lib
|
250
264
|
required_ruby_version: !ruby/object:Gem::Requirement
|
265
|
+
none: false
|
251
266
|
requirements:
|
252
267
|
- - ">="
|
253
268
|
- !ruby/object:Gem::Version
|
254
269
|
version: '0'
|
255
270
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
271
|
+
none: false
|
256
272
|
requirements:
|
257
273
|
- - ">="
|
258
274
|
- !ruby/object:Gem::Version
|
259
275
|
version: '0'
|
260
276
|
requirements: []
|
261
277
|
rubyforge_project:
|
262
|
-
rubygems_version:
|
278
|
+
rubygems_version: 1.8.29
|
263
279
|
signing_key:
|
264
|
-
specification_version:
|
280
|
+
specification_version: 3
|
265
281
|
summary: Provisioning tool
|
266
282
|
test_files:
|
267
283
|
- features/action_echo.feature
|
@@ -347,4 +363,3 @@ test_files:
|
|
347
363
|
- spec/support/shared_action.rb
|
348
364
|
- spec/support/shared_test.rb
|
349
365
|
- spec/support/test_env_helpers.rb
|
350
|
-
has_rdoc:
|
checksums.yaml
DELETED
@@ -1,7 +0,0 @@
|
|
1
|
-
---
|
2
|
-
SHA1:
|
3
|
-
metadata.gz: fba0f36e7a80a2897a17831da23ae1e9a7510ab3
|
4
|
-
data.tar.gz: 53ec1accae1569022521804498ea3eb379e6d6d8
|
5
|
-
SHA512:
|
6
|
-
metadata.gz: 024a23110ed45ca7ed46d78a4ca77e403de5283482aedc549b34f63b3aa14ab38d70f9defbab90e8b8ed935e28e1a116a0307cfc35d4b577dee77934a2364a3a
|
7
|
-
data.tar.gz: 8a5c854adfa2ae0d8bec10abe38995d9aaf7ce312013081a7b4b226c0a58519419457f33be3cd52142864e0be0317fc1e0527f09881a73308cd843a81b5fbd89
|