Articles tagged 'rvm'

  • Using RVM within a cron job

    December 16, 2011


    This post was originally published in the Rambling Labs Blog on December 16, 2011.


    Long time no post! I’ve been really busy these days with some projects. Yet, here I am again, so here it goes.

    A couple of days ago, I started working on a big story in one of those projects I’m currently working on. It’s one of those things that needs to be run a couple of times a day… yeah, a scheduled background job.

    Basically, what it need to do is check some database records, check their expiration date against the current date, and take some actions for each one of the expired ones. Simple enough, right?

    I went ahead and wrote a rake task that would do the heavy work. Something like this:

    task :check_expired_records do
      Record.where('expired...

    Continue Reading →

  • Rails 3.1 "rails console" fails with "no such file to load -- readline"

    October 12, 2011


    This post was originally published in the Rambling Labs Blog on October 12, 2011.


    Yesterday, I was trying to run the rails console command on Ubuntu with ruby 1.9.2 and rails 3.1, without any success. I was getting a no such file to load -- readline error. This kind of error was sort of familiar for me (I had the common no such file to load -- zlib and the not so common no such file to load -- openssl a while ago). So this was probably another package that I was missing.

    Turns out that as I found in a Stack Overflow question, I needed the libreadline-dev, which I didn’t have installed. But I also needed to recompile ruby, seriously!?

    This is where rvm comes to the rescue, and why I love so much to have rvm installed :D. You only need...

    Continue Reading →

  • Updating and/or uninstalling all installed gems

    October 8, 2011


    This post was originally published in the Rambling Labs Blog on October 8, 2011.


    I like to have an rvm gemset (see more about rvm) with the latest versions of all gems and I usually use this as my sandbox for testing out the latest features and issues of the gems. To update one gem to it’s latest stable version, you just have to run this:

    gem update GEMNAME
    

    The only problem is that for updating every gem you have installed, you have to remember each and every gem you have installed to pass it to the command… Nah, I’m just kidding. Just run the following command, and you’ll be fine:

    gem update `gem list | cut -d ' ' -f 1`
    

    UPDATE

    To uninstall all installed gems, it’s the same command with uninstall instead of update, like this:

    gem...

    Continue Reading →