Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where to start for Jruby on rails?

Any tutorials or blog are available to start with JRuby on Rails
which guide me to the installation and small JRuby on Rails application ? I have gone through this Walkthroughs And Tutorials(https://github.com/jruby/jruby/wiki/WalkthroughsAndTutorials) link but most of the JRuby on Rails links are broken.

like image 834
krunal shah Avatar asked Mar 27 '12 07:03

krunal shah


People also ask

Is JRuby faster than Ruby?

In a 2007 benchmark of Ruby implementations, JRuby was faster than Ruby MRI 1.8 in some tests, but YARV outperformed both of them. As of April 2014, in The Computer Language Benchmarks Game, JRuby 1.7. 4 typically has the same performance as Ruby MRI 2.1. 0, but uses more memory.

Is JRuby fast?

The JVM makes different performance trade-offs than MRI Ruby. Notably, an untuned JVM process has a slow start-up time, and with JRuby, this can get even worse as lots of standard library code is loaded on start-up.


1 Answers

JRuby and Rails Installation

The easiest way to set up JRuby is using rvm. The following command installs rvm, the latest version if JRuby, and gets the latest version of rails:

$ curl -L https://get.rvm.io | bash -s stable --autolibs=3 --ruby=jruby --gems=rails

On Windows, you can download an installer which will set up JRuby for you. You then need to install rails by running the following command:

jruby -S gem install rails

Set up a Rails project

JRuby’s wiki page JRuby on Rails is a great collection of resources on the topic; it contains in particular a link to that good blog post: http://blog.rubyrockers.com/2011/03/rails3-application-jruby/

In a nutshell, to create a rails project based on JRuby, use the following command, replacing my_app with the name of your project:

rails new my_app -m https://www.jruby.org/templates/default.rb

Rails Development

Once your project is set up, any Rails 3 tutorial will do — it is Ruby after all!

Deployment

For deployment, have a look at:

  • “specific” solutions like Torquebox or Trinidad,
  • or warbler to package your app as a war and deploy in traditional Java app server (WebSphere, Weblogic, etc.).

Further Resources

Finally, it is also worth mentioning that Charles Nutter et al's book Using JRuby has a chapter dedicated to JRuby on Rails, and is an invaluable help in JRuby developments.

like image 126
Sébastien Le Callonnec Avatar answered Oct 14 '22 09:10

Sébastien Le Callonnec