Getting started with Jruby is easy:

Install jruby via rvm:  "rvm install jruby; rvm use jruby"

We have something like this in the Gemfile for our app:

platforms :jruby do
  gem 'activerecord-jdbc-adapter'
  gem 'jdbc-mysql'
  gem 'jruby-openssl'
end

platforms :ruby do
  gem 'mysql2'
end

then you just "bundle install" and "gem install trinidad", and run "trinidad
-t" and its just like running "rails server".  (The -t param tells jruby to
use multithreaded mode, with only one copy of the app handling requests via
multiple threads. If some aspect of your app is not threadsafe (doubtful
these days), leave off the -t and it will start up multiple instances of the
app a la Mongrel).

We have found that if you give it enough RAM (like anything related to Java)
the performance is great, on par with Passenger.

As for downsides, we have bumped our knees on some rough edges, no doubt
about that, but you trade that time and effort off against the time saved by
not having to write your own spreadsheet editor and you will most likely
come out way ahead in the end.


Regards,

John Lynch
Rigel Group, LLC
[email protected]
Mobile: 760-515-2653
Skype: johnthethird






On Wed, Jun 8, 2011 at 9:18 PM, Chris McCann <[email protected]> wrote:

> John,
>
> Thanks as always for the sage advice.  Looking at both Trinidad and
> Torquebox they certainly seem mature enough for what I'm trying to do.
>
> One question, though.  Having never used JRuby are there any downsides
> to using it for a Rails app?  Performance, gems, learning curve, etc?
>
> I will be researching JRuby extensively as the Apache POI project
> seems superb and the spreadsheet functionality is a key feature of the
> app I'm prototyping.
>
> Oh, and for anyone else wondering about the phrase "bog standard",
> have a gander: http://www.phrases.org.uk/meanings/bog-standard.html
>
> Cheers,
>
> Chris
>
> On Jun 8, 8:09 pm, John Lynch <[email protected]> wrote:
> > Chris, you can run a bog standard Rails app with the Trinidad gem,
> > which runs your app in a jruby/tomcat environment, and then you can
> > call any arbitrary java class directly from ruby. We have used this to
> > integrate to BIRT reports among other java-esque things. It's awesome.
> >
> > For a more enterprise class deployment check out Torquebox, which
> > gives your rails app easy access to lots of java goodies like message
> > queues and async processing.
> >
> > The biggest issue we have run into deploying rails apps in java
> > containers is making sure the jars are all in the right place.
> >
> > - John
> > [email protected]
> >
> >
> >
> >
> >
> >
> >
> > On Wednesday, June 8, 2011, Chris McCann <[email protected]> wrote:
> > > As a follow-up to my previous post about manipulating spreadsheets
> > > natively in Ruby I figured I'd spread the word on what I learned.
> >
> > > The ruby spreadsheet gem is nice but it lacks one key feature: it
> > > doesn't support recalculating formulas in a spreadsheet after a
> > > dependent value has changed.  This is a show-stopper for my app as I
> > > need to allow users to change values that drive numerous formulas and
> > > immediately see the results of the recalculations.
> >
> > > I have been in touch with Zeno Davatz, who seems to manage the gem,
> > > and it appears that this capability is slated for a release down the
> > > road but not anytime soon.
> >
> > > I tried using the google_spreadsheet gem.  This actually sort of
> > > worked, with one key issue.  I could interactively modify a Google
> > > spreadsheet in my Google Docs account and see the values update
> > > immediately.
> >
> > > The problem is the "local" ruby copy of the spreadsheet doesn't
> > > reflect updates to formula values until you re-synchronize the in-
> > > memory copy of the spreadsheet with the one on the server, and that
> > > seems to take anywhere from 5-10 seconds, a non-starter for UX
> > > reasons.  Also, google_spreadsheets has a limit of 256 columns (and
> > > some limitations to the functions you can use) but I could live with
> > > that.  The formula refresh delay -- not so much.
> >
> > > I also looked into Windows-based solutions, thinking I might be able
> > > to write a web service my Rails app could hit but that seemed over the
> > > top, not to mention prohibitively expensive when you add in Windows
> > > and SharePoint costs, hosting, etc.
> >
> > > There is a SpreadScript excel calculation engine product out there,
> > > but it only supports Python, Perl and Tcl, so again I'd have to write
> > > a web service or wrapper to use it.  Ouch.  And it costs $995 to
> > > deploy, so double Ouch.
> >
> > > Someone suggested JRuby wrapping a Java API.  That sounded much more
> > > like what I was after.  I found the Apache POI project, which enables
> > > interaction with MS Office documents like Excel spreadsheets.  I built
> > > a little Java test app today and voila, formulas that update
> > > instantly!
> >
> > > Of course, now I have to figure out how to make use of this
> > > capability, which brings me to a question:  can anyone suggest a good
> > > way to use JRuby in a Ruby-based Rails app to make use of the Apache
> > > POI Java project?  Am I back to trying to write a web service?
> >
> > > Any suggestions would be greatly appreciated!
> >
> > > Cheers,
> >
> > > Chris
> >
> > > --
> > > SD Ruby mailing list
> > > [email protected]
> > >http://groups.google.com/group/sdruby
>
> --
> SD Ruby mailing list
> [email protected]
> http://groups.google.com/group/sdruby
>

-- 
SD Ruby mailing list
[email protected]
http://groups.google.com/group/sdruby

Reply via email to