1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails/tasks/railties.rake
Piotr Sarnacki 24d2d6726e Added task for creating symlinks to engines' public directories
Signed-off-by: José Valim <jose.valim@gmail.com>
2010-09-06 14:38:36 +02:00

20 lines
655 B
Ruby

namespace :railties do
desc "Create symlinks to railties public directories in application's public directory."
task :create_symlinks => :environment do
paths = Rails.application.config.static_asset_paths.dup
app_public_path = Rails.application.config.paths.public.to_a.first
paths.each do |mount_path, path|
symlink_path = File.join(app_public_path, mount_path)
if File.exist?(symlink_path)
File.symlink?(symlink_path) ? FileUtils.rm(symlink_path) : next
end
next unless File.exist?(path)
File.symlink(path, symlink_path)
puts "Created symlink #{symlink_path} -> #{path}"
end
end
end