Tuesday, January 17, 2012

Compiling Rails project for distribution in a WAR file with JRuby

I recently started using JRuby for a Rails project and overall the experience has been excellent.  Using RVM, you can just switch to jruby to build a new project (rvm use jruby), and just about everything will work the same.  One of the big features of JRuby is that you can bundle your entire app, including JRuby itself, in to a WAR file that Java servers like Tomcat and Glassfish can serve up, so your app can be distributed on to servers that only have Java.

After you have JRuby installed, simply install the gem warbler.  You'll then get a command line tool, warble, to generate war files from your project.  Simply run warble from your project's directory, and a war file will be produced.  It's as easy as that!

Another great feature is that the Ruby code can be compiled down to Java class files, so your source code is not visible.  This is great for distributing on to a server where other companies will have access that you don't want seeing your source code.  However, this is not working for me.  Warbler should support this, just run "warble compiled war" from the command line in your projects directory instead of "warble".  This will produce a war file with both .rb and .class files.  The .rb files however are simply stubs that require the .class file, none of your code is in there.  But, for me, it's not generating .class files on all of my controllers.  I've entered an issue for this at https://github.com/jruby/warbler/issues/72.


I will be making another post on how to do database migrations on the server you're deploying to.

12 comments:

Priya Rathod said...

It is very hopeful, what I see and read here can provide insight for me and other friends.
AWS Training in Hyderabad
AWS Course in Hyderabad

Bhuvana said...

Wow, cool post. I'd like to write like this too - taking time and real hard work to make a great article...

Data Science Training in Hyderabad

Tamil novels said...

Thank you for sharing this wonderful article.
Tamil novel writers
Ramanichandran novels PDF
srikala novels PDF
Mallika manivannan novels PDF
muthulakshmi raghavan novels PDF
Infaa Alocious Novels PDF
N Seethalakshmi Novels PDF
Sashi Murali Tamil Novels PDF Download


Ava said...


Great article this is really informative and innovative: with new updates.with new updates. It was really valuable. Thanks a lot. Travelers can easily apply for Indian visa online. The Government of India has provided an easy-to-use method to apply for an Indian Visa.

jacobalexander said...

I thought I was familiar with this blog, but after checking through some of the posts, I realized it's actually a brand new one to me. Anyway, I am definitely glad I found it and I will bookmark it and come back often. 10 year Indian visa for US citizens, You can apply 10 year India visa online

jacobalexander said...

After looking through some of the posts I realized it was a new blog for me. Anyhow, I am delighted I found it and will return soon. 10 year Indian visa for US citizens, You can apply for a 10 year Indian visa online.

Albert said...

Good morning everybody.. Your article is more useful for all the people. Thank you sir.. Many people query What is Indian visa service fee? Visa fee depends on your nationality and your visa duration. You can read all other information about the Indian e-visa on our India eVisa page. We have explained all requirement on our page....

Maria Baby Thomas said...

Hello sir, thanks for the amazing post. Planning a holiday in India. Is indian e visa open ,yes India visa open you can now apply for India visa online.


Jack Dnial said...

Thanks for sharing this blog, this blog is very useful information for everyone.We provide Complete solutions for BPO Services, If you have any query related to Support services then visit our website and will get complete information related to your query.

Olivia John said...

I read your blog and found many interesting metrics in this material. Thanks for sharing it on the Internet. Person who is willing to visit Turkey can apply for a Turkey visa which is a totally online process. Fill the application form, make payment & receive it in email. As simple as that.

Seian Tosty said...

Wow you have nice content on your page. Your audience will enjoy it while they are read. Turkey visitors can apply e visa of Turkey online from anywhere in the world. The process is easy and convenient which saves your time & money.

Johny Clark said...

I find your blog consistently captivating! The way you effortlessly intertwine profound insights with eloquent storytelling is akin to embarking on a meticulously planned journey through a world of knowledge, artfully designed for diverse readers. Your knack for making intricate ideas accessible is genuinely remarkable. Furthermore, I'd like to provide important information about the VFS Global office in Riyadh, facilitating visa and consular services for Canada.VFS Global Riyadh Canada serves as a crucial facilitator for Canadian visa and immigration services. It provides efficient and streamlined processes for Saudi nationals seeking to travel, study, work, or immigrate to Canada.