Richard Bucker

My Ruby Installation

Posted at — Jan 21, 2012

[update 2012-01-22] A new project is underway. ‘crud-fest-rb’ it’s part of a new story I’m writing. I just tried to launch a new rails project and I was blocked because I was missing some basic gems. They are now in the list below. The names are: jquery-rails, coffee-rails, sass-rails, uglifier. My empty RubyMine/rails-3.2 project is now running. The CRUD comes next.[update 2012-01-21] I just published this article a few hours ago and I realized that I forgot some stuff. I forgot to mention that I need Twitter’s Bootstrap project here too. So when I start working on my first project I’ll need to import Bootstrap. I might have missed a few more things… I have been following python and many of the python libs longer than ruby so that makes sense. If you have any recommendations send them on. PS: TextMate is getting an update soon but I think I’m going to install and use RubyMine from It’s like PyCharm, also from but for Ruby and supports Rails. (hopefully Rails 3.2). Like PyCharm, RubyMine support RVM out of the box. Nothing special required.I’m not a great fan of Ruby. I was in the beginning when I was first introduced to Spring. And it was not so much Ruby as it was Rails. The fact that it did all the CRUD one could want was a big deal. Now it’s not that uncommon. Django offers CRUD for python app developers and Grails offers CRUD for java developers.Reddit recently linked to a visual comparing python, ruby and php. There were some interesting observations about the number of programmers and projects in each vertical. That combined with my new love for RVM has given Ruby a new lease on life in my toolkit. (I have also worked on professional Ruby projects but without RVM they were no fun).RVM is a big deal. Not unlike virtualenv for python, RVM allows the programmer to install and configure his/her development environment in userspace. This means that many of the fears I had about creating my dev environment on my local hardware and version collision and dependency mismatch means that all I really need to do is create a separate user directory on my laptop for each project. This way everything is nicely partitioned and what I can focus on is backups rather than the crazy live of remote virtual servers for development. Of which there is still some value for demonstrations and client access.So let’s setup a basic RVM install so that we can start our next project. Some of the installation is going to overlap with the python installation (here). You can skip all of the userspace installation but the sudo installation is all you’ll need. Keep in mind that this installation was all about a virtual server at RackSpace. If you are installing on a Mac or Windows machine your install will be different.Install the default ruby. I originally thought that I’d need to install at least one Ruby installation in the core OS but it turned out to be unnecessary. RVM will install any version of ruby for you. Once RVM is installed you can issue the command (rvm list known) and you’ll get a list of the known rubies available. In fact I had to remove this package and start again because of some side effects down the road.apt-get install ruby1.9.1Install RVMbash -s stable < <(curl -s RVM… you can logoff and back in or you can look at the last line of your ‘.profile’ and execute the source command.source “/home/rbucker/.rvm/scripts/rvm”NOTE: I did some looking at the .rvm directory and I saw some things that did not make sense.  It seems that many of the modules and ruby artifacts were being installed in a ruby folder labeled 1.9.1 presumably that was a ruby version. I have restarted the install process several times now and it appears that RVM is installing my version of ruby 1.9.3-p0 as a set of patches over version 1.9.1 which explains the folder structure.install a recent Ruby versionrvm install 1.9.3-p0Make this version current (you will have to run this command every time you login)rvm use 1.9.3-p0If you want to make this version of ruby the default version run this command (note the default command will insure this version of ruby os ready each time you login)rvm use 1.9.3-p0 –defaultwhich rubies are installed and which is currentruby listinstall some gems in userspace. Note that rvm is taking over the gem install. Lucky for me Rails 3.2 was released a few days ago and now it’s installing. I’ve elected to install Sinatra too. That’s because it’s a useful micro framework when rails is just too much.gem install railsgem install jquery-railsgem install coffee-railsgem install sass-railsgwm install uglifiergem install sinatragem install redisgem install mongodbgem install pggem install mustachegem install fastercsv gem install iso8583gem install sqlite3gem install ruote gem install jsongem install sxpgem install sexpgem install zmqgem install beanstalk-clientgem install rmregem install hamlgem install db-charmergem install mailgem install activemerchantgem update money rack rake sourcify sprockets**there were some initial difficulties installing the ‘pg’ gem. It started off as a problem because the install would not complete. I kinda realized that I was missing the postgres dev files so I installed that core package as the root user. When I installed the gem on my OSX machine it installed nicely. I’m not certain I know why or how the postgres client was installed on my OSX machine but it seems to have included enough code to compile the gem. MacPort was not installed on either machine or maybe it was corrupted because it’s not functioning and I’d swear that it was installed once before.**one other thing that is concerning me is the version number of the ZMQ gem. If the version number maps to the version of the main lib then they are mountains apart and that’s something I cannot afford. It’s one of the reasons that I’m going down the path of RVM and native gem management. Some interesting notes; the version of the GEM is 2.0.7 and when you run ZMQ.version() from the IRB you get different results so it must be checking the binary libs.On my OSXrbucker@rmac[usr]$ irb1.9.3-p0 :001 > require ‘zmq’ => true1.9.3-p0 :002 > ZMQ.version() => [2, 1, 10]On my Ubunturbucker@soldev:~$ irb1.9.3-p0 :001 > require ‘zmq’ => true1.9.3-p0 :002 > ZMQ.version() => [2, 1, 11]install gems for building gems. I do not know anything about them except that I hope that they work.  I’ve installed all three because they should not collide. There is a 4th and 5th option.  There are some devs that have github general templates that they use. You can always roll your own in a similar way. Personally I’m interested in these 3 projects because it might mean less editing for me.gem install jewelergem install hoegem install echoeAt this point I’d create my bare bones project, install bootstrap just like the python version, and then start hacking my project.Reference material: I really like They seem to have the most current docs. Their PDF and epub ebooks are great and they keep me updated. (Rails 3.2 was just released and their eBook was also updated just a few days later; granted not much was supposed to have changed, but still).In the coming week I’ll be writing an article on the CRUD-fest in django and rails as I start building my credit card association test harness. Stay tuned as this page will be updated as I add gems to my basic installation.