Sha256: fb81025036ee0eedc1c061a27511d0aab8353606832479d4212523e481721966

Contents?: true

Size: 822 Bytes

Versions: 14

Compression:

Stored size: 822 Bytes

Contents

require 'fileutils'

namespace "ckeditor" do
  desc "Create nondigest versions of all ckeditor digest assets"
  task "nondigest" => [:environment] do
    fingerprint = /\-[0-9a-f]{32,64}\./
    path        = File.join Rails.root.to_s, "public", Ckeditor.base_path, "**/*"
    files       = Dir[path]

    for file in files
      next unless file =~ fingerprint
      nondigest = file.sub fingerprint, '.'

      if !File.exist?(nondigest) or File.mtime(file) > File.mtime(nondigest)
        FileUtils.cp file, nondigest, verbose: true, preserve: true
      end
    end
  end
end

# Based on rake task from asset_sync gem
if Rake::Task.task_defined?("assets:precompile")
  Rake::Task["assets:precompile"].enhance do
    Rake::Task["ckeditor:nondigest"].invoke if defined?(Ckeditor) && Ckeditor.run_on_precompile?
  end
end

Version data entries

14 entries across 14 versions & 4 rubygems

Version Path
danabr75-ckeditor-4.1.6 lib/tasks/ckeditor.rake
glebtv-ckeditor-4.6.0 lib/tasks/ckeditor.rake
glebtv-ckeditor-4.5.10.3 lib/tasks/ckeditor.rake
glebtv-ckeditor-4.5.10.2 lib/tasks/ckeditor.rake
glebtv-ckeditor-4.5.10.1 lib/tasks/ckeditor.rake
ckeditor-4.2.0 lib/tasks/ckeditor.rake
glebtv-ckeditor-4.5.7.1 lib/tasks/ckeditor.rake
glebtv-ckeditor-4.5.7 lib/tasks/ckeditor.rake
ckeditor_custom_controller-4.1.6 lib/tasks/ckeditor.rake
ckeditor-4.1.6 lib/tasks/ckeditor.rake
ckeditor-4.1.5 lib/tasks/ckeditor.rake
ckeditor-4.1.4 lib/tasks/ckeditor.rake
ckeditor-4.1.3 lib/tasks/ckeditor.rake
ckeditor-4.1.2 lib/tasks/ckeditor.rake