Skip to content

Commit b5ce26d

Browse files
added check for existing releases (#1)
1 parent 4ec92ba commit b5ce26d

File tree

2 files changed

+25
-7
lines changed

2 files changed

+25
-7
lines changed

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,8 @@
77
"files": [
88
"autoload.php"
99
]
10+
},
11+
"require-dev": {
12+
"deployer/deployer": "^5.1"
1013
}
1114
}

recipe.php

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,40 @@
77
set('nanbando_push', true);
88
set('nanbando', true);
99

10+
set('nanbando_enabled', function () {
11+
if (!get('nanbando')) {
12+
return false;
13+
}
14+
15+
$releases = get('releases_list', []);
16+
17+
return 0 < count($releases);
18+
});
19+
1020
task('nanbando:reconfigure', function () {
11-
if (get('nanbando')) {
12-
run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} reconfigure');
21+
if (!get('nanbando_enabled')) {
22+
return;
1323
}
24+
25+
run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} reconfigure');
1426
})->desc('Reconfigure nanbando');
1527

1628
task('nanbando:backup', function () {
17-
if (get('nanbando')) {
18-
run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} backup {{nanbando_backup_options}}');
29+
if (!get('nanbando_enabled')) {
30+
return;
1931
}
32+
33+
run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} backup {{nanbando_backup_options}}');
2034
})->desc('Create backup');
2135

2236
task('nanbando:push', function () {
23-
if (get('nanbando') && get('nanbando_push')) {
24-
run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} push');
37+
if (!get('nanbando_push') || !get('nanbando_enabled')) {
38+
return;
2539
}
40+
41+
run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} push');
2642
})->desc('Push backup to remote storage');
2743

2844
before('nanbando:backup', 'nanbando:reconfigure');
2945
after('nanbando:backup', 'nanbando:push');
3046
before('deploy:prepare', 'nanbando:backup');
31-

0 commit comments

Comments
 (0)