rbenv

一応触るだけ触っておこうと言うことで。

rbenvをリポジトリからインストール

$ rvm implode
$ cd ~
$ brew install rbenv --HEAD
$ echo 'eval "$(rbenv init -)"' >> .zshrc
$ exec
$ rbenv
rbenv 0.2.0-pre
usage: rbenv <command> [<args>]

Some useful rbenv commands are:
   commands      List all commands
   rehash        Rehash rbenv shims (run this after installing binaries)
   global        Set or show the global Ruby version
   local         Set or show the local directory-specific Ruby version
   version       Show the current Ruby version
   versions      List all Ruby versions known by rbenv

See 'rbenv help <command>' for more information on a specific command.
For more information, see: https://github.com/sstephenson/rbenv#readme

ruby-buildをリポジトリからインストール

$ brew create https://github.com/sstephenson/ruby-build.git
$ brew cat ruby-build
require 'formula'

class RubyBuild < Formula
  head 'https://github.com/sstephenson/ruby-build.git'
  homepage 'https://github.com/sstephenson/ruby-build'

  def install
    bin.install Dir['bin/*']
    share.install Dir['share/*']
  end
end
$ brew install ruby-build

rbenv用にruby 1.9.2 p290をインストール

$ ruby-build 1.9.2-p290 ~/.rbenv/versions/1.9.2-p290
$ rbenv rehash
$ rbenv versions
  1.9.2-p290
$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
$ rbenv global 1.9.2-p290
$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [universal-darwin11.0]
$ rbenv version
1.9.2-p290 (set by /Users/koshigoe/.rbenv/global)
$ cat ~/.rbenv/global
1.9.2-p290

rbenvのrubyを使ってみる

$ rbenv exec gem install bundler
$ mkdir sample
$ cd sample
$ cat <<EOF > Gemfile
source :rubygems

gem 'rails'
EOF
$ rbenv exec bundle install --path vendor/bundler
$ rbenv exec bundle exec rails new . -T -J
$ rbenv exec bundle install
$ rbenv exec bundle exec rake db:migrate
$ rbenv exec bundle exec rails c
$ rbenv exec bundle exec rails s