1.8系と1.9系の混在
調べるとできるらしいのでメモ
Ruby − 「pik」で複数バージョン共存!(mk-mode BLOG)
C:\Users\kenmituo>ruby -v ruby 1.8.7 (2012-02-08 patchlevel 358) [i386-mingw32] C:\Users\kenmituo>gem install pik ---------------------------------------------------------------------------- * If you're upgrading from a version <= 0.1.1, you'll want to delete the pik.bat file from all of your ruby versions. Gem uninstall should do the trick. * Install pik to a location that's in your path, but someplace other than your ruby\bin dir If you're upgrading from a more recent version, pik_install will overwrite the older files as needed. >path PATH=C:\tools\;C:\ruby\186-p368-mingw32\bin;C:\WINDOWS\system32;C:\WINDOWS >pik_install C:\tools * If this is a first-time install, add all the versions of ruby that you want to use with pik >pik add Adding: 186: ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32] Located at: c:/ruby/186-p368-mingw32/bin >pik add C:\ruby\IronRuby-091\bin Adding: 091: IronRuby 0.9.1.0 on .NET 2.0.0.0 Located at: C:/ruby/IronRuby-091/bin >pik add C:\ruby\jruby-1.4.0RC1\bin Adding: 140: jruby 1.4.0RC1 (ruby 1.8.7 patchlevel 174) (2009-09-30 80c263b) (Java HotSpot(TM) Client VM 1.6.0_14) [x86-java] Located at: C:/ruby/jruby-1.4.0RC1/bin ---------------------------------------------------------------------------- Successfully installed pik-0.2.8 1 gem installed Installing ri documentation for pik-0.2.8... Installing RDoc documentation for pik-0.2.8... Could not find main page README.rdoc Could not find main page README.rdoc Could not find main page README.rdoc Could not find main page README.rdoc C:\Users\kenmituo>
ディレクトリを作ってインストール
c:\Program Files\pik>pik_install "c:\Program Files\pik" Thank you for using pik. mkdir -p c:\Program Files\pik mkdir -p C:\Users\kenmituo/.pik Installing to c:\Program Files\pik cp C:/Ruby187/lib/ruby/gems/1.8/gems/pik-0.2.8/toolspik_runner.exe c:\Program F iles\pik cp C:/Ruby187/lib/ruby/gems/1.8/gems/pik-0.2.8/tools/pik.bat c:\Program Files\pik cp C:/Ruby187/lib/ruby/gems/1.8/gems/pik-0.2.8/tools/pik.ps1 c:\Program Files\pik creating C:\Users\kenmituo/.pik/.pikrc pik is installed if you want to use pik with git bash, add the following line to your ~/.bashrc: [[ -s $USERPROFILE/.pik/.pikrc ]] && source $USERPROFILE/.pik/.pikrc
環境変数に追加
;C:\Program Files\pik
再起動
c:\Program Files\pik>pik ** Adding: 187: ruby 1.8.7 (2012-02-08 patchlevel 358) [i386-mingw32] Located at: C:\Ruby187\bin Usage: pik command [options] To get help with a command pik help (command) To list all commands and descriptions: pik help commands -V, --version Pik version -d, --debug Outputs debug information c:\Program Files\pik>pik add This version has already been added. c:\Program Files\pik>pik list * 187: ruby 1.8.7 (2012-02-08 patchlevel 358) [i386-mingw32] c:\Program Files\pik>pik add c:\Ruby193\bin ** Adding: 193: ruby 1.9.3p194 (2012-04-20) [i386-mingw32] Located at: C:\Ruby193\bin c:\Program Files\pik>pik list * 187: ruby 1.8.7 (2012-02-08 patchlevel 358) [i386-mingw32] 193: ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
ほうほう
c:\Program Files\pik>pik sw 193 c:\Program Files\pik>ruby -v ruby 1.9.3p194 (2012-04-20) [i386-mingw32]
おお、かんたんだ!