grrr I forgot to attach the script, sorry.
2008/12/5 Lionel ORRY <[EMAIL PROTECTED]>:
> Ok, here is a better version.
>
> I dropped the Hpricot code for the reasons given in the previous file
> comments, and use rexml instead.
>
> I enhanced the WiX source code to add several shortcuts to the Start
> Menu, namely: Shoes, Manual, Packager, and Uninstall.
>
> I forgot to say that to prevent your current Shoes installation from
> being overwritten, I use %PROGRAMFILES%\Shoes directory. You can give
> it a try without having to uninstall anything.
>
> Since I use heat.exe to automatically harvest the current
> installation, the Uninstall.exe executable is still present but is
> related to NSIS installation, and is not the right way to uninstall.
> You have several ways to uninstall cleanly:
> 1. Menu Start->Run... -> appwiz.cpl -> select Shoes then uninstall
> 2. Use the Uninstall Shoes shortcut in the Programs Menu
> 3. Launch msiexec /x Shoes.msi
>
> These 3 ways basically do the same thing, i.e. launch the third command-line.
>
> I will upload a ready-to-use msi package for the lazy ones later.
>
> Enjoy. Thanks for your feedback.
>
> Lionel
>
CURRENT_SHOES_INSTALL_DIR = "#{ENV['COMMONPROGRAMFILES']}\\Shoes"
WIXDIR = 'C:\wix'
# Harvest the existing Shoes installation dir to get a first draft of the wxs file
puts "Harvesting current shoes installation..."
`#{WIXDIR}\\heat.exe dir -ag -sfrag -template:fragment "#{CURRENT_SHOES_INSTALL_DIR}" -out shoes_draft.wxs`
# process the draft to get something compilable
puts "Doing tricky manipulations... ;)"
require 'rexml/document'
include REXML
doc = Document.new(File.read("shoes_draft.wxs"))
XPath.first(doc, "/Wix/Fragment").add_element("DirectoryRef")
ref = XPath.first(doc, "/Wix/Fragment/DirectoryRef")
ref.add_attribute("Id","SHOESINSTALLDIR")
XPath.first(doc, "/Wix/Fragment/Directory").each_element { |c| ref.add(c.deep_clone) }
XPath.first(doc, "/Wix/Fragment/Directory").remove
File.open("shoes_fragment.wxs","w") { |f| f.write doc }
puts "Creating Wix Product placeholder... ;)"
xml_main = <<-eos
<?xml version="1.0"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
<Product Name="Shoes" Version="1.0.0.0" Id="45c22550-c295-11dd-ad8b-0800200c9a66"
Manufacturer="Hackety.org" Language="1033" UpgradeCode="08f7e263-e632-44be-a6f9-a61ea3d704f0">
<Package InstallerVersion="200" Compressed="yes"></Package>
<Directory Name="SourceDir" Id="TARGETDIR">
<Directory Id="ProgramFilesFolder">
<Directory Id="SHOESINSTALLDIR" Name="Shoes">
</Directory>
</Directory>
<Directory Id="ProgramMenuFolder">
<Directory Id="ShoesMenuFolder" Name="Shoes (WiX)"/>
</Directory>
</Directory>
<DirectoryRef Id="ShoesMenuFolder">
<Component Id="ApplicationShortcut" Guid="*">
<Shortcut Id="ApplicationStartMenuShortcut" Name="Shoes" Description="The Shoes App!"
Target="[_0.r1123]shoes.exe" WorkingDirectory="_0.r1123" />
<Shortcut Id="ApplicationStartMenuShortcut2" Name="Manual" Description="The Shoes Manual"
Target="[_0.r1123]shoes.exe" Arguments="--manual" WorkingDirectory="_0.r1123" />
<Shortcut Id="ApplicationStartMenuShortcut3" Name="Packager" Description="The Shoes Packager"
Target="[_0.r1123]shoes.exe" Arguments="--package" WorkingDirectory="_0.r1123" />
<Shortcut Id="UninstallProduct"
Name="Uninstall Shoes"
Description="Uninstalls Shoes"
Target="[System64Folder]msiexec.exe"
Arguments="/x [ProductCode]"/>
<RemoveFolder Id="ShoesMenuFolder" On="uninstall" />
<RegistryValue Root="HKCU" Key="Software\\Hackety.org\\Shoes"
Name="installed" Type="integer" Value="1" KeyPath="yes"/>
</Component>
</DirectoryRef>
<Feature Id="ProductFeature" Title="Default" Level="1">
<ComponentGroupRef Id="ComponentGroup1"></ComponentGroupRef>
<ComponentRef Id="ApplicationShortcut" />
</Feature>
<Media EmbedCab="yes" Id="1" Cabinet="product.cab"></Media>
<UI>
<Property Id="WIXUI_INSTALLDIR" Value="SHOESINSTALLDIR" />
<UIRef Id="WixUI_InstallDir" />
</UI>
</Product>
</Wix>
eos
File.open("shoes_main.wxs","w") { |f| f.write xml_main }
puts "Calling candle.exe (compiler)..."
puts `#{WIXDIR}\\candle.exe -nologo shoes_main.wxs`
puts `#{WIXDIR}\\candle.exe -nologo shoes_fragment.wxs`
puts "Calling light.exe (linker)..."
puts `#{WIXDIR}\\light.exe -nologo shoes_main.wixobj shoes_fragment.wixobj -dWixUILicenseRtf=COPYING.rtf -ext WixUIExtension -out Shoes.msi`
puts "Here you should get shoes.msi! Have fun! Press Enter to exit."
gets