Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[+] isolate symfony deploy from other deploy roles #67

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ set :linked_dirs, ["var/logs"]
# Set correct permissions between releases, this is turned off by default
set :file_permissions_paths, ["var"]
set :permission_method, false

# Set roles for deply symfony (set :symfony_deploy_roles, %{app cli})
set :symfony_deploy_roles, :all

```

#### Using this plugin with the old Symfony 2 directory structure and SensioDistributionBundle <= 4
Expand Down
2 changes: 2 additions & 0 deletions lib/capistrano/symfony/defaults.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@
set :file_permissions_paths, -> { fetch(:symfony_directory_structure) == 2 ? [fetch(:log_path), fetch(:cache_path)] : [fetch(:var_path)] }
# Method used to set permissions (:chmod, :acl, or :chown)
set :permission_method, false

set :symfony_deploy_roles, :all
16 changes: 8 additions & 8 deletions lib/capistrano/tasks/symfony.rake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace :symfony do
# ask only runs if argument is not provided
ask(:cmd, "cache:clear")
command = args[:command] || fetch(:cmd)
role = args[:role] || :all
role = args[:role] || fetch(:symfony_deploy_roles)
params = args[:params] || ''

on release_roles(role) do
Expand All @@ -21,14 +21,14 @@ namespace :symfony do
namespace :cache do
desc "Run app/console cache:clear for the #{fetch(:symfony_env)} environment"
task :clear do
on release_roles(:all) do
on roles(fetch(:symfony_deploy_roles)) do
symfony_console "cache:clear"
end
end

desc "Run app/console cache:warmup for the #{fetch(:symfony_env)} environment"
task :warmup do
on release_roles(:all) do
on roles(fetch(:symfony_deploy_roles)) do
symfony_console "cache:warmup"
end
end
Expand All @@ -37,7 +37,7 @@ namespace :symfony do
namespace :assets do
desc "Install assets"
task :install do
on release_roles(:all) do
on roles(fetch(:symfony_deploy_roles)) do
within release_path do
symfony_console "assets:install", fetch(:assets_install_path) + ' ' + fetch(:assets_install_flags)
end
Expand All @@ -47,7 +47,7 @@ namespace :symfony do

desc "Create the cache directory"
task :create_cache_dir do
on release_roles :all do
on roles(fetch(:symfony_deploy_roles)) do
within release_path do
if test "[ -d #{symfony_cache_path} ]"
execute :rm, "-rf", symfony_cache_path
Expand All @@ -59,7 +59,7 @@ namespace :symfony do

desc "Set user/group permissions on configured paths"
task :set_permissions do
on release_roles :all do
on roles(fetch(:symfony_deploy_roles)) do
if fetch(:permission_method) != false
invoke "deploy:set_permissions:#{fetch(:permission_method).to_s}"
end
Expand All @@ -69,7 +69,7 @@ namespace :symfony do
desc "Clear non production controllers"
task :clear_controllers do
next unless any? :controllers_to_clear
on release_roles :all do
on roles(fetch(:symfony_deploy_roles)) do
within symfony_web_path do
execute :rm, "-f", *fetch(:controllers_to_clear)
end
Expand All @@ -78,7 +78,7 @@ namespace :symfony do

desc "Build the bootstrap file"
task :build_bootstrap do
on release_roles :all do
on roles(fetch(:symfony_deploy_roles)) do
within release_path do
if fetch(:symfony_directory_structure) == 2
execute :php, build_bootstrap_path, fetch(:app_path)
Expand Down