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. It can be used from the Windows command line (cmd.exe), Windows PowerShell, or Git Bash. I have yet to test on cygwin.

>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

  • Build dependencies: exerb-mingw, highline, hpricot, crown, upx, wix

  • Development dependencies: rake, cucumber, rspec, hoe, hoe-git, rack, rack-cache

INSTALL:

You can install pik via rubygems, or the Windows installer, or you can update pik with pik

Install pik using rubygems

>gem install pik
...

Successfully installed pik-0.2.6
1 gem installed

After the gem is installed, you can use the ‘pik_install’ script to install the pik executable. Install pik to a location that’s in your path, but someplace other than your rubybin dir. For instance, the directory C:bin is in my path:

>path
PATH=c:\bin;C:\Program Files\Windows Resource Kits\Tools\;c:\ruby\Ruby-186-p383\bin;

So I run:

>pik_install C:\bin
Thank you for using pik.

Installing to C:\bin

...

pik is installed

Install pik using the installer

If you want to install to a machine that doesn’t have Ruby installed yet, you can download the latest msi file from github. Or, just run:

>msiexec /i http://github.com/downloads/vertiginous/pik/pik-n.n.n.msi

The MSI installer currently doesn’t install the needed files to use Pik from Git Bash. Also, there was a bug in the upgrade code in 0.2.7, so you should uninstall the current version before installing the new one.

If you install to a directory that’s not in your path, you’ll need to add it to the path yourself. Microsoft has good instructions on that. After that, you should be ready to run pik.

  • If this is a first-time install, look at pik add, and pik install to set up your environment.

    >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 install ruby
    ** Downloading:  http://rubyforge.org/frs/download.php/66874/ruby-1.9.1-p243-i386-mingw32-rc1.7z
       to:  c:\installs\ruby-1.9.1-p243-i386-mingw32-rc1.7z
    
    ...
    
  • If you’re upgrading from version 0.2.6, you should be able to upgrade with ‘pik update’

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

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 © 2010 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.