pik

github.com/vertiginous/pik

Mailing List: groups.google.com/group/discuss_pik

Rubyforge: rubyforge.org/projects/pik/

Bugs/Feature requests: github.com/vertiginous/pik/issues

Gordon Thiesfeld

DESCRIPTION:

Pik is a tool to manage multiple versions of ruby on Windows.

>pik help commands

  add             Adds another ruby location to pik.
  benchmark|bench Runs bencmarks with all versions that pik is aware of.
  checkup|cu      Checks your environment for current Ruby best practices.
  config          Adds/modifies configuration options.
  default         Switches back to the default settings.
  gem             Runs the gem command with all versions that pik is aware of.
  gemsync         Synchronizes gems from the version specified to the current version.
  help            Displays help information.
  implode         Removes your pik configuration.
  info            Displays information about the current ruby version.
  install|in      Downloads and installs different ruby versions.
  list|ls         Lists ruby versions that pik is aware of.
  rake            Runs the rake command with all versions that pik is aware of.
  remove|rm       Removes a ruby location from pik.
  ruby|rb         Runs ruby with all versions that pik is aware of.
  run             Runs command with all versions of ruby that pik is aware of.
  switch|sw|use   Switches ruby versions based on patterns.
  tag             Adds the given tag to the current version.
  tags            Runs the pik command against the given tags.
  uninstall|unin  Deletes a ruby version from the filesystem and removes it from Pik.
  update|up       updates pik.

For help on a particular command, use 'pik help COMMAND'.

REQUIREMENTS:

Windows, more than one version of Ruby (otherwise, what’s the point?) and Rubygems

INSTALL:

  • 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 rubybin 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
    

Note:

When using IronRuby, I have found that is necesary to configure the GEM_HOME env. variable to a directory
inside of the IronRuby lib:

  pik config gem_home=C:\ruby\ironruby-091\lib\ironruby\gems\1.8

Also, if you're using a version of JRuby older than 1.4.0RC2, you'll probably need to set the JAVA_HOME env
variable.

 set JAVA_HOME=C:\Program Files\Java\jre6

EXAMPLES:

pik add

C:\>ruby -v
ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]

C:\>pik add
Adding:  186: ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]'
 Located at:  c:/ruby/186-p368-mingw32/bin

C:\>pik add C:\ruby\191-p243-mingw32\bin
Adding:  191: ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]'
 Located at:  C:/ruby/191-p243-mingw32/bin

pik list

C:\>pik list
185: ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32]
186: ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
186: ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32] *
191: ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]
191: ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]

or

C:\>pik list -v
185: ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32]
     path: C:/ruby/185-p012-mswin32/bin

186: ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
     path: C:/ruby/186-p287-mswin32/bin

186: ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32] *
     path: C:/ruby/186-p368-mingw32/bin

191: ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]
     path: C:/ruby/191-p129-mingw32/bin

191: ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]
     path: C:/ruby/191-p243-mingw32/bin

pik switch

C:\>pik switch 191 p129
 == Switching to ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32] ==

or

C:\>pik sw 185
 == Switching to ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32] ==

or

C:\>pik use 186 ms
 == Switching to ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32] ==

or

C:\>pik 191 p2
 == Switching to ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32] ==

or

C:\>pik default
 == Switching to ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32] ==

pik run # there

>tools\pik gem install runt -v
  Running with IronRuby 0.9.0.0 on .NET 2.0.0.0
  igem.bat install runt
  Successfully installed runt-0.7.0
  1 gem installed

  Running with IronRuby 0.9.1.0 on .NET 2.0.0.0
  igem.bat install runt
  Successfully installed runt-0.7.0
  1 gem installed

  Running with jruby 1.3.1 (ruby 1.8.6p287) (2009-06-15 2fd6c3d) (Java HotSpot(TM) Client VM 1.6.0_14) [x86-java]
  gem.bat install runt
  JRuby limited openssl loaded. gem install jruby-openssl for full support.
  http://wiki.jruby.org/wiki/JRuby_Builtin_OpenSSL
  Successfully installed runt-0.7.0
  1 gem installed

  Running with 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]
  gem.bat install runt
  JRuby limited openssl loaded. gem install jruby-openssl for full support.
  http://jruby.kenai.com/pages/JRuby_Builtin_OpenSSL
  Successfully installed runt-0.7.0
  1 gem installed

  Running with ruby 1.8.5 (2006-12-25 patchlevel 12) [i386-mswin32]
  gem.bat install runt
  Successfully installed runt-0.7.0
  1 gem installed

  Running with ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
  gem.bat install runt
  "C:\\Documents and Settings\\gthiesfeld/.gem/ruby/1.8/cache/runt-0.7.0.gem"
  Successfully installed runt-0.7.0
  1 gem installed

  Running with ruby 1.8.6 (2009-03-31 patchlevel 368) [i386-mingw32]
  gem.bat install runt
  Successfully installed runt-0.7.0
  1 gem installed

  Running with ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mingw32]
  gem.bat install runt
  Successfully installed runt-0.7.0
  1 gem installed

  Running with ruby 1.9.1p243 (2009-07-16 revision 24175) [i386-mingw32]
  gem.bat install runt
  Successfully installed runt-0.7.0
  1 gem installed

LICENSE:

(The MIT License)

Copyright © 2009 Gordon Thiesfeld

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.