add rake perms:fix task for public dir
This commit is contained in:
parent
ea11ce69e5
commit
246c344959
1 changed files with 16 additions and 0 deletions
16
lib/tasks/perms.rake
Normal file
16
lib/tasks/perms.rake
Normal file
|
@ -0,0 +1,16 @@
|
|||
require 'dotenv/tasks'
|
||||
|
||||
namespace :perms do
|
||||
desc "Update the Unix permissions on the public directory"
|
||||
task :fix => :environment do
|
||||
# e.g. rake perms:fix user=mmstaging group=mmstaging
|
||||
# e.g. rake perms:fix group=www-data #probably don't need this one
|
||||
# e.g. rake perms:fix
|
||||
user = ENV['user'] || 'metamaps'
|
||||
group = ENV['group'] || 'metamaps'
|
||||
public_dir = Rails.root.join('public').to_s
|
||||
system "chown -R #{user}:#{group} #{public_dir}"
|
||||
system "find #{public_dir} -type d -exec chmod 755 '{}' \\;"
|
||||
system "find #{public_dir} -type f -exec chmod 644 '{}' \\;"
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue