It’s been a while since my last post. I’ve changed jobs and have been busy learning a lot. I’ve changed from a Windows desktop environment to an Ubuntu desktop environment, from Coldfusion /Java to Java / PHP / Ruby, and from developing websites to developing complex gis web applications. I’ve been involved in a couple research projects involving RETS and Elastic Search. I’ve also had the pleasure to be involved in a NodeJS project. Most importantly, I’ve been given the chance to do some real Ruby programming.
It all started with a Java project for Elastic Search. I started creating small Sinatra wrapper apps for working with the different web services that were going to be involved in the project. Eventually, I had enough code to put together the app that I needed. Using JRuby and Warbler made it possible to deploy my application to Tomcat like a standard Java web application.
I currently use RVM (Ruby Version Manager) to control my rubies. In my project directory, I create an .rvmrc file that contains the Ruby and gemset that I want to use for that project (e.g. rvm use jruby@myprojectname —create). Installing jruby through RVM (rvm install jruby) and using it as my current Ruby (rvm jruby) enables me to use Java with my Ruby and be able to analyze what gems I will be able to use on Tomcat.
Warbler allows me to package up my web application into a war file so that it can be deployed to Tomcat. In order to package my project into a war, I just need to execute the warble command in the root of my project.
Deployment is made simple with Tomcat’s hot deploy feature. I just have to place the war file into the webapps folder on the server and it is automatically deployed. To do this, a simple rake task will do.
Net::SFTP.start(host, user, options) do |sftp| sftp.upload(warfile, 'path/to/webapps/warfile') end
It’s been fun finally getting to do some real Ruby development. I hope that this trend continues.