Implement `target' recipe keyword
This commit is contained in:
parent
8fd387b41f
commit
a7b2c4abea
11
features/task_target.feature
Normal file
11
features/task_target.feature
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
Feature: `target' task keyword
|
||||||
|
|
||||||
|
Scenario: returns the current target
|
||||||
|
Given a recipe with:
|
||||||
|
"""
|
||||||
|
target 'some_host.example'
|
||||||
|
|
||||||
|
task(:echo_target) { echo target }
|
||||||
|
"""
|
||||||
|
When I execute the recipe
|
||||||
|
Then the output must contain "some_host.example"
|
@ -13,6 +13,9 @@ module Producer
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
extend Forwardable
|
||||||
|
def_delegators :@env, :target
|
||||||
|
|
||||||
define_action :echo, Actions::Echo
|
define_action :echo, Actions::Echo
|
||||||
define_action :sh, Actions::ShellCommand
|
define_action :sh, Actions::ShellCommand
|
||||||
|
|
||||||
|
@ -159,5 +159,13 @@ module Producer::Core
|
|||||||
expect(task.get :some_key).to eq :some_value
|
expect(task.get :some_key).to eq :some_value
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
describe '#target' do
|
||||||
|
before { env.target = :some_target }
|
||||||
|
|
||||||
|
it 'returns current env target' do
|
||||||
|
expect(task.target).to eq :some_target
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user