Skip to content
This repository has been archived by the owner on Feb 7, 2024. It is now read-only.

Commit

Permalink
Update to work in Rails 4 non-fingerprinted environment.
Browse files Browse the repository at this point in the history
We do this by cheating. Instead of do some crazy mojo to get ckeditor talking
to the fingerprinted versions of the assets we simply create non-fingerprinted
versions like it used to work in Rails 3.

Since this is not what a developer might expect happen we limit our cheat
to only assets produced by ckeditor.

Our task that does this is named assets:precompile. This way our functionality
is appended to the standard funtionality. This will allow it to work in
environments like Heroku where the name of the task that is run to generate
the assets cannot be changed.

The end result is that everything should work out-of-the-box, not affect
anything bug ckeditor and requires minimal changes to this gem.

This fixes issue tsechingho#18.
  • Loading branch information
eric1234 committed Jul 18, 2013
1 parent 4de02bc commit 180e0f2
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/ckeditor-rails/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ class Engine < ::Rails::Engine
ckeditor/*.html
ckeditor/*.md
)

rake_tasks do
load "ckeditor-rails/tasks.rake"
end
end
end
end
11 changes: 11 additions & 0 deletions lib/ckeditor-rails/tasks.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'fileutils'

desc "Create nondigest versions of all ckeditor digest assets"
task "assets:precompile" do
fingerprint = /\-[0-9a-f]{32}\./
for file in Dir["public/assets/ckeditor/**/*"]
next unless file =~ fingerprint
nondigest = file.sub fingerprint, '.'
FileUtils.cp file, nondigest, verbose: true
end
end

0 comments on commit 180e0f2

Please sign in to comment.