metamaps--metamaps/lib/tasks/perms.rake

19 lines
635 B
Ruby
Raw Permalink Normal View History

2016-09-24 03:00:46 +00:00
# frozen_string_literal: true
2017-11-06 16:15:18 +00:00
2016-02-06 01:42:40 +00:00
require 'dotenv/tasks'
namespace :perms do
desc 'Update the Unix permissions on the public directory'
task fix: :environment do
2016-02-06 01:42:40 +00:00
# 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