lib/capistrano/tasks/simple_permissions.rake in capistrano-simple-permissions-0.1.0 vs lib/capistrano/tasks/simple_permissions.rake in capistrano-simple-permissions-0.1.1
- old
+ new
@@ -1,24 +1,25 @@
namespace :load do
task :defaults do
set :permissions_folders, []
- set :chmod_folder_permissions, "775"
- set :chmod_file_permissions, "664"
- set :chown_owner, ""
- set :chown_group, "web"
+ set :chmod_folder_permissions, '775'
+ set :chmod_file_permissions, '664'
+ set :chown_owner, ''
+ set :chown_group, 'web'
end
end
namespace :deploy do
namespace :simple_permissions do
-
task :set_permissions do
on roles(:web) do
- execute :find, *fetch(:permissions_folders), '-type', :d, '-exec', :chmod, fetch(:chmod_folder_permissions), '{}', '\\;'
- execute :find, *fetch(:permissions_folders), '-type', :f, '-exec', :chmod, fetch(:chmod_file_permissions), '{}', '\\;'
- execute :chown, '-R', "#{fetch(:chown_owner)}:#{fetch(:chown_group)}", *fetch(:permissions_folders)
+ unless fetch(:permissions_folders).empty?
+ execute :find, *fetch(:permissions_folders), '-type', :d, '-exec', :chmod, fetch(:chmod_folder_permissions), '{}', '\\;'
+ execute :find, *fetch(:permissions_folders), '-type', :f, '-exec', :chmod, fetch(:chmod_file_permissions), '{}', '\\;'
+ execute :chown, '-R', "#{fetch(:chown_owner)}:#{fetch(:chown_group)}", *fetch(:permissions_folders)
+ end
end
end
end
end
-after "deploy:log_revision", "deploy:simple_permissions:set_permissions"
+after 'deploy:log_revision', 'deploy:simple_permissions:set_permissions'