producer-core 0.3.5 → 0.3.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 673005f434315f9a24f55976aaac79c42a2a58df
4
- data.tar.gz: 9856330c2e39915260cfe7186ec684c6e363262c
3
+ metadata.gz: 7eb43f3bef9d4d62b0d7b1b74a2c8e71f58410e2
4
+ data.tar.gz: ec652f99e4273ba9f603bcbc8e602abbbf583437
5
5
  SHA512:
6
- metadata.gz: ae738019692289d5bcd5b76269051dfdc4faca9e4fe342308f93ab5cc901d9399b0129e9b51a48110406393886918c62a346dc71c1c2fb9b8f2a62cc1482a796
7
- data.tar.gz: 328fc0a31d1e60aebe86747e9042510e4788dfbe98f14a0f0f7172002cfc80f21c8f9c8d05f9abffb49a60dc23a3da2ebe0999de394c8d11ab9776090b7be366
6
+ metadata.gz: 8e6d71a688e80c7a9e806c67de3f917dd51fb322af9dfb8f45379980579894423c149812e2f653dba3d11f460dce998ed9422c035c069d535d3857f133be081c
7
+ data.tar.gz: 3ea4adbcebff73ab03680bee2f3c579df399738c6a5c638fdbd08755262bb219efd6fcdfc2be81d5f2f577b044bd9fdbf5ac0c3035db02de1e75959497537588
@@ -0,0 +1,15 @@
1
+ Feature: `target' condition keyword
2
+
3
+ Scenario: returns the current target
4
+ Given a recipe with:
5
+ """
6
+ target 'some_host.example'
7
+
8
+ task :test_target do
9
+ condition { target == 'some_host.example' }
10
+
11
+ echo 'OK'
12
+ end
13
+ """
14
+ When I execute the recipe
15
+ Then the output must contain "OK"
@@ -0,0 +1,11 @@
1
+ Feature: `target' task keyword
2
+
3
+ Scenario: returns the current target
4
+ Given a recipe with:
5
+ """
6
+ target 'some_host.example'
7
+
8
+ task(:echo_target) { echo target }
9
+ """
10
+ When I execute the recipe
11
+ Then the output must contain "some_host.example"
@@ -30,7 +30,7 @@ module Producer
30
30
  end
31
31
 
32
32
  extend Forwardable
33
- def_delegators :@env, :get
33
+ def_delegators :@env, :get, :target
34
34
 
35
35
  define_test :`, Tests::ShellCommandStatus
36
36
  define_test :sh, Tests::ShellCommandStatus
@@ -13,6 +13,9 @@ module Producer
13
13
  end
14
14
  end
15
15
 
16
+ extend Forwardable
17
+ def_delegators :@env, :target
18
+
16
19
  define_action :echo, Actions::Echo
17
20
  define_action :sh, Actions::ShellCommand
18
21
 
@@ -1,5 +1,5 @@
1
1
  module Producer
2
2
  module Core
3
- VERSION = '0.3.5'.freeze
3
+ VERSION = '0.3.6'.freeze
4
4
  end
5
5
  end
@@ -182,5 +182,16 @@ module Producer::Core
182
182
  described_class.evaluate(env, []) { get :some_key }
183
183
  end
184
184
  end
185
+
186
+ describe '#target' do
187
+ let(:env) { Env.new }
188
+
189
+ before { env.target = :some_target }
190
+
191
+ it 'returns current env target' do
192
+ condition = described_class.evaluate(env, []) { target == :some_target }
193
+ expect(condition).to be_met
194
+ end
195
+ end
185
196
  end
186
197
  end
@@ -159,5 +159,13 @@ module Producer::Core
159
159
  expect(task.get :some_key).to eq :some_value
160
160
  end
161
161
  end
162
+
163
+ describe '#target' do
164
+ before { env.target = :some_target }
165
+
166
+ it 'returns current env target' do
167
+ expect(task.target).to eq :some_target
168
+ end
169
+ end
162
170
  end
163
171
  end
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.3.5
4
+ version: 0.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thibault Jouan
@@ -133,6 +133,7 @@ files:
133
133
  - features/cli_usage.feature
134
134
  - features/cli_verbose.feature
135
135
  - features/condition_negated_test.feature
136
+ - features/condition_target.feature
136
137
  - features/recipe_compose_macro.feature
137
138
  - features/recipe_macro.feature
138
139
  - features/recipe_source.feature
@@ -153,6 +154,7 @@ files:
153
154
  - features/task_ask.feature
154
155
  - features/task_condition.feature
155
156
  - features/task_nested_tasks.feature
157
+ - features/task_target.feature
156
158
  - features/test_dir.feature
157
159
  - features/test_env.feature
158
160
  - features/test_executable.feature
@@ -269,6 +271,7 @@ test_files:
269
271
  - features/cli_usage.feature
270
272
  - features/cli_verbose.feature
271
273
  - features/condition_negated_test.feature
274
+ - features/condition_target.feature
272
275
  - features/recipe_compose_macro.feature
273
276
  - features/recipe_macro.feature
274
277
  - features/recipe_source.feature
@@ -289,6 +292,7 @@ test_files:
289
292
  - features/task_ask.feature
290
293
  - features/task_condition.feature
291
294
  - features/task_nested_tasks.feature
295
+ - features/task_target.feature
292
296
  - features/test_dir.feature
293
297
  - features/test_env.feature
294
298
  - features/test_executable.feature