File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -239,6 +239,35 @@ task my_task
239239
240240Since ` current_date ` is overridden, the callback is never executed.
241241
242+ ::: note
243+ If you need to create a new configuration option based on the overridden one, use dynamic configuration syntax:
244+
245+ ``` php
246+
247+ set('dir_name', 'test');
248+
249+ // calling get during recipe initialization will give you the original value defined above
250+ set('uses_original_dir_name', '/path/to/' . get('dir_name'));
251+
252+ // use dynamic configuration syntax if you need to get a value passed via -o option
253+ set('uses_overridden_dir_name', function () {
254+ return '/path/to/' . get('dir_name');
255+ });
256+
257+ task('my_task', function () {
258+ writeln('Path: {{uses_original_dir_name}}');
259+ writeln('Path: {{uses_overridden_dir_name}}');
260+ });
261+ ```
262+
263+ ``` sh
264+ $ dep my_task deployer.org -v -o dir_name=" prod"
265+ task my_task
266+ [deployer.org] Path: /path/to/test
267+ [deployer.org] Path: /path/to/prod
268+ ```
269+ :::
270+
242271---
243272
244273By now, you should have a solid understanding of Deployer’s basics, from defining tasks and hosts to working with
You can’t perform that action at this time.
0 commit comments