Mixing Ruby/JRuby while developing a rails app?

I’ve been trying to find a good answer to this, but have been coming up
empty handed…

I love JRuby and have one production rails app out there using it now,
with
a second on the way. My question, however, is about using the good 'ol
MRI
for commands like “./script/generate …” while developing, to create
your
models, controllers, etc. The reason is simply that when executing a
script
from the command line, the MRI is nearly instant, while JRuby has the
overhead of the jvm start-up. I know, it’s only a few seconds, but I
hate
waiting.

Are there any known problems with using MRI to execute those commands,
when
you’re planning on using JRuby in your deployment environment?

Thanks,
M@

Hi,

I have been doing something very similar myself in the past and have
had no issues. But since writing my own JRuby specific commands (uses
JDBC), I have gone back to using JRuby completely for all commands.

I believe that JRuby 1.4 will improve the overall startup time, so you
may find yourself going back as well.

Regards
Matthew W.

On 17/09/2009, at 12:46 PM, M@ Hunter wrote:

you hurt the hill…" -Anon


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

For as long as I’ve been a JRuby user, my workflow has always included
MRI.
The only time I drop into JRuby while developing is in testing (I also
run
tests in MRI). But when it comes to using the script/* commands, I’m
almost
always running under MRI.

Rich

On Thu, Sep 17, 2009 at 04:46, M@ Hunter [email protected]
wrote:

I normally have a “ruby” environment which is just the same as the
development one, but in the database.yml the adapter is mysql instead of
jdbcmysql

$ ln -s config/environments/development.rb config/environments/ruby.rb
$ more config/database.yml
(…)
development: &devel
(…)
adapter: jdbcmysql

ruby:
<<: *devel
adapter: mysql
(…)

In 99,9% of times your jruby code will be compatible with ruby (the
other
way is a different thing as all we know [0])

[0] http://isitjruby.com/

I remember reading a blog post about Oracle Mix (JRuby on Rails, Ola
Bini
was one of the developers), as I remember it, they used MRI up until
deployment. I guess if Ola does it that way, the rest of us will be
fine.
//Peter

I normally make the database driver dependent on the ruby engine.
Recently I found a few issues with RUBY_ENGINE not being defined,
so we falled back into the following configs.
The work for ruby and jruby, just make sure you have the correct drivers
installed on each runtime.
In this case this mean installing the mysql gem into ruby 1.x, and
jdbc-mysql, activerecord-jdbc-adapter, activerecord-jdbcmysql-adapter
for jruby.

development:
adapter: <%= “jdbc” if defined?(JRUBY_VERSION)%>mysql
encoding: utf8
reconnect: false
pool: 5
host: 127.0.0.1
username: hahaha
password: youwish
database: mydb

Luis Landeiro R.

Jesús García Sáez wrote:

the good 'ol MRI for commands like "./script/generate ..." while
M@

(…)

In 99,9% of times your jruby code will be compatible with ruby (the
other way is a different thing as all we know [0])

[0] http://isitjruby.com/


To unsubscribe from this list, please visit:

http://xircles.codehaus.org/manage_email

On Thu, Sep 17, 2009 at 13:06, Luis Landeiro R.
<[email protected]

wrote:

adapter: <%= “jdbc” if defined?(JRUBY_VERSION)%>mysql
encoding: utf8
reconnect: false
pool: 5
host: 127.0.0.1
username: hahaha
password: youwish
database: mydb

Very nice way, much better than mine, thanks.