deployer/recipe/silverstripe.php

77 lines
1.5 KiB
PHP
Raw Normal View History

<?php
2016-11-17 13:26:01 +13:00
namespace Deployer;
require_once __DIR__ . '/common.php';
/**
* Silverstripe configuration
*/
set('shared_assets', function () {
$paths = [
'assets',
'public/assets'
];
foreach ($paths as $path) {
if (test('[ -d {{release_path}}/'.$path.' ]')) {
return $path;
}
}
});
// Silverstripe shared dirs
set('shared_dirs', [
'{{shared_assets}}'
]);
// Silverstripe writable dirs
set('writable_dirs', [
'{{shared_assets}}'
]);
// Silverstripe cli script
set('silverstripe_cli_script', function () {
$paths = [
'framework/cli-script.php',
'vendor/silverstripe/framework/cli-script.php'
];
foreach ($paths as $path) {
if (test('[ -f {{release_path}}/'.$path.' ]')) {
return $path;
}
}
});
/**
* Helper tasks
*/
task('silverstripe:build', function () {
return run('{{bin/php}} {{release_path}}/{{silverstripe_cli_script}} /dev/build');
})->desc('Run /dev/build');
task('silverstripe:buildflush', function () {
return run('{{bin/php}} {{release_path}}/{{silverstripe_cli_script}} /dev/build flush=all');
})->desc('Run /dev/build?flush=all');
/**
* Main task
*/
task('deploy', [
2017-08-12 12:01:27 +03:00
'deploy:info',
'deploy:prepare',
2016-11-05 12:56:53 +07:00
'deploy:lock',
'deploy:release',
'deploy:update_code',
'deploy:vendors',
'deploy:shared',
'deploy:writable',
'silverstripe:buildflush',
'deploy:symlink',
2016-11-05 12:56:53 +07:00
'deploy:unlock',
'cleanup',
])->desc('Deploy your project');
after('deploy', 'success');