Sunday, April 8, 2012

Setup RVM + Ruby + Rails + Gemset

Setup rvm  

  1. sudo apt-get install curl git-core
  2. copy/paste following lines in terminal
    bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer )
    echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm" # Load RVM function' >> ~/.bashrc
    source ~/.bashrc
    type rvm | head -1
    rvm requirements
    Install rvm dependencies
    rvm list known

Install Ruby 

  1. ​rvm install 1.8.7
  2. rvm use 1.8.7 #Set 1.8.7 
  3. ruby -v #Check ruby version

Setup gemset 

  1. ​rvm gemset create project_name
  2. rvm 1.8.7@project_name
  3. gem install rails

Setup gemset for your project

  1. Go to your project directory
  2. rvm --rvmrc --create 1.8.7@project_name

Ubuntu Hotspot/router

Make your ubuntu hotspot/router
  • Go to Network
  • Choose Wireless
  • Click on Use as Hotspot
  • After that It display Network Name and Security Key
  • Now Open another computer and look for available wifi connections
  • Ubuntu's Network Name should appear in the another computer
  • Select the Ubuntu's Network Name and Insert the Security Key
  • Voila!! That's It

Java and JRuby Setup

Steps to setup JRuby on windows
Picture
  • Set the system environment variables like classpath, path and JAVA_HOME. I have this on my Windows 7: 
  • path=C:\Program Files\Java\jdk1.7.0_03\bin; 
  • classpath=%classpath%;.;
  • JAVA_HOME=C:\Program Files\Java\jdk1.7.0_03; 
  • Download the JRuby from this link  http://jruby.org/download as a .zip file for windows.
Picture
  • Extract the file to C:\ directory.
  • Set the system environment variables like path and JRUBY_HOME
  • path=C:\jruby-1.6.7\bin
  • JRUBY_HOME= C:\jruby-1.6.7
  • To test whether JRuby is properly installed or not. Type  "jruby -v" on the command prompt.
Picture

Ruby Questions And Answers

Ruby Require VS Load VS Include VS Extend. Here are the differences between Require, Load, Include and Extend methods

What is Procs, Blocks, Lambda ?

Ruby Metaprogramming 

Modules vs. Classes