-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #30 from servergrove/2.0
2.0
- Loading branch information
Showing
14 changed files
with
283 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,31 @@ | ||
--- | ||
# defaults file for symfony2 | ||
|
||
symfony2_project_release: ~ | ||
symfony2_project_branch: master | ||
symfony2_project_php_path: php | ||
symfony2_project_keep_releases: 5 | ||
symfony2_project_clean_versioning: true | ||
symfony2_project_console_opts: '' | ||
symfony2_project_maintain_composer: true | ||
symfony2_project_composer_opts: '--no-dev --optimize-autoloader --no-interaction' | ||
symfony2_fire_schema_update: false | ||
symfony2_fire_migrations: false | ||
# necessary project vars | ||
|
||
#symfony_project_root: '' | ||
#symfony_project_composer_path: '' | ||
#symfony_project_repo: '' | ||
#symfony_project_env: '' | ||
|
||
# hooks | ||
symfony_project_post_folder_creation_tasks: ~ | ||
symfony_project_pre_cache_warmup_tasks: ~ | ||
symfony_project_pre_live_switch_tasks: ~ | ||
symfony_project_post_live_switch_tasks: ~ | ||
|
||
symfony_project_release: ~ | ||
symfony_project_branch: master | ||
symfony_project_php_path: php | ||
symfony_project_keep_releases: 5 | ||
symfony_project_git_clone_depth: 1 | ||
symfony_project_console_opts: '' | ||
symfony_project_parameters_file: parameters.yml | ||
symfony_project_cache_command: cache:warmup | ||
|
||
symfony_project_manage_composer: True | ||
symfony_project_composer_opts: '--no-dev --optimize-autoloader --no-interaction' | ||
symfony_project_composer_run_install: True | ||
|
||
symfony_project_enable_cache_warmup: True | ||
symfony_project_fire_schema_update: False | ||
symfony_project_fire_migrations: False | ||
symfony_project_symlink_assets: True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
--- | ||
- name: Dump assetic assets. | ||
shell: cd {{symfony_current_release_dir}} && {{symfony_project_php_path}} {{symfony_console}} assetic:dump --env={{symfony_project_env}} {{symfony_project_console_opts}} | ||
when: composer_content.stdout.find('assetic-bundle') != -1 | ||
|
||
- name: Symlink/install assets. | ||
shell: cd {{symfony_current_release_dir}} && {{symfony_project_php_path}} {{symfony_console}} assets:install --symlink --env={{symfony_project_env}} {{symfony_project_console_opts}} | ||
when: symfony_project_symlink_assets == True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
--- | ||
- name: Remove cache dir manually. | ||
file: state=absent path={{symfony_current_release_dir}}/app/cache/{{symfony_project_env}} | ||
when: symfony_project_enable_cache_warmup == True | ||
tags: | ||
- cache | ||
|
||
- name: Warmup sf cache. | ||
shell: cd {{symfony_current_release_dir}} && export SYMFONY_ENV={{symfony_project_env}}; {{symfony_project_php_path}} {{symfony_console}} {{symfony_project_cache_command}} --env={{symfony_project_env}} {{symfony_project_console_opts}} | ||
when: symfony_project_enable_cache_warmup == True | ||
tags: | ||
- cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
- name: Cleanup releases. | ||
shell: "cd {{symfony_project_root}}/releases && ls -t1 | tail -n +$(({{symfony_project_keep_releases}}+1)) | xargs -n1 rm -rf" | ||
when: symfony_project_keep_releases |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
--- | ||
- name: Check if composer exists. | ||
stat: path={{symfony_project_composer_path}} | ||
register: composer_file | ||
when: symfony_project_manage_composer == True | ||
|
||
- name: Install composer. | ||
get_url: url=https://getcomposer.org/composer.phar dest={{symfony_project_composer_path}} mode=0755 validate_certs=no | ||
when: symfony_project_manage_composer == True and composer_file.stat.exists == False | ||
|
||
- name: Update composer if already exists. | ||
shell: "{{symfony_project_composer_path}} selfupdate" | ||
when: composer_file.stat.exists == True and symfony_project_manage_composer == True | ||
|
||
- name: Link composer to project dir. | ||
file: state=link src={{symfony_project_composer_path}} path={{symfony_current_release_dir}}/composer | ||
when: symfony_project_manage_composer == True | ||
|
||
- name: Run composer install. | ||
shell: cd {{symfony_current_release_dir}} && export SYMFONY_ENV={{symfony_project_env}}; {{symfony_project_php_path}} {{symfony_project_composer_path}} install {{symfony_project_composer_opts}} | ||
when: symfony_project_composer_run_install == True |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
- name: Check if config dir exists. | ||
stat: path={{symfony_current_release_dir}}/app/config | ||
register: config_dir | ||
|
||
- name: Link configs dir if not yet exists. | ||
file: state=link src={{symfony_shared_dir}}/app/config path={{symfony_current_release_dir}}/app/config | ||
when: config_dir.stat.exists == false | ||
|
||
- name: Check if parameters file exists. | ||
stat: path={{symfony_shared_dir}}/app/config/{{symfony_project_parameters_file}} | ||
register: symfony_parameters | ||
|
||
- name: Create symlink for parameters file from shared directory. | ||
file: state=link src={{symfony_project_root}}/shared/app/config/{{symfony_project_parameters_file}} path={{symfony_current_release_dir}}/app/config/{{symfony_project_parameters_file}} creates={{symfony_current_release_dir}}/app/config/{{symfony_project_parameters_file}} | ||
when: symfony_parameters.stat.exists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
--- | ||
# simplify folder and command vars | ||
|
||
- name: Check/define release name. | ||
set_fact: symfony_project_release={{ lookup('pipe', 'date +%Y%m%d%H%M%S') }} | ||
when: symfony_project_release == None | ||
|
||
- name: Set symfony_current_release. | ||
set_fact: symfony_current_release={{symfony_project_release}}_{{symfony_project_branch}} | ||
|
||
- name: Set symfony_current_release_dir. | ||
set_fact: symfony_current_release_dir={{symfony_project_root}}/releases/{{symfony_current_release}} | ||
|
||
- name: Set symfony_shared_dir. | ||
set_fact: symfony_shared_dir={{symfony_project_root}}/shared | ||
|
||
- name: Set symfony_console. | ||
set_fact: symfony_console={{symfony_current_release_dir}}/app/console |
Oops, something went wrong.