Skip to content

Commit

Permalink
added check for existing releases (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
wachterjohannes authored Jul 3, 2017
1 parent 4ec92ba commit b5ce26d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 7 deletions.
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@
"files": [
"autoload.php"
]
},
"require-dev": {
"deployer/deployer": "^5.1"
}
}
29 changes: 22 additions & 7 deletions recipe.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,40 @@
set('nanbando_push', true);
set('nanbando', true);

set('nanbando_enabled', function () {
if (!get('nanbando')) {
return false;
}

$releases = get('releases_list', []);

return 0 < count($releases);
});

task('nanbando:reconfigure', function () {
if (get('nanbando')) {
run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} reconfigure');
if (!get('nanbando_enabled')) {
return;
}

run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} reconfigure');
})->desc('Reconfigure nanbando');

task('nanbando:backup', function () {
if (get('nanbando')) {
run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} backup {{nanbando_backup_options}}');
if (!get('nanbando_enabled')) {
return;
}

run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} backup {{nanbando_backup_options}}');
})->desc('Create backup');

task('nanbando:push', function () {
if (get('nanbando') && get('nanbando_push')) {
run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} push');
if (!get('nanbando_push') || !get('nanbando_enabled')) {
return;
}

run('cd {{current_path}} && {{bin/php}} {{bin/nanbando}} push');
})->desc('Push backup to remote storage');

before('nanbando:backup', 'nanbando:reconfigure');
after('nanbando:backup', 'nanbando:push');
before('deploy:prepare', 'nanbando:backup');

0 comments on commit b5ce26d

Please sign in to comment.