Sha256: 5bf1bec8ecb8dfa4b3ed612a5975c192818d47dcc97bb88e7d037b05f11e25fa

Contents?: true

Size: 859 Bytes

Versions: 1

Compression:

Stored size: 859 Bytes

Contents

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'
  end
end

namespace :deploy do
  namespace :simple_permissions do
    task :set_permissions do
      on roles(:web) do
        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'

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
capistrano-simple-permissions-0.1.1 lib/capistrano/tasks/simple_permissions.rake