Odd Warbler + Compass Gem Interaction

Article summary

Short Version

If this looks familiar:

org.jruby.rack.RackInitializationException: no such file to load -- /private/var/folders/.../app.war/WEB-INF/config/compass.class

Make sure you don’t compile config/compass.rb.

Longer Version

This week we spent a little time setting up Warbler for deploying our JRuby Rails app. Warbler’s been a useful tool for us to bundle up our application.

We did run into a quirk between compiling our Ruby files and the Compass Rubygem. After compiling, warring, and starting the application, we were greeted with an exception that looked something like this:

org.jruby.rack.RackInitializationException: no such file to load -- /private/var/folders/.../app.war/WEB-INF/config/compass.class

So we went and looked in the directory with our unpacked files and…sure enough, compass.rb and compass.class were sitting right there. Weird. (note: when compiling Ruby files, warbler replaces the rb file with a single line that requires the real class file.)

After some more digging, we found that the content of config/compass.rb is being evaled by one of Compass’s configuration classes. For whatever reason, this isn’t working as expected. We have some ideas about what’s going on, but not enough evidence or information to prove anything one way or another.

So to work around the problem, we simply instruct Warbler not to compile config/compass.rb. Here’s what we’ve got in our config/warble.rb file now:

compile_me = FileList[*config.dirs.map {|x| "#{x}/**/*.rb"}].exclude("config/compass.rb")
config.compiled_ruby_files = compile_me


  • qichunren says:

    I also got this problem. Do you why? I opened an issue with compass project at github:https://github.com/chriseppstein/compass/issues/525

  • Comments are closed.