rubyinstallationchocolateyruby-development-kit

How do I override the Ruby and Ruby DevKit installdir with Chocolatey?


I am somewhat new to chocolatey, having installed a few packages in the past on Windows 8, and I have come to like it.

I have noticed that chocolatey installs the packages in the default Windows program directory (i.e. "Program Files x86" or so). Maybe there is more to that that I am missing.

For the specific case of Ruby 2.1.5 and Ruby DevKit, I have a couple of questions:

I know there is some information about changing the install directory, but the arguments syntax are dependent on the install system used (if any) by the specific package being installed, in this case, Ruby & Ruby DevKit. I am yet to find what would be the CLI installation string for ruby and ruby devkit on windows. Any help is greatly appreciated. Thanks


Solution

  • Forewarning

    Parts of Ruby, coming from *nix, do not like spaces. Gems is one of them. This is not a Chocolatey thing, just an FYI in case you DO run into issues once you put it into Program Files. It likely won't work there, so if you run into problems, move it somewhere else.

    The installer also doesn't really update permissions if I recall correctly, so you are on your own to make sure your permissions are good so you can run it e.g. Program Files is Administrators writeable only, which you won't have unless you are running an administrative prompt (this is UAC, it removes you from the Administrators group in non-elevated processes).

    Guarantee x64?

    If you are on a 64-bit system and a package has x64 urls in it, you will get the 64-bit version of that software unless you specifically use -x86 to force the 32-bit version.

    Install-ChocolateyPackage "$packageId" 'exe' "$silentArgs" "$url" "$url64" -checksum $checksum -checksum64 $checksum64

    Get-ChocolateyWebFile 'ruby2.devkit' "$file" -url "$url" -url64bit "$url64" -checksum "$checksum" -checksum64 "$checksum64" -checksumType "$checksumType"

    Customize Install Folder

    Usually you would pass the native switch for changing the directory through installargs. However these packages, due to the known issues above, use Chocolatey's Get-BinRoot to determine where to install themselves.

    Chocolatey's Get-BinRoot

    Get-BinRoot uses an environment variable named ChocolateyBinRoot (set by default to $env:SystemDrive\tools) to determine where to put certain software that doesn't really qualify for Program Files. You can set that where ever you want, including Program Files folders and it will use that location instead.

    Installing Ruby and DevKit for v2