dev@glassfish.java.net

Re: [PATCH] Merb environment

From: Vivek Pandey <Vivek.Pandey_at_Sun.COM>
Date: Thu, 20 Nov 2008 09:18:17 -0800

Thanks Nick! It has been applied to the jruby connector trunk as part of
fix for the bug: https://glassfish.dev.java.net/issues/show_bug.cgi?id=6767.

-vivek.
Nick Sieger wrote:
> (Resent from internal alias. Posting here for posterity.)
>
> I found that with the glassfish gem, it wasn't picking up the
> --environment option on the command line, and was always running Merb
> in development mode. This patch appears to fix that, and I also found
> an extraneous method that I nuked (take or leave that part if you want).
>
> Cheers,
> /Nick
>
> diff --git
> a/grizzly/jruby/src/main/java/com/sun/grizzly/jruby/rack/MerbApplicationFactory.java
> b/grizzly/jruby/src/main/java/com/sun/grizzly/jruby/rack/MerbApplicationFactory.java
>
> index 41b963a..ebf96ab 100644
> ---
> a/grizzly/jruby/src/main/java/com/sun/grizzly/jruby/rack/MerbApplicationFactory.java
>
> +++
> b/grizzly/jruby/src/main/java/com/sun/grizzly/jruby/rack/MerbApplicationFactory.java
>
> @@ -60,15 +60,4 @@ public class MerbApplicationFactory extends
> DefaultRackApplicationFactory{
> return
> runtime.evalScriptlet("Rack::Handler::Grizzly.new($merb_app)");
> }
>
> - private Ruby setupRails(org.jruby.Ruby runtime) {
> - LoadService loadService = runtime.getLoadService();
> - runtime.evalScriptlet("ENV['RAILS_ENV'] = '" +
> System.getProperty("rails.env") + "'");
> - // load rails
> - loadService.require(appRoot + "/config/init");
> - loadService.require(appRoot + "/config/environment");
> - runtime.evalScriptlet("require 'rack/handler/grizzly'");
> - return runtime;
> - }
> -
> -
> }
> \ No newline at end of file
> diff --git a/grizzly/jruby/src/main/resources/jruby/rack/merb.rb
> b/grizzly/jruby/src/main/resources/jruby/rack/merb.rb
> index 0ac8270..3b58ea7 100644
> --- a/grizzly/jruby/src/main/resources/jruby/rack/merb.rb
> +++ b/grizzly/jruby/src/main/resources/jruby/rack/merb.rb
> @@ -28,6 +28,7 @@ Merb.disable(:signals)
>
> # Start merb
> Merb.start({
> + :environment => java.lang.System.getProperty("rails.env"),
> :merb_root => $glassfish_appRoot,
> :adapter => "grizzly",
> :log_level => log_level,
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: dev-help_at_glassfish.dev.java.net
>