Archive for gem_server

Why You Should Install Ruby On Rails using RubyGems

Initially when doing Ruby on Rails development, I set it up on my IBM ThinkPad R52 laptop. Ran the expected sudo apt-get install ruby rails. Sure that got me a Rails environment to play with. But to be honest, it wasn’t the best solution.

My suggestion is to install Ruby on Rails using RubyGems. Why?

  • Easier to maintain your Ruby on Rails version
  • Easier access to Rails and related projects documentation via ri and gem_server
  • Includes Rails and related projects into your path

Maintain your Ruby on Rails installation

RubyGems is the Ruby package management solution for Ruby applications. Since it’s there, why not use it?

When installing via apt-get, I am stuck to the latest version available on the Ubuntu repository for my distribution. That may just be the 1.1.x line. Similarly it may have additional patches applied to it, so it may not even be a pristine 1.1.x. You are just not sure.

When Ruby on Rails moves up a version, perhaps due to new features, or security issues, you may just have to stay on your current one. Until you decided to upgrade your distribution, and well. Let’s hope this time it will stay up to the latest release.

With RubyGems you can select which version of Rails you want. Need 1.1.6? No problem. Also need to run the latest 1.2.3? Can do. Both at the same time. So you may have a legacy application running on an older version of Rails, and still mess around with the latest version.

Here is the current scenario with Typo. Typo requires an older version of Rails (1.2.0), which similarly has dependencies on older versions of ActionMailer (1.3.0), ActionPack (1.13.0), ActionWebService (1.2.0), ActiveRecord (1.15.0), and a multitude of other libraries. Now I like to experiment with the latest version of Rails (1.2.3), but it also uses has newer versions of the libraries.

This is doable thanks to goodness RubyGems. Else it would be difficult.

Access to documentation via ri and gem_server

Ruby Information

ri is a great tool. Quick access to ruby documentation via the command line. Want to know what ActiveRecord::Base does? No problem! Fire up the terminal and enter:
ri ActiveRecord::Base

Can it be even simpler?
RubyGem Documentation Index

Once you’ve installed RubyGems, you get an application called gem_server. gem_server similarly helps to provide documentation, except this time it is accessible via the browser. So start gem_server up via the command line, and then access http://localhost:8808/.

For even easier access, since you are using a browser, just bookmark the regular documentation that you use!

Note: These two use the same documentation, so there is nothing unique about them.

Includes Rails and related projects into your path

This allows you to easily experiment and implement the libraries in other projects besides Rails. To include ActiveRecord, when ever and where ever you want, do like so:

Conclusion

So if you have the opportunity, I recommend using installing it via RubyGems. Honestly, it makes life so much simpler.

Comments