Skip to content

Commit

Permalink
Fix admin:copy_assets. Task now checks whether basedir exists before …
Browse files Browse the repository at this point in the history
…copying file and creates it in case it doesn't.
  • Loading branch information
dodecaphonic authored and sferik committed Feb 28, 2011
1 parent 43b7ddb commit a24b7d4
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions lib/rails_admin/railties/tasks.rake
@@ -1,4 +1,5 @@
require 'rails_admin/railties/extratasks'
require 'pp'

namespace :admin do
desc "Populate history tabel with a year of data"
Expand All @@ -22,8 +23,15 @@ namespace :admin do
copier = Rails::Generators::Base.new
%w( stylesheets images javascripts ).each do |directory|
Dir[File.join(origin,directory,'rails_admin','**/*')].each do |file|
relative = file.gsub(/^#{origin}\//, '')
copier.copy_file(file, File.join(destination,relative)) unless File.directory?(file)
relative = file.gsub(/^#{origin}\//, '')
dest_file = File.join(destination, relative)
dest_dir = File.dirname(dest_file)

if !File.exist?(dest_dir)
FileUtils.mkdir_p(dest_dir)
end

copier.copy_file(file, dest_file) unless File.directory?(file)
end
end
end
Expand Down

0 comments on commit a24b7d4

Please sign in to comment.