Title: [waffle-scm] [815] trunk/waffle-ruby/src/main/ruby/org/codehaus/waffle: Refactored ruby script loader to not assume paths are relative to servlet context.
Revision
815
Author
mauro
Date
2008-09-04 08:44:44 -0500 (Thu, 04 Sep 2008)

Log Message

Refactored ruby script loader to not assume paths are relative to servlet context.
Works now with both absolute paths, eg dir:/home/user/.../path/, and relative dir:src/main/ruby/.

Modified Paths

Diff

Modified: trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml (814 => 815)

--- trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml	2008-09-04 13:23:46 UTC (rev 814)
+++ trunk/examples/jruby-example/src/main/webapp/WEB-INF/web.xml	2008-09-04 13:44:44 UTC (rev 815)
@@ -44,13 +44,19 @@
     <param-value>org.codehaus.waffle.controller.RubyControllerDefinitionFactory</param-value>
   </context-param>
 
-  <!-- Define a relative path to the ruby script directory (for development) -->
-  <!-- NOTE:  this path work with jetty maven plugin; you may need to adapt it your dev environment -->
+  <!-- OPTIONAL: define a path to the ruby script directory (for development)
+       NOTE:  this path work with maven plugin filtering; you may need to adapt it your dev environment 
+       Alternatively, you may define an env variable, eg  WAFFLE_RUBY_SCRIPT=dir:/absolute/path/to/ruby/script/dir
   <context-param>
+    <param-name>org.codehaus.waffle.ruby.env</param-name>
+    <param-value>WAFFLE_RUBY_SCRIPT</param-value>
+  </context-param>       
+  -->
+  <context-param>
     <param-name>org.codehaus.waffle.ruby.path</param-name>
-    <param-value>dir:../../../src/main/ruby/</param-value>
+    <param-value>dir:src/main/ruby/</param-value>
   </context-param>
-
+  
   <listener>
     <listener-class>org.codehaus.waffle.context.pico.PicoWaffleContextListener</listener-class>
   </listener>

Modified: trunk/waffle-ruby/src/main/ruby/org/codehaus/waffle/waffle.rb (814 => 815)

--- trunk/waffle-ruby/src/main/ruby/org/codehaus/waffle/waffle.rb	2008-09-04 13:23:46 UTC (rev 814)
+++ trunk/waffle-ruby/src/main/ruby/org/codehaus/waffle/waffle.rb	2008-09-04 13:44:44 UTC (rev 815)
@@ -5,7 +5,6 @@
 import org.codehaus.waffle.action.ActionMethodInvocationException
 
 # TODO plugin monitoring/logging  
-  
 module Waffle
 
   # load/require files
@@ -25,8 +24,7 @@
     end
 
     def ScriptLoader.load_from_file_system
-      path = @__servlet_context.getRealPath('/')
-      path = "[EMAIL PROTECTED]"
+      path = @__ruby_script_path
 
       Dir.new(path).each do |entry|
         file = "#{path}#{entry}"


To unsubscribe from this list please visit:

http://xircles.codehaus.org/manage_email

Reply via email to