[jruby-rack~main:cfdb3015] Preparing for 1.0.4

  • From: nicksieger@kenai.com
  • To: commits@jruby-rack.kenai.com
  • Subject: [jruby-rack~main:cfdb3015] Preparing for 1.0.4
  • Date: Wed, 8 Dec 2010 22:19:37 +0000

Project:    jruby-rack
Repository: main
Revision:   cfdb301564bc8311c38e0495127f896f26bb4d1a
Author:     nicksieger
Date:       2010-12-08 22:13:07 UTC
Link:       

Log Message:
------------
Added rails.relative_url_append context parameter.
This can be set in your web.xml or similar to append a string to the end of 
the context path when the RAILS_RELATIVE_URL_ROOT is set. This allows you to 
host your rails app in a location other than the base context path of your 
application.
Placing the application at a subpath of the context root is useful when you 
are serving rails pages from the same WAR as another framework. For instance, 
you can have a single WAR that serves both JSF and Rails pages.
If you want to do this, you'll also have to set the RackFilter path mapping 
to reflect the new URL for the parts of the application that should be served 
by Rack.
Merge remote branch 'benrosenblum/master'
Adding recent changes to history
Update readme to include documentation of jruby.rack.slash.index
Just use warble gemjar feature instead of custom tasks
Don't allow gemspec to have './' in all the file pathnames
Sync up disuse of toURI along with JRuby trunk
Seems we can no longer run specs in the same process as Rake, due to 
classpath issues
Preparing for 1.0.4


Revisions:
----------
fb3533d5e3d52741e25bb8a04509df41900f9e83
ef2b7323eeec62c3d9c0adeeb976c08de2ae9b54
4011a5e303ad22fc4018f3bb00bfbeff1f5f1d00
e30880b5bdec8380e01c592719886ca0e914e31c
45986742d799bdae91ed88d9ea26a6aa5fcd2974
02b5d62fb7710ee47555ed4933242d0e08f2709a
c4003f3e734e72b8a8ae0363c114d4e49ea4b7da
8a0cfdfecc7f44b1b40e84d6f2bc89803edfe4d4
cfdb301564bc8311c38e0495127f896f26bb4d1a


Modified Paths:
---------------
README.md
src/main/ruby/jruby/rack/rails.rb
src/spec/ruby/jruby/rack/rails_spec.rb
Rakefile
examples/camping/config/warble.rb
examples/merb/config/warble.rb
examples/rails/config/warble.rb
examples/rails3/config/warble.rb
examples/sinatra/config/warble.rb
src/main/java/org/jruby/rack/PoolingRackApplicationFactory.java
src/main/java/org/jruby/rack/RackFilter.java
src/main/java/org/jruby/rack/RackResponseEnvironment.java
src/main/java/org/jruby/rack/RackServlet.java
src/main/java/org/jruby/rack/servlet/ServletRackEnvironment.java
src/main/ruby/jruby/rack/queues.rb
src/spec/ruby/action_controller/session/java_servlet_store_spec.rb
src/spec/ruby/cgi/session/java_servlet_store_spec.rb
src/spec/ruby/jruby/rack/app_layout_spec.rb
src/spec/ruby/jruby/rack/booter_spec.rb
src/spec/ruby/jruby/rack/errors_spec.rb
src/spec/ruby/jruby/rack/queues/activemq_spec.rb
src/spec/ruby/jruby/rack/queues_spec.rb
src/spec/ruby/jruby/rack/response_spec.rb
src/spec/ruby/jruby/rack/servlet_ext_spec.rb
src/spec/ruby/rack/adapter/rails_spec.rb
src/spec/ruby/rack/application_spec.rb
src/spec/ruby/rack/core_ext_spec.rb
src/spec/ruby/rack/dispatcher_spec.rb
src/spec/ruby/rack/filter_spec.rb
src/spec/ruby/rack/handler/servlet_spec.rb
src/spec/ruby/rack/input_spec.rb
src/spec/ruby/rack/jms_spec.rb
src/spec/ruby/rack/logging_spec.rb
src/spec/ruby/rack/servlet_context_listener_spec.rb
src/spec/ruby/rack/servlet_spec.rb
src/spec/ruby/rack/tag_spec.rb
src/spec/ruby/spec_helper.rb
History.txt
examples/rails/lib/tasks/deploy.rake
src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java
pom.xml
src/main/ruby/jruby/rack/version.rb


Added Paths:
------------
src/main/java/org/jruby/rack/DefaultRackDispatcher.java
src/main/java/org/jruby/rack/RackDispatcher.java
src/main/ruby/jruby/rack/queues/pubsub.rb
src/spec/ruby/jruby/rack/queues/pubsub_spec.rb


Diffs:
------
diff --git a/README.md b/README.md
index 35471a3..a4fb700 100644
--- a/README.md
+++ b/README.md
@@ -157,6 +157,10 @@ web.xml.
   Merb application files. Defaults to `/WEB-INF`.
 - `rails.env`: Specify the Rails environment to run. Defaults
   to 'production'.
+- `rails.relative_url_append`: Specify a path to be appended to the 
+  ActionController::Base.relative_url_root after the context path. Useful
+  for running a rails app from the same war as an existing app, under
+  a sub-path of the main servlet context root.
 - `merb.environment`: Specify the merb environment to run. Defaults to
   `production`.
 
diff --git a/src/main/ruby/jruby/rack/rails.rb 
b/src/main/ruby/jruby/rack/rails.rb
index d75377c..60455bf 100644
--- a/src/main/ruby/jruby/rack/rails.rb
+++ b/src/main/ruby/jruby/rack/rails.rb
@@ -30,7 +30,8 @@ module JRuby::Rack
     end
 
     def setup_relative_url_root
-      relative_url_root = @rack_context.getContextPath
+      relative_url_append = 
@rack_context.getInitParameter('rails.relative_url_append') || ''
+      relative_url_root = @rack_context.getContextPath + relative_url_append
       if relative_url_root && !relative_url_root.empty? && relative_url_root 
!= '/'
         ENV['RAILS_RELATIVE_URL_ROOT'] = relative_url_root
       end
diff --git a/src/spec/ruby/jruby/rack/rails_spec.rb 
b/src/spec/ruby/jruby/rack/rails_spec.rb
index 10b5bb7..a89fc2f 100644
--- a/src/spec/ruby/jruby/rack/rails_spec.rb
+++ b/src/spec/ruby/jruby/rack/rails_spec.rb
@@ -49,6 +49,13 @@ describe JRuby::Rack::RailsBooter do
     ENV['RAILS_RELATIVE_URL_ROOT'].should == '/myapp'
   end
 
+  it "should append to RAILS_RELATIVE_URL_ROOT if 
'rails.relative_url_append' is set" do
+    @rack_context.should_receive(:getContextPath).and_return '/myapp'
+    
@rack_context.should_receive(:getInitParameter).with("rails.relative_url_append").and_return
 "/blah"
+    create_booter(JRuby::Rack::RailsBooter).boot!
+    ENV['RAILS_RELATIVE_URL_ROOT'].should == '/myapp/blah'
+  end
+
   it "should determine the public html root from the 'public.root' init 
parameter" do
     
@rack_context.should_receive(:getInitParameter).with("public.root").and_return
 "/blah"
     @rack_context.should_receive(:getRealPath).with("/blah").and_return "."
diff --git a/README.md b/README.md
index 21cb7ce..9d71ffe 100644
--- a/README.md
+++ b/README.md
@@ -161,6 +161,10 @@ web.xml.
   Merb application files. Defaults to `/WEB-INF`.
 - `rails.env`: Specify the Rails environment to run. Defaults
   to 'production'.
+- `rails.relative_url_append`: Specify a path to be appended to the 
+  ActionController::Base.relative_url_root after the context path. Useful
+  for running a rails app from the same war as an existing app, under
+  a sub-path of the main servlet context root.
 - `merb.environment`: Specify the merb environment to run. Defaults to
   `production`.
 - `jruby.rack.logging`: Specify the logging device to use. Defaults to
diff --git a/src/main/ruby/jruby/rack/rails.rb 
b/src/main/ruby/jruby/rack/rails.rb
index d75377c..60455bf 100644
--- a/src/main/ruby/jruby/rack/rails.rb
+++ b/src/main/ruby/jruby/rack/rails.rb
@@ -30,7 +30,8 @@ module JRuby::Rack
     end
 
     def setup_relative_url_root
-      relative_url_root = @rack_context.getContextPath
+      relative_url_append = 
@rack_context.getInitParameter('rails.relative_url_append') || ''
+      relative_url_root = @rack_context.getContextPath + relative_url_append
       if relative_url_root && !relative_url_root.empty? && relative_url_root 
!= '/'
         ENV['RAILS_RELATIVE_URL_ROOT'] = relative_url_root
       end
diff --git a/src/spec/ruby/jruby/rack/rails_spec.rb 
b/src/spec/ruby/jruby/rack/rails_spec.rb
index 1f63b44..47cd061 100644
--- a/src/spec/ruby/jruby/rack/rails_spec.rb
+++ b/src/spec/ruby/jruby/rack/rails_spec.rb
@@ -49,6 +49,13 @@ describe JRuby::Rack::RailsBooter do
     ENV['RAILS_RELATIVE_URL_ROOT'].should == '/myapp'
   end
 
+  it "should append to RAILS_RELATIVE_URL_ROOT if 
'rails.relative_url_append' is set" do
+    @rack_context.should_receive(:getContextPath).and_return '/myapp'
+    
@rack_context.should_receive(:getInitParameter).with("rails.relative_url_append").and_return
 "/blah"
+    create_booter(JRuby::Rack::RailsBooter).boot!
+    ENV['RAILS_RELATIVE_URL_ROOT'].should == '/myapp/blah'
+  end
+
   it "should determine the public html root from the 'public.root' init 
parameter" do
     
@rack_context.should_receive(:getInitParameter).with("public.root").and_return
 "/blah"
     @rack_context.should_receive(:getRealPath).with("/blah").and_return "."
diff --git a/History.txt b/History.txt
index f95d0fd..4ad6636 100644
--- a/History.txt
+++ b/History.txt
@@ -2,6 +2,16 @@
 
 - Make sane defaults for app/gem/public paths when using
   RailsFilesystemLayout (Kristian Meier)
+- Add 'jruby.rack.slash.index' init param that forces / =>
+  /index.html. Fixes JRUBY_RACK-35 and makes Jetty 6 work without
+  having to configure dirAllowed in Jetty's default servlet.
+- Switch to mostly relying on request URI and not so much servlet
+  path/path info. Makes Tomcat 7 work.
+- Added rails.relative_url_append context parameter. This can be set in
+  your web.xml or similar to append a string to the end of the context
+  path when the RAILS_RELATIVE_URL_ROOT is set. This allows you to
+  host your rails app in a location other than the base context path
+  of your application. (Ben Rosenblum)
 
 == 1.0.3
diff --git a/README.md b/README.md
index 9d71ffe..46a7e6c 100644
--- a/README.md
+++ b/README.md
@@ -169,6 +169,10 @@ web.xml.
   `production`.
 - `jruby.rack.logging`: Specify the logging device to use. Defaults to
   `servlet_context`. See below.
+- `jruby.rack.slash.index`: Force rewriting of requests that end in
+  '/' to be passed through to the container as '/index.html'. Default
+  is false, but is turned on for Jetty by default to avoid triggering
+  directory index pages.
 
 ## Logging
diff --git a/examples/rails/config/warble.rb b/examples/rails/config/warble.rb
index 8fb0620..809c957 100644
--- a/examples/rails/config/warble.rb
+++ b/examples/rails/config/warble.rb
@@ -3,6 +3,8 @@ Warbler::Config.new do |config|
   # Temporary directory where the application is staged
   # config.staging_dir = "tmp/war"
 
+  config.features = %w(gemjar)
+
   # Application directories to be included in the webapp.
   config.dirs = %w(app config lib log vendor)
 
diff --git a/examples/rails/lib/tasks/deploy.rake 
b/examples/rails/lib/tasks/deploy.rake
index bbec2ed..0aa5220 100644
--- a/examples/rails/lib/tasks/deploy.rake
+++ b/examples/rails/lib/tasks/deploy.rake
@@ -1,34 +1,7 @@
 gem 'warbler'
 require 'warbler'
 
-class Warbler::Task
-  def define_appengine_consolidation_tasks
-    #              Warbler >= 1.1     Warbler 1.0
-    gemjar_task = ["war:make_gemjar", "war:gemjar"].detect {|t| 
Rake.application.lookup(t)}
-    if gemjar_task
-      task "war:jar" => gemjar_task
-    else                        # Warbler 0.9.x
-      with_namespace_and_config do |name, config|
-        app_task = Rake.application.lookup("app")
-        gems_task = Rake.application.lookup("gems")
-        app_task.prerequisites.delete("gems")
-        gems_jar_name = File.expand_path(File.join(config.staging_dir, 
"WEB-INF", "lib", "gems.jar"))
-
-        file gems_jar_name => gems_task.prerequisites do |t|
-          Dir.chdir(File.join(config.staging_dir, "WEB-INF")) do
-            sh "jar cf #{gems_jar_name} -C gems ."
-            rm_rf "gems"
-          end
-        end
-
-        task :app => gems_jar_name
-      end
-    end
-  end
-end
-
 warbler = Warbler::Task.new
-warbler.define_appengine_consolidation_tasks
 
 task :clean => "war:clean"
diff --git a/Rakefile b/Rakefile
index ca218db..2c075f0 100644
--- a/Rakefile
+++ b/Rakefile
@@ -181,7 +181,7 @@ task :gem => 
["target/jruby-rack-#{JRuby::Rack::VERSION}.jar",
       s.description = %{JRuby-Rack is a combined Java and Ruby library that 
adapts the Java Servlet API to Rack. For JRuby only.}
       s.summary = %q{Rack adapter for JRuby and Servlet Containers}
       s.email = ["nick@nicksieger.com"]
-      s.files = FileList["./**/*"].exclude("*.gem")
+      s.files = FileList["./**/*"].exclude("*.gem").map{|f| f.sub(/^\.\//, 
'')}
       s.homepage = %q{http://jruby.org}
       s.has_rdoc = false
       s.rubyforge_project = %q{jruby-extras}
diff --git a/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java 
b/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java
index e7cc7c6..968d570 100644
--- a/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java
+++ b/src/main/java/org/jruby/rack/DefaultRackApplicationFactory.java
@@ -11,6 +11,7 @@ import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
 import java.io.Reader;
+import java.net.URL;
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Iterator;
@@ -100,12 +101,10 @@ public class DefaultRackApplicationFactory implements 
RackApplicationFactory {
         RubyInstanceConfig config = new RubyInstanceConfig();
         config.setClassCache(classCache);
         try { // try to set jruby home to jar file path
-             String binfile = RubyInstanceConfig.class.getResource(
-                    
"/META-INF/jruby.home/bin/jirb").toURI().getSchemeSpecificPart();
-             if (binfile.indexOf(".jar!") != -1 && binfile.indexOf("file:") 
!= 0) {
-                 binfile = "file:"+binfile;
-             }
-             config.setJRubyHome(binfile.substring(0, binfile.length() - 
"/bin/jirb".length()));
+            URL home = 
RubyInstanceConfig.class.getResource("/META-INF/jruby.home");
+            if (home.getProtocol().equals("jar")) {
+                config.setJRubyHome(home.getPath());
+            }
         } catch (Exception e) { }
         return config;
     }
diff --git a/Rakefile b/Rakefile
index 2c075f0..90c9b4c 100644
--- a/Rakefile
+++ b/Rakefile
@@ -106,13 +106,21 @@ task :speconly do
   if ENV['SKIP_SPECS'] && ENV['SKIP_SPECS'] == "true"
     puts "Skipping specs due to SKIP_SPECS=#{ENV['SKIP_SPECS']}"
   else
-    test_classpath.each {|p| $CLASSPATH << p }
-    opts = ["--format", "specdoc"]
-    opts << ENV['SPEC_OPTS'] if ENV['SPEC_OPTS']
-    spec = ENV['SPEC'] || File.join(Dir.getwd, "src/spec/ruby/**/*_spec.rb")
-    opts.push *FileList[spec].to_a
-    ENV['CLASSPATH'] = test_classpath.join(File::PATH_SEPARATOR)
-    ruby "-Isrc/spec/ruby", "-S", "spec", *opts
+    # Need to run out-of-proc to ensure CLASSPATH is propagated
+    require 'jruby'
+    inproc = JRuby.runtime.instance_config.run_ruby_in_process
+    begin
+      JRuby.runtime.instance_config.run_ruby_in_process = false
+      test_classpath.each {|p| $CLASSPATH << p }
+      opts = ["--format", "specdoc"]
+      opts << ENV['SPEC_OPTS'] if ENV['SPEC_OPTS']
+      spec = ENV['SPEC'] || File.join(Dir.getwd, 
"src/spec/ruby/**/*_spec.rb")
+      opts.push *FileList[spec].to_a
+      ENV['CLASSPATH'] = test_classpath.join(File::PATH_SEPARATOR)
+      ruby "-Isrc/spec/ruby", "-S", "spec", *opts
+    ensure
+      JRuby.runtime.instance_config.run_ruby_in_process = inproc
+    end
   end
 end
diff --git a/History.txt b/History.txt
index 4ad6636..939e315 100644
--- a/History.txt
+++ b/History.txt
@@ -12,6 +12,7 @@
   path when the RAILS_RELATIVE_URL_ROOT is set. This allows you to
   host your rails app in a location other than the base context path
   of your application. (Ben Rosenblum)
+- Don't use toURI, following changes in JRuby 1.5.6.
 
 == 1.0.3
 
diff --git a/Rakefile b/Rakefile
index 90c9b4c..5500a97 100644
--- a/Rakefile
+++ b/Rakefile
@@ -23,7 +23,7 @@ def compile_classpath
 end
 
 def test_classpath
-  compile_classpath + [File.expand_path("target/classes"), 
File.expand_path("target/test-classes")]
+  compile_classpath + [File.expand_path("target/classes") + "/", 
File.expand_path("target/test-classes/") + "/"]
 end
 
 CLEAN << 'target'
@@ -106,21 +106,13 @@ task :speconly do
   if ENV['SKIP_SPECS'] && ENV['SKIP_SPECS'] == "true"
     puts "Skipping specs due to SKIP_SPECS=#{ENV['SKIP_SPECS']}"
   else
-    # Need to run out-of-proc to ensure CLASSPATH is propagated
-    require 'jruby'
-    inproc = JRuby.runtime.instance_config.run_ruby_in_process
-    begin
-      JRuby.runtime.instance_config.run_ruby_in_process = false
-      test_classpath.each {|p| $CLASSPATH << p }
-      opts = ["--format", "specdoc"]
-      opts << ENV['SPEC_OPTS'] if ENV['SPEC_OPTS']
-      spec = ENV['SPEC'] || File.join(Dir.getwd, 
"src/spec/ruby/**/*_spec.rb")
-      opts.push *FileList[spec].to_a
-      ENV['CLASSPATH'] = test_classpath.join(File::PATH_SEPARATOR)
-      ruby "-Isrc/spec/ruby", "-S", "spec", *opts
-    ensure
-      JRuby.runtime.instance_config.run_ruby_in_process = inproc
-    end
+    test_classpath.each {|p| $CLASSPATH << p }
+    opts = ["--format", "specdoc"]
+    opts << ENV['SPEC_OPTS'] if ENV['SPEC_OPTS']
+    spec = ENV['SPEC'] || File.join(Dir.getwd, "src/spec/ruby/**/*_spec.rb")
+    opts.push *FileList[spec].to_a
+    ENV['CLASSPATH'] = test_classpath.join(File::PATH_SEPARATOR)
+    ruby "-Isrc/spec/ruby", "-S", "spec", *opts
   end
 end
 
diff --git a/pom.xml b/pom.xml
index 83dc0f5..a516d9a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -4,7 +4,7 @@
   <modelVersion>4.0.0</modelVersion>
   <groupId>org.jruby.rack</groupId>
   <artifactId>jruby-rack</artifactId>
-  <version>1.0.4.dev-SNAPSHOT</version>
+  <version>1.0.4</version>
   <name>JRuby-Rack</name>
   <url>http://jruby-rack.kenai.com/</url>
   <description>
@@ -13,7 +13,7 @@
   </description>
 
   <properties>
-    <jruby.version>1.5.1</jruby.version>
+    <jruby.version>1.5.6</jruby.version>
   </properties>
 
   <issueManagement>
diff --git a/src/main/ruby/jruby/rack/version.rb 
b/src/main/ruby/jruby/rack/version.rb
index b60f12b..397150d 100644
--- a/src/main/ruby/jruby/rack/version.rb
+++ b/src/main/ruby/jruby/rack/version.rb
@@ -7,6 +7,6 @@
 
 module JRuby
   module Rack
-    VERSION = "1.0.4.dev-SNAPSHOT"
+    VERSION = "1.0.4"
   end
 end




[jruby-rack~main:cfdb3015] Preparing for 1.0.4

nicksieger 12/08/2010

<Possible follow-up(s)>

[jruby-rack~main:cfdb3015] Preparing for 1.0.4

nicksieger 12/08/2010
  • Mysql
  • Glassfish
  • Jruby
  • Rails
  • Nblogo
Terms of Use; Privacy Policy;
© 2010, Oracle Corporation and/or its affiliates
(revision 20120518.3c65429)
 
 
Close
loading
Please Confirm
Close