diff options
Diffstat (limited to 'railties/lib')
-rw-r--r-- | railties/lib/rails/tasks.rb | 1 | ||||
-rw-r--r-- | railties/lib/rails/tasks/railties.rake | 20 |
2 files changed, 21 insertions, 0 deletions
diff --git a/railties/lib/rails/tasks.rb b/railties/lib/rails/tasks.rb index 9807000578..af52014728 100644 --- a/railties/lib/rails/tasks.rb +++ b/railties/lib/rails/tasks.rb @@ -11,6 +11,7 @@ $VERBOSE = nil routes statistics tmp + railties ).each do |task| load "rails/tasks/#{task}.rake" end diff --git a/railties/lib/rails/tasks/railties.rake b/railties/lib/rails/tasks/railties.rake new file mode 100644 index 0000000000..7cf31f84a0 --- /dev/null +++ b/railties/lib/rails/tasks/railties.rake @@ -0,0 +1,20 @@ +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 |