Friday, May 18, 2012

RVM

Installation

  • download RVM installer
  • edit bash_profile
[[ -s  "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"  # Load RVM into a shell session *as a function*
  • reload shell
  • type rvm | head -1
    • should show rvm is a function

Installation on mac mini 10.8

  • to download&install RVM installer to /Users/aleung/.rvm/ on mac mini
    • curl -L https://get.rvm.io | bash
  • to set up PATH in shell
    • source /Users/aleung00c/.rvm/scripts/rvm

More Commands

  • rvm -v
  • rvm list
  • rvm list known
  • rvm info
  • rvm gemdir
    • switch to gem directory for current ruby
  • rvm gemdir system
    • switch to system gem directory
  • rvm gemdir system user
  • rvm use system
    • to undo rvm environment changes

Ruby 2.0.0 / Rails 4.0.0 Installation

  • rvm get stable --auto-dotfiles
  • rvm install 2.0.0
  • rvm use 2.0.0
  • rvm gemset create rails4.0.0
  • rvm gemset use rails4.0.0
  • gem install rails -v 4.0.0

 Ruby 1.9.3 Installation

  • rvm install ruby-1.9.3-p327

Ruby 1.9.2 / Rails 3.0.9 Installation

  • rvm install 1.9.2
  • rvm --default use 1.9.2
  • ruby -v
  • which ruby
  • gem install rails -v 3.0.9

Ruby 1.8.7 / Rails 3.0.0 Installation

  • rvm install 1.8.7
  • rvm gemset create newproject
  • rvm 1.8.7@newproject
  • rvm @global do gem uninstall bundler
  • gem install bundler -v '~>1.0.0'
    • we needed to remove bundler 1.1.3 in global gemset, in order to install bundler 1.0.0 specified in project Gemfile

Ruby 1.8.6 / Rails 2.1.1 Installation

  • rvm install 1.8.6
  • rvm gemset create legacy-gemset
  • rvm 1.8.6@legacy-gemset
  • gem install rails --version 2.1.1
  • gem install sqlite3-ruby --version 1.2.4
  • gem install ruby-net-ldap --version 0.0.4

Additional Gemset Creation

  • rvm gemset create experiment-gemset
  • rvm 1.9.2@experiment-gemset
  • gem install fastercsv
  • rvm gemset copy 1.9.2 1.9.2@experiment-gemset
  • rvm gemset use experiment-gemset

Rails 3.0.9 App Creation

  • rvm use 1.9.2
  • rails -v
    • to verify and confirm we are using rails version 3.0.9 as default gemset
  • cd ~/ruby1.9.2/rails_projects/
  • rails new new-rails-app

Rails 2.1.1 App Creation

  • rvm use 1.8.6
  • rails -v
    • to verify and confirm that we are using rails version 2.1.1 as default gemset
  • cd ~/ruby1.8.6/rails_projects/
  • rails new-rails-app
  • cd new-rails-app
  • rails s

RSpec (Ruby 1.9.2 / Rails 3.0.9)

  • gem install rspec-rails
  • cd ~/ruby1.9.2/rails_projects/new-rails-app
  • add to Gemfile
group :test, :development do
  gem "rspec-rails", "~> 2.0"
end
  • rails generate rspec:install
  • rails generate model PricingPlan sku:string pricing:string
  • rake db:migrate RAILS_ENV=test
  • rspec spec/models/pricing_plan_spec.rb

Experiment with new Savon

  • rvm gemset create new_savon
  • rvm gemset copy 1.9.2@production 1.9.2@new_savon
  • rvm gemset use 1.9.2@new_savon
  • gem list savon
*** LOCAL GEMS ***

savon (0.9.6)
savon_spec (0.1.6)
  • view Gemfile.lock
    savon (0.9.6)
      akami (~> 1.0)
      builder (>= 2.1.2)
      gyoku (>= 0.4.0)
      httpi (~> 0.9)
      nokogiri (>= 1.4.0)
      nori (~> 1.0)
      wasabi (~> 2.0)
  • bundle update savon 
  • gem list savon
*** LOCAL GEMS ***

savon (1.1.0, 0.9.6)
savon_spec (0.1.6)
  • view Gemfile.lock
    savon (1.1.0)
      akami (~> 1.2.0)
      builder (>= 2.1.2)
      gyoku (~> 0.4.5)
      httpi (~> 1.1.0)
      nokogiri (>= 1.4.0)
      nori (~> 1.1.0)
      wasabi (~> 2.5.0)

Rails 3.2

  • rvm gemset create development_32
  • rvm gemset use development_32
  • bundle install
Rolify
  • rvm gemset create rolify
  • rvm gemset use rolify
  • add to Gemfile
    gem 'rolify'
  • bundle install
  •  

No comments:

Post a Comment