forked from deployphp/deployer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsilverstripe.php
65 lines (54 loc) · 1.36 KB
/
silverstripe.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
namespace Deployer;
require_once __DIR__ . '/common.php';
add('recipes', ['silverstripe']);
/**
* Silverstripe configuration
*/
set('shared_assets', function () {
if (test('[ -d {{release_or_current_path}}/public ]') || test('[ -d {{deploy_path}}/shared/public ]')) {
return 'public/assets';
}
return 'assets';
});
// 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_or_current_path}}/'.$path.' ]')) {
return $path;
}
}
});
/**
* Helper tasks
*/
desc('Run /dev/build');
task('silverstripe:build', function () {
return run('{{bin/php}} {{release_or_current_path}}/{{silverstripe_cli_script}} /dev/build');
});
desc('Run /dev/build?flush=all');
task('silverstripe:buildflush', function () {
return run('{{bin/php}} {{release_or_current_path}}/{{silverstripe_cli_script}} /dev/build flush=all');
});
/**
* Main task
*/
desc('Deploy your project');
task('deploy', [
'deploy:prepare',
'deploy:vendors',
'silverstripe:buildflush',
'deploy:publish',
]);