Skip to content

Commit 4d1fa2e

Browse files
authored
Added support for symfony 4. (#98)
* Removed parameters not used in symfony 4 * We do not need to clear any controllers * Added project dir * Make console executable
1 parent b0685a6 commit 4d1fa2e

File tree

5 files changed

+13
-46
lines changed

5 files changed

+13
-46
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ deploy
110110
| |__ deploy:symlink:shared
111111
| |__ symfony:create_cache_dir
112112
| |__ symfony:set_permissions
113+
| |__ symfony:make_console_executable
113114
|__ deploy:updated
114115
| |__ symfony:cache:warmup
115116
| |__ symfony:clear_controllers

lib/capistrano/dsl/symfony.rb

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,16 +38,6 @@ def symfony_vendor_path
3838
release_path.join('vendor')
3939
end
4040

41-
def build_bootstrap_path
42-
bootstrap_path = symfony_vendor_path.join("sensio/distribution-bundle")
43-
44-
if fetch(:sensio_distribution_version).to_i <= 4
45-
bootstrap_path = bootstrap_path.join("Sensio/Bundle/DistributionBundle")
46-
end
47-
48-
bootstrap_path.join("Resources/bin/build_bootstrap.php")
49-
end
50-
5141
def symfony_console(command, params = '')
5242
execute :php, symfony_console_path, command, params, fetch(:symfony_console_flags)
5343
end

lib/capistrano/symfony/defaults.rb

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,41 +3,35 @@
33
#
44
set :symfony_env, "prod"
55

6-
set :symfony_directory_structure, 3
7-
set :sensio_distribution_version, 5
8-
96
# symfony-standard edition top-level directories
10-
set :app_path, "app"
11-
set :web_path, "web"
12-
set :var_path, "var"
137
set :bin_path, "bin"
8+
set :config_path, "config"
9+
set :var_path, "var"
10+
set :web_path, "web"
1411

1512
# Use closures for directories nested under the top level dirs, so that
1613
# any changes to web/app etc do not require these to be changed also
17-
set :app_config_path, -> { fetch(:app_path) + "/config" }
18-
set :log_path, -> { fetch(:symfony_directory_structure) == 2 ? fetch(:app_path) + "/logs" : fetch(:var_path) + "/logs" }
19-
set :cache_path, -> { fetch(:symfony_directory_structure) == 2 ? fetch(:app_path) + "/cache" : fetch(:var_path) + "/cache" }
14+
set :log_path, -> { fetch(:var_path) + "/log" }
15+
set :cache_path, -> { fetch(:var_path) + "/cache" }
2016

2117
# console
22-
set :symfony_console_path, -> { fetch(:symfony_directory_structure) == 2 ? fetch(:app_path) + '/console' : fetch(:bin_path) + "/console" }
18+
set :symfony_console_path, -> { fetch(:bin_path) + "/console" }
2319
set :symfony_console_flags, "--no-debug"
2420

25-
set :controllers_to_clear, ["app_*.php", "config.php"]
26-
2721
# assets
2822
set :assets_install_path, fetch(:web_path)
2923
set :assets_install_flags, '--symlink'
3024

3125
#
3226
# Capistrano defaults
3327
#
34-
set :linked_files, -> { [fetch(:app_config_path) + "/parameters.yml"] }
28+
set :linked_files, -> { [".env"] }
3529
set :linked_dirs, -> { [fetch(:log_path)] }
3630

3731
#
3832
# Configure capistrano/file-permissions defaults
3933
#
40-
set :file_permissions_paths, -> { fetch(:symfony_directory_structure) == 2 ? [fetch(:log_path), fetch(:cache_path)] : [fetch(:var_path)] }
34+
set :file_permissions_paths, -> { [fetch(:var_path)] }
4135
# Method used to set permissions (:chmod, :acl, or :chown)
4236
set :permission_method, false
4337

lib/capistrano/tasks/deploy.rake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ namespace :deploy do
88
task :updating do
99
invoke "symfony:create_cache_dir"
1010
invoke "symfony:set_permissions"
11+
invoke "symfony:make_console_executable"
1112
end
1213

1314
task :updated do

lib/capistrano/tasks/symfony.rake

Lines changed: 3 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -64,29 +64,10 @@ namespace :symfony do
6464
end
6565
end
6666

67-
desc "Clear non production controllers"
68-
task :clear_controllers do
69-
next unless any? :controllers_to_clear
70-
on release_roles(fetch(:symfony_deploy_roles)) do
71-
within symfony_web_path do
72-
execute :rm, "-f", *fetch(:controllers_to_clear)
73-
end
74-
end
67+
desc "Make symfony_console_path executable"
68+
task :make_console_executable do
69+
execute :chmod, "755", fetch(:symfony_console_path)
7570
end
76-
77-
desc "Build the bootstrap file"
78-
task :build_bootstrap do
79-
on release_roles(fetch(:symfony_deploy_roles)) do
80-
within release_path do
81-
if fetch(:symfony_directory_structure) == 2
82-
execute :php, build_bootstrap_path, fetch(:app_path)
83-
else
84-
execute :php, build_bootstrap_path, fetch(:var_path)
85-
end
86-
end
87-
end
88-
end
89-
9071
end
9172

9273
task :symfony => ["symfony:console"]

0 commit comments

Comments
 (0)