file copy

require 'ftools'
namespace :ae do
  task :symlink_assets => :environment do
    vender_dir =  'vendor/plugins/activeext/public/assets/activeext'
    new_dir = 'public/assets/activeext'
    d=Dir.open(vender_dir)
    for dir in d
      if dir != '..' && dir != '.'
        dirname = new_dir + '/' + dir
        unless Dir.open(dirname)
          Dir.mkdir(dirname)
        end
        sub_dir = vender_dir + '/' + dir
        for file in Dir.open(sub_dir)
          from = sub_dir + '/' + file
          to = dirname + '/' + file
          if File.file?(from)
            File.syscopy(from, to)
          end
        end
      end
    end
  end
end

你可能感兴趣的:(File)