Skip to content

Commit

Permalink
Merge pull request #13 from maschmann/add-cleanup-for-release-directory
Browse files Browse the repository at this point in the history
Added command to cleanup release dir with keep releases option
  • Loading branch information
maschmann committed May 21, 2015
2 parents bf047c8 + e0ef219 commit df78d6a
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Role Variables
symfony2_project_env: prod
symfony2_project_console_opts: ''
symfony2_project_composer_opts: '--no-dev --optimize-autoloader'
symfony2_project_keep_releases: 5
```
Dependencies
Expand Down
1 change: 1 addition & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@
symfony2_project_release: 1
symfony2_project_branch: master
symfony2_project_php_path: php
symfony2_project_keep_releases: 5
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,5 @@
shell: cd {{symfony2_project_root}}/releases/{{symfony2_project_release}} && if $(grep doctrine-migrations-bundle composer.json); then {{symfony2_project_php_path}} app/console doctrine:migrations:migrate -n; fi
- name: Create symlink
file: state=link src={{symfony2_project_root}}/releases/{{symfony2_project_release}} path={{symfony2_project_root}}/current
- name: Cleanup releases.
shell: cd {{symfony2_project_root}}/releases && ls -t1 | tail -n +$(({{symfony2_project_keep_releases}}+1)) | xargs -n1 rm -rf

0 comments on commit df78d6a

Please sign in to comment.