Home > ruby, ubuntu > Installing the Ruby Version Manager and some gems

Installing the Ruby Version Manager and some gems

Problem

I wanted to try the Ruby script redcarpet. Since I’ve never used Ruby, I had serious problems with installing it… Fortunately ndbroadbent gave me a hand and provided a step-by-step description how to get it done. So here is what I learned.

Solution

The “easiest” way is to install RVM, the Ruby Version Manager. RVM lets you run multiple versions of Ruby, and each Ruby can set up its own environment. RVM facilitates the installation of gems and takes care of all the PATH and GEM_HOME stuff automatically. Note that if you ever need to install any more gems, don’t use sudo anymore. Just run ‘gem install <gem_name>‘.

Installing RVM and the redcarpet gem ($ is the prompt):

$ bash < # the installer added this line to ~/.bash_profile:
# [[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"
# let's source it:
$ source ~/.bash_profile
$ rvm install 1.8.7
$ rvm use --default 1.8.7
$ gem install redcarpet

Now you should be able to run redcarpet, which is a Ruby interface to the upskirt library, the library that is used at GitHub to render markdown texts.

Alternatives
You can use the “markdown” command, which is the classical implementation of the markdown “language”, or you can also use the upskirt project, which is the reference implementation of the GitHub flavored markdown. Redcarpet is just a wrapper around upskirt.

Update: there is also a Python wrapper for upskirt called pantyshot.

  1. No comments yet.
  1. No trackbacks yet.

Leave a comment