Load Path With Compass gem from Redbridge JAR

Hi JRuby List,

I’ve looked through a number of the suggestions from Yoko on this list
about how to load jars but I’m still having an issue in integrating a
jar’d version of the compass gem into my java runtime (using redbridge).
The following is my latest attempt:

String workingPath =
ServerContext.getServlet().getServletContext().getRealPath("/");
String basePath = “file:” + workingPath +
“WEB-INF/lib/compass-0.12.2.jar” + “!/gems/compass-0.12.2”;
ScriptingContainer container = new ScriptingContainer();
StringWriter scriptWriter = new StringWriter();
PrintWriter script = new PrintWriter(scriptWriter);

    script.println("  require 'rubygems'");
    script.println("  require 'compass'");
    script.println("  require 'sass/plugin'");
    script.println("  sass_options = Sass::Plugin.options.merge!(");
    script.println("    :template_location => '"+ workingPath + 

“sass’, “);
script.println(” :css_location => '”+ workingPath +
“stylesheets1’,”);
script.println(" :images_location => ‘"+ workingPath +
"images’,");
script.println(" :cache => true,");
script.println(" :cache_store => nil,");
script.println(" :cache_location => ‘"+ workingPath +
"WEB-INF/.sass_cache’");
script.println(" )");
script.println(" compiler = Compass::Compiler.new ‘" +
workingPath + "’, ‘"+ workingPath +"sass’, ‘"+ workingPath +
"stylesheets1’, sass_options");
script.println(" compiler.clean!");
script.println(" compiler.run");
script.flush();

    List<String> loadPaths = new ArrayList<String>();
    loadPaths.add(basePath + "/lib");
    loadPaths.add(basePath + "/frameworks/compass");
    loadPaths.add(basePath + "/frameworks/blueprints");

container.setLoadPaths(loadPaths);
container.runScriptlet(scriptWriter.toString());

The jar loaded has all needed gems and seems to load just fine and start
just fine. I run this and I get the following on the console:
remove .sass_cache/
remove ie.css
remove print.css
remove screen.css
create ie.css
create print.css
error screen.scss (Line 6: File to import not found or unreadable:
compass/reset.
Load path: /Applications/web/tomcat-std/bin)
create screen.css

What I’m stuck on is getting the frameworks/compass from the gem loaded
into the ruby runtime so that it can be found during the compass
compile. I’m not positive this is the proper list but it looks like more
of a redbridge issue than a compass issue to me but please let me know
if this would be better on the compass list.

Thank you much for any help with this issue,

– Paul Ryan

P.S. This is just a quick test version of this code.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs