win/msi: refactor 'node.js runtime' feature
authorBert Belder <bertbelder@gmail.com>
Thu, 7 Mar 2013 16:48:43 +0000 (17:48 +0100)
committerBert Belder <bertbelder@gmail.com>
Fri, 8 Mar 2013 17:00:38 +0000 (18:00 +0100)
* This feature now includes the start menu items.
* 'nodejsvars.bat' was renamed to 'nodevars.bat'.
* Improved feature description.

tools/msvs/msi/product.wxs
tools/msvs/nodevars.bat [moved from tools/msvs/nodejsvars.bat with 100% similarity]

index ba9a0ad..ab04c08 100755 (executable)
                       Name="InstallPath"/>
     </Property>
 
-    <Feature Id="nodejs" Title="node.js engine" Level="1" Description="$(var.ProductDescription)" Absent="disallow">
-      <ComponentGroupRef Id="allfiles" />
-      <ComponentGroupRef Id="Product.Generated" />
+    <Feature Id="NodeRuntime"
+             Level="1"
+             Title="Node.js runtime"
+             Description="Install the core Node.js runtime (node.exe)."
+             Absent="disallow">
+      <ComponentRef Id="NodeExecutable"/>
+      <ComponentRef Id="NodeVarsScript"/>
+      <ComponentRef Id="NodeStartMenuAndRegistryEntries"/>
+      <ComponentGroupRef Id="Product.Generated"/>
 
       <Feature Id="NodePerfCtrSupport"
                Level="1"
@@ -68,9 +74,6 @@
     </Feature>
 
     <Feature Id="nodejs.shortcuts" Title="node.js shortcuts" Level="1" Description="$(var.ProductDescription) Shortcuts">
-      <Feature Id="nodejs.shortcuts.application" Title="Application Shortcuts" Level="1"  Description="$(var.ProductDescription) standard application shortcuts">
-        <ComponentGroupRef Id="application.shortcuts"/>
-      </Feature>
       <Feature Id="nodejs.shortcuts.internet" Title="Internet Shortcuts" Level="1"  Description="$(var.ProductDescription) internet shortcuts to the project's website and online documentation for this version">
         <ComponentGroupRef Id="internet.shortcuts"/>
       </Feature>
 
     <Directory Id="TARGETDIR" Name="SourceDir">
       <Directory Id="ProgramMenuFolder">
-          <Directory Id="ApplicationProgramsFolder" Name="Node.js ($(var.Platform))"/>
+        <Directory Id="ApplicationProgramsFolder" Name="Node.js ($(var.Platform))"/>
       </Directory>
 
       <Directory Id="$(var.ProgramFilesFolderId)">
         <Directory Id="INSTALLDIR" Name="nodejs">
-          <Component Id="nodeexe" Guid="AEC0F08E-89B3-4C35-A286-8DB8598597F2">
-            <File Id="filenodeexe" KeyPath="yes" Source="$(var.SourceDir)\node.exe" />
-          </Component>
-          <Component Id="nodejsvars" Guid="*">
-            <File Id="filenodejsvars" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\nodejsvars.bat" />
-          </Component>
-          <Component Id="noderegistry" Guid="*" >
-            <RegistryKey Root="HKCU" Key="$(var.RegistryKeyPath)">
-              <RegistryValue Name="InstallPath" Type="string" Value="[INSTALLDIR]" KeyPath="yes" />
-              <RegistryValue Name="Version" Type="string" Value="$(var.ProductVersion)" />
-            </RegistryKey>
-          </Component>
         </Directory>
       </Directory>
     </Directory>
 
     <DirectoryRef Id="INSTALLDIR">
+      <Component Id="NodeExecutable">
+        <File Id="node.exe" KeyPath="yes" Source="$(var.SourceDir)\node.exe"/>
+      </Component>
+
+      <Component Id="NodeVarsScript">
+        <File Id="nodevars.bat" KeyPath="yes" Source="$(var.RepoDir)\tools\msvs\nodevars.bat"/>
+      </Component>
+
       <?if $(var.NoPerfCtr) != 1 ?>
       <Component Id="NodePerfCtrSupport">
         <File Id="node_perfctr_provider_man" Name="node_perfctr_provider.man" Source="$(var.RepoDir)\src\res\node_perfctr_provider.man">
       <?endif?>
     </DirectoryRef>
 
+    <DirectoryRef Id="ApplicationProgramsFolder">
+      <Component Id="NodeStartMenuAndRegistryEntries">
+        <RegistryValue Root="HKCU"
+                       Key="$(var.RegistryKeyPath)"
+                       Name="InstallPath"
+                       Type="string"
+                       Value="[INSTALLDIR]"
+                       KeyPath="yes"/>
+        <RegistryValue Root="HKCU"
+                       Key="$(var.RegistryKeyPath)"
+                       Name="Version"
+                       Type="string"
+                       Value="$(var.ProductVersion)"/>
+        <Shortcut Id="NodeVarsScriptShortcut"
+                  Name="Node.js command prompt"
+                  Target="[%ComSpec]"
+                  Arguments='/k "[INSTALLDIR]nodevars.bat"'
+                  Show="normal"
+                  WorkingDirectory="INSTALLDIR"/>
+        <Shortcut Id="NodeExecutableShortcut"
+                  Name="Node.js"
+                  Target="[INSTALLDIR]node.exe"
+                  WorkingDirectory="INSTALLDIR"/>
+        <Shortcut Id="UninstallProduct"
+                  Name="Uninstall Node.js"
+                  Target="[SystemFolder]msiexec.exe"
+                  Arguments="/x [ProductCode]"/>
+        <RemoveFolder Id="RemoveApplicationProgramsFolder"
+                      On="uninstall"/>
+      </Component>
+    </DirectoryRef>
+
     <DirectoryRef Id="INSTALLDIR">
       <Component Id="NpmCmdScript">
         <File Id="npm.cmd" KeyPath="yes" Source="$(var.NpmSourceDir)\bin\npm.cmd"/>
     </DirectoryRef>
 
     <DirectoryRef Id="ApplicationProgramsFolder">
-      <Component Id="ApplicationShortcut" Guid="9b1ab94a-8f54-4f19-a5c4-b890de474162">
-        <Shortcut Id="ApplicationStartMenuShortcut" Name="Node.js"
-                  Description="$(var.ProductDescription)" Target="[INSTALLDIR]node.exe"
-                  WorkingDirectory="INSTALLDIR"/>
-        <Shortcut Id="NodePromptStartMenuShortcut" Name="Node.js command prompt"
-                  Description="Node.js Command Prompt" Target="[%ComSpec]"
-                  Arguments='/k "[INSTALLDIR]nodejsvars.bat"'
-                  Show="normal"
-                  WorkingDirectory="INSTALLDIR"/>
-        <Shortcut Id="UninstallProduct"
-                  Name="Uninstall Node.js"
-                  Target="[SystemFolder]msiexec.exe"
-                  Arguments="/x [ProductCode]"
-                  Description="Uninstalls $(var.ProductName)" />
-        <RemoveFolder Id="ApplicationProgramsFolder" On="uninstall"/>
-        <RegistryValue Root="HKCU" Key="$(var.RegistryKeyPath)" Name="installed" Type="integer" Value="1" KeyPath="yes"/>
-      </Component>
       <Component Id="InternetShortcuts" Guid="3351B877-49BA-4BC0-BF5E-21BA623FD07C">
         <util:InternetShortcut Id="OnlineWebsiteShortcut"
                   Name="Node.js website"
       </Component>
     </DirectoryRef>
 
-    <ComponentGroup Id="allfiles">
-      <ComponentRef Id="nodeexe"/>
-      <ComponentRef Id="nodejsvars" />
-      <ComponentRef Id="noderegistry" />
-    </ComponentGroup>
-
-    <ComponentGroup Id="application.shortcuts">
-      <ComponentRef Id="ApplicationShortcut" />
-    </ComponentGroup>
-
     <ComponentGroup Id="internet.shortcuts">
       <ComponentRef Id="InternetShortcuts"/>
     </ComponentGroup>