From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search

Ruby installer can be downloaded from:

Ruby 1.9.3

The ruby installer seems to use an unusual registry location for the Uninstall entries, so we cannot use the uninstall check condition here, see comment.

There's documentation about the silent install options here: [1]

  <package id="ruby"

	<check type="logical" condition="or">
		<check type="registry" condition="equals" path="HKCU\Software\Microsoft\Windows\CurrentVersion\Uninstall\{17E73B15-62D2-43FD-B851-ACF86A8C9D25}_is1\DisplayName" value="%PKG_VERSION%" />
		<check type="file" condition="versiongreaterthan" path="%PKG_DESTINATION%\bin\ruby.exe" value="" />
	<check type="uninstall" condition="versiongreaterorequal" path="Ruby.+" value="%PKG_VERSION%" />
 [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Uninstall\{17E73B15-62D2-43FD-B851-ACF86A8C9D25}_is1\DisplayName="Ruby 1.9.3-p194"]

	<variable name="PKG_VERSION" value="1.9.3-p194" />
	<variable name="PKG_EXEVERSION" value="1.9.3-p194" />
        <variable name="PKG_SOURCE"           value="%SOFTWARE%\packages\Ruby" />
        <variable name="%PKG_DESTINATION%"           value="C:\Ruby193" />

	<install include='remove' />
	<install cmd='%PKG_SOURCE%\rubyinstaller-%PKG_EXEVERSION%.exe /verysilent  /lang=de /tasks="addtk,assocfiles,modpath"' />
	<upgrade include='install' />
	<remove cmd='%comspec% /c %PKG_SOURCE%\uninstruby.cmd ' > <exit code="any" /> </remove>


To uninstall old versions of ruby, the following script can be used:

@echo off
FOR /D %%f IN (C:\Ruby*) DO (
echo %%f
  for /L %%n IN (0, 1, 3) DO (
    if exist "%%f\unins00%%n.exe" echo "%%f\unins00%%n.exe"
    "%%f\unins00%%n.exe" /silent /norestart