metamaps--metamaps/lib/tasks/perms.rake
Devin Howard 7d4da81272 Update code style automatically using rubocop gem (#563)
* install rubocop

* 1961 automatic rubocop fixes

* update rubocop.yml to ignore half of the remaining cops

* rubocop lint warnings

* random other warnings fixed
2016-07-26 08:14:23 +08:00

17 lines
604 B
Ruby

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