For my very first installation I’ve ever made of Ruby and Ruby on Rails I’ve used MacPorts. But doing it this way was not so satisfying. Than I stumbled upon RVM and finally found what I was looking for. From the RVM homepage:

“RVM is a command line tool which allows us to easily install, manage and work with multiple ruby environments from interpreters to sets of gems.
[...]
RVM allows users to deploy each project with its own completely self-contained and dedicated environment–from the specific version of ruby all the way down to the precise set of required gems to run the application.
[...]
RVM reduces the complexity that is the many facets of ruby development through its command line API. RVM allows you to have **identical** self-contained environments in your Development, CI, Q/A, Staging, and Production environments.”

Great! :)

So here’s how I set up my RoR playground on my Mac OS X 10.6.8.

Open Terminal or iTerm and digit as follows

kevin$ bash < <(curl -s https://rvm.beginrescueend.com/install/rvm)

than close your terminal and open your

~/.bash_profile

file. If it does not exist, create it and add at the end the following line

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

Now open your console and check whether the installation was successfully performed

kevin$ type rvm | head -n1

It’s good practice to update to the head version of RVM. I tried using the update command but it seems it does not exist anymore.

kevin$ rvm update --head
ERROR: rvm update has been removed. See 'rvm get' and rvm 'rubygems' CLI API instead

so I used the get command instead

kevin$ rvm get head

and it worked.

Rails 3 requires at least Ruby 1.8.7 but seems to work best with the 1.9.2 one. Let’s install both versions so we can switch from one to the other and back.

kevin$ rvm install 1.8.7
kevin$ rvm install 1.9.2

Both will require some secs.

Now let’s use a version of Ruby and set it as the default, passing it the –default option

kevin$ rvm use 1.9.2 --default
Using /Users/kevin/.rvm/gems/ruby-1.9.2-p180

Next create a gemset, which will make available different gems for different versions

kevin$ rvm gemset create rails3
'rails3' gemset created (/Users/kevin/.rvm/gems/ruby-1.9.2-p180@rails3).

Now let’s get ready to install some Ruby gems using RubyGems. Since Rails is distributed as a gem, we will use RubyGems to install it. Download RubyGems, unpack it and then from the rubygems directory run

kevin$ ruby setup.rb

This will install RubyGems. Before going on, update it using

kevin$ gem update –system

kevin$ gem install rails -v=3.0.1

or

kevin$ gem install rails --version 3.0.1

To check gem installation execute

kevin$ which gem
/Users/kevin/.rvm/rubies/ruby-1.9.2-p180/bin/gem

Set a default rvm and default gemset

kevin$ rvm use 1.9.2@rails3 --default
Using /Users/kevin/.rvm/gems/ruby-1.9.2-p180 with gemset rails3

Let’s check the consistency of the installed versions of Ruby and Rails:

kevin$ ruby --version
ruby 1.9.2p180 (2011-02-18 revision 30909) [x86_64-darwin10.8.0]
kevin$ rails --version
Rails 3.0.1

Now we are ready to start playing with our RoR environment.


My little EC2 instance runs with CentOS. In these days I need to set up my own version control system but I’m tired of using the same old Subversion…so, why not taking the chance to try “the fast version control system”: Git.

Here’s a quick installation guide:

0. Prerequisites: execute a yum update and then install GCC if not already installed

sudo yum -y update
sudo yum install gcc

1. Dependencies: install the needed dependencies and the module to add the additional target to the Makefile generated by ExtUtils::MakeMaker

yum install gettext-devel expat-devel curl-devel zlib-devel openssl-devel perl
sudo yum install perl-ExtUtils-MakeMaker-Coverage.noarch
sudo yum install perl-ExtUtils-MakeMaker

2. Download: download the tar and extract the files

wget http://kernel.org/pub/software/scm/git/git-1.7.4.1.tar.gz
tar -zxvf git-1.7.3.tar.gz

3. Build and install

./configure
make
make install

That’s all!


Are you the next Mario?

Improve and improve…

http://www.joystiq.com/2010/11/28/kinect-hacked-into-super-mario-bros-emulator-controller/


Is it so hard to make employees happy?

“Google Inc.’s decision to give all of its 23,300 employees a 10% pay raise next year — and a $1,000 bonus to boot — is just the latest volley in what has become a full-fledged war for top Silicon Valley talent.” Read the full story here: http://www.latimes.com/business/la-fi-silicon-pay-war-20101111,0,5173884.story


Powered by WordPress and theme PlainMagic.
Copyright © 2010 The Granma's garage