Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
73 lines (60 sloc) 2.36 KB
<?php
use yii\helpers\Console;
$environments = ['local' => 'Local', 'dev' => 'Development', 'prod' => 'Production'];
return [
'deployiiVersion' => '0.5.0',
'require' => [
'test--recipe',
],
'params' => [
'environments' => $environments,
'username' => 'user',
],
'targets' => [
'default' => [
['target', 'init'],
],
'clean' => [
['rm', '@workspace/index.php'],
['rm', '@workspace/config-local.php'],
['recipe', 'test', 'clean'], // user defined recipe (clean target)
],
'init' => [
['prompt', 'username', 'What is your name?'],
['out', 'Welcome {{username}}!', Console::BOLD],
['out', 'Thank you for trying DeploYii :)', Console::FG_BLUE],
['loadJson', '@buildScripts/stored.json', 'stored',
[ // default values:
'lastRunTimestamp' => 0,
'lastRunDatetime' => 'never',
]
],
['if', '(time() - $params["stored.lastRunTimestamp"] > 30)',
[
['out', 'You last run this task more than 30 seconds ago: {{stored.lastRunDatetime}}!'],
]
],
['exec', 'pwd'],
['confirm', 'doContinue', 'Do you wish to continue?', true],
['if', '($params["doContinue"])',
[
['out', 'The environments array: {{environments}}', Console::FG_CYAN],
['select', 'selectedEnv', 'Select environment', $environments],
['copy', '@buildScripts/index-dist.php', '@workspace/index.php'],
['copy', '@buildScripts/app_config/{{selectedEnv}}.php', '@workspace/config-local.php'],
['test'], // user defined command
['recipe', 'test'], // user defined recipe (default target)
],
[ // else:
['out', '...you can run this script again; for more info see "deployii help run"'],
]
],
['saveAsJson', '@buildScripts/stored.json',
[
'lastRunTimestamp' => time(),
'lastRunDatetime' => date('Y-m-d H:i:s'),
]
],
],
],
];