wixgem 0.108.0 → 0.110.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 80493efcc975680f41a21d0196dedde83e90a2447b1bdf6eebf1ffdb1de1b49d
4
- data.tar.gz: 7e1508dcaad2346044f97601ea8b754e043fb02fd9e350ad607289063e7660eb
3
+ metadata.gz: 10e61c62d03979266feff1ade5dcef49603123b87b8fa6e6103466783c9ef203
4
+ data.tar.gz: 3ceb485b6e95b995d43d09e53fa89738a533d70ac1b3bec2d5390f8c3b5954ea
5
5
  SHA512:
6
- metadata.gz: 399c34135782d39b0cb839c308e4acef986d7126701a57d2d1bc02d7118733dc1e7fa5ee98845e0b863856e711a7f9d56e2d16b6866e49fea2df3ab1e2ea18d7
7
- data.tar.gz: 4644152e7d05ce0919685405043838caedc3f978e985ebcff47e25d739ccbf5197e818fdbbcb0a31b8dd96ef5543e5c35ef59ccf753b137a3ba0e25ab49b4f92
6
+ metadata.gz: 36d3b66c9e9a27ab5850bbc429a3f8e6148915bf9df77a612dbc797cc01ee872fccdc4f942a6c75b8eeb368713e32ecdf09bdd54f73a1027ff993d0e59f5e4dc
7
+ data.tar.gz: ece434c79d788ee69e20df13ce90cf31d7224db1c7fab0ad66381de28e3210125efb7ba50965965b5f8e00f18bc91273f0f26b508da2009ba1c1ceb1aabaa96d
data/example/example.msi CHANGED
Binary file
data/example/example.msm CHANGED
Binary file
@@ -0,0 +1,68 @@
1
+ class RegistryEntries
2
+ def initialize(hash)
3
+ @hash = hash
4
+ end
5
+
6
+ def create_key(xml_doc)
7
+ raise "RegistryEntry hash is required to have a :root key" unless(@hash.has_key?(:root))
8
+ raise "RegistryEntry hash is required to have a :path key" unless(@hash.has_key?(:path))
9
+ raise "RegistryEntry hash is required to have a :key key" unless(@hash.has_key?(:key))
10
+ raise "Key hash is required to have a :name key" unless(@hash[:key].has_key?(:name))
11
+ raise "Key hash is required to have a :value key" unless(@hash[:value].has_key?(:name))
12
+ raise "Key hash is required to have a :value key" unless(@hash[:value_type].has_key?(:name))
13
+
14
+ service_exe = @hash[:service_exe]
15
+ raise "Service #{file} does not exist" unless(File.exists?(service_exe))
16
+
17
+ file_elements = REXML::XPath.match(xml_doc, "//File[@Source='.\\#{service_exe.gsub(/\//,'\\')}']")
18
+ raise "Service #{@file} does not match a 'File' element with a 'Source' attribute in the wix generated wix file" if(file_elements.length == 0)
19
+
20
+ service_exe_element = file_elements[0]
21
+ service_exe_element.attributes['KeyPath']='yes'
22
+
23
+ create_service_element(xml_doc, service_exe_element)
24
+
25
+ return xml_doc
26
+ end
27
+
28
+ def set(xml_doc, input)
29
+ file = file.gsub(/\//,'\\')
30
+ file_elements = REXML::XPath.match(@xml_doc, "//File[@Source='.\\#{file}']")
31
+ raise "Unable to find file '#{file}' to associate with extension '#{extension}'" if(file_elements.nil? || file_elements.size != 1)
32
+
33
+ file_parent = file_elements[0].parent
34
+
35
+ app=File.basename(file)
36
+ # App Paths to support Start,Run -> "myapp"
37
+ #<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MyApp.exe" Value="[!MyApp.exe]" Type="string" />
38
+ file_parent.add_element 'RegistryValue', { 'Root' => 'HKLM', 'Key' => "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\#{app}",
39
+ 'Value' => "[INSTALLDIR]#{file}", 'Type' => 'string' }
40
+ #<RegistryValue Root="HKLM" Key="SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\MyApp.exe" Name="Path" Value="[APPLICATIONFOLDER]" Type="string" />
41
+ file_parent.add_element 'RegistryValue', { 'Root' => 'HKLM', 'Key' => "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\#{app}",
42
+ 'Name' => 'Path', 'Value' => '[INSTALLDIR]', 'Type' => 'string' }
43
+
44
+ # Extend to the "open with" list + Win7 jump menu pinning
45
+ #<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Applications\MyApp.exe\SupportedTypes" Name=".xyz" Value="" Type="string" />
46
+ file_parent.add_element 'RegistryValue', { 'Root' => 'HKLM', 'Key' => "SOFTWARE\\Classes\\Applications\\#{app}\\SupportedTypes",
47
+ 'Name' => extension, 'Value' => '', 'Type' => 'string' }
48
+ #<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\Applications\MyApp.exe\shell\open" Name="FriendlyAppName" Value="!(loc.ApplicationName)" Type="string" />
49
+ file_parent.add_element 'RegistryValue', { 'Root' => 'HKLM', 'Key' => "SOFTWARE\\Classes\\Applications\\#{app}\\shell\\open\\command",
50
+ 'Value' => "[INSTALLDIR]#{file} \"%1\"", 'Type' => 'string' }
51
+
52
+ # MyApp.Document ProgID
53
+ #<RegistryValue Root="HKLM" Key="SOFTWARE\Classes\MyApp.Document" Name="FriendlyTypeName" Value="!(loc.DescXYZ)" Type="string" />
54
+ file_parent.add_element 'RegistryValue', { 'Root' => 'HKLM', 'Key' => "SOFTWARE\\Classes\\#{File.basename(app, '.exe')}.Document",
55
+ 'Name' => 'Aim Project File', 'Value' => "[INSTALLDIR]#{app} \"%1\"", 'Type' => 'string' }
56
+
57
+ #<ProgId Id="MyApp.Document" Description="!(loc.DescXYZ)" Icon="filetype.ico" Advertise="yes">
58
+ # <Extension Id="xyz">
59
+ # <Verb Id="open" Command="!(loc.ExplorerMenuOpenXYZ)" Argument="&quot;%1&quot;" />
60
+ # <MIME Advertise="yes" ContentType="application/xyz" Default="yes" />
61
+ # </Extension>
62
+ #</ProgId>
63
+ prog_id = file_parent.add_element 'ProgId', { 'Id' => "#{File.basename(app, '.exe')}.Document", 'Description' => "Aim project file",
64
+ 'Advertise' => 'yes'}
65
+ ext = prog_id.add_element 'Extension', { 'Id' => extension.gsub(/\./, '') }
66
+ ext.add_element 'Verb', { 'Id' => 'open', 'Command' => "[INSTALLDIR]#{app}", 'Argument' => "\"%1\"" }
67
+ end
68
+ end
@@ -0,0 +1,81 @@
1
+ require 'rexml/document'
2
+ require 'SecureRandom'
3
+
4
+ module Wixgem
5
+
6
+ class CustomAction
7
+ def initialize(xml_doc, input)
8
+ @xml_doc = xml_doc
9
+ @input = input
10
+ end
11
+ def add(custom_action)
12
+ unless(custom_action.key?(:file) || custom_action.key?(:binary_key) || custom_action.key?(:property) || custom_action.key?(:directory))
13
+ raise 'Currently, only supported custom actions work with installed executable, binary key, property, or directory'
14
+ end
15
+
16
+ file_key=nil
17
+ if(custom_action.key?(:file))
18
+ install_path = ".\\#{custom_action[:file].gsub(/\//,'\\')}"
19
+ file_elements = REXML::XPath.match(@xml_doc, "//File[@Source='#{install_path}']")
20
+ raise "Unable to locate installation file '#{custom_action[:file]} for custom action'" if(file_elements.nil? || (file_elements.size == 0))
21
+
22
+ file_key = file_elements[0].attributes['Id']
23
+ end
24
+
25
+ id = "ca_#{SecureRandom.uuid.gsub(/-/,'')}"
26
+ id = custom_action[:id] if(custom_action.key?(:id))
27
+
28
+ impersonate = 'yes'
29
+ impersonate = custom_action[:impersonate] if(custom_action.key?(:impersonate))
30
+
31
+ condition='NOT Installed AND NOT REMOVE'
32
+ condition='1' if(custom_action.key?(:binary_key))
33
+ condition = custom_action[:condition] if(custom_action.key?(:condition))
34
+
35
+ execute='deferred'
36
+ execute = custom_action[:execute] if(custom_action.key?(:execute))
37
+
38
+ ret='check'
39
+ ret = custom_action[:return] if(custom_action.key?(:return))
40
+
41
+ wix_element = REXML::XPath.match(@xml_doc, "/Wix")[0]
42
+ fragment = wix_element.add_element 'Fragment'
43
+
44
+ action = fragment.add_element 'CustomAction', { 'Id' => id, 'Impersonate' => impersonate, 'Return' => ret, 'HideTarget' => 'no', 'Execute' => execute }
45
+ if(custom_action.key?(:binary_key))
46
+ action.attributes['BinaryKey'] = custom_action[:binary_key]
47
+ else
48
+ action.attributes['FileKey'] = file_key
49
+ end
50
+
51
+ action.attributes['Directory'] = custom_action[:directory] if(custom_action.key?(:directory))
52
+ action.attributes['ExeCommand'] = custom_action[:exe_command] if(custom_action.key?(:exe_command))
53
+ action.attributes['DllEntry'] = custom_action[:dll_entry] if(custom_action.key?(:dll_entry))
54
+
55
+ if(custom_action.key?(:property))
56
+ raise "Custom action property '#{custom_action[:property]} must have a value!" unless(custom_action.key?(:value))
57
+ action.attributes.delete('ExeCommand')
58
+ action.attributes.delete('Return')
59
+ action.attributes['Property'] = custom_action[:property]
60
+ action.attributes['Value'] = custom_action[:value]
61
+ end
62
+
63
+ install_execute_sequence = fragment.add_element 'InstallExecuteSequence'
64
+
65
+ custom_action[:before] = 'InstallFinalize' if(!custom_action.key?(:after) && !custom_action.key?(:before))
66
+ if(custom_action.key?(:after))
67
+ action = install_execute_sequence.add_element 'Custom', { 'Action' => id, 'After' => custom_action[:after] }
68
+ action.text = condition
69
+ else
70
+ action = install_execute_sequence.add_element 'Custom', { 'Action' => id, 'Before' => custom_action[:before] }
71
+ action.text = condition
72
+ end
73
+
74
+ control=nil
75
+ elements = REXML::XPath.match(@xml_doc, "/Wix/Product")
76
+ elements = REXML::XPath.match(@xml_doc, "/Wix/Module") if(elements.nil? || elements.size == 0)
77
+
78
+ elements[0].add_element 'CustomActionRef', { 'Id' => id }
79
+ end
80
+ end
81
+ end
data/lib/wixgem.rb CHANGED
@@ -410,7 +410,7 @@ class Wix
410
410
 
411
411
  filename = wxs_file
412
412
  if(install_files.index(file) == 0)
413
- execute_heat(input, "file \"#{windows_path}\" -v #{template_option} -cg InstallionFiles -gg -nologo -srd -o \"#{filename}\"")
413
+ execute_heat(input, "file \"#{windows_path}\" -v #{template_option} -cg InstallationFiles -gg -nologo -srd -o \"#{filename}\"")
414
414
  else
415
415
  filename = File.basename(wxs_file).gsub('.wxs', "-#{wxs_files.length}.wxs")
416
416
  execute_heat(input, "file \"#{windows_path}\" -v -template fragment -gg -nologo -srd -o \"#{filename}\"")
@@ -461,7 +461,7 @@ class Wix
461
461
  end
462
462
 
463
463
  def self.execute_heat_dir(wxs_file, input, template_option)
464
- execute_heat(input,"dir . #{template_option} -cg InstallionFiles -gg -nologo -srd -o \"#{wxs_file}\"")
464
+ execute_heat(input,"dir . #{template_option} -cg InstallationFiles -gg -nologo -srd -o \"#{wxs_file}\"")
465
465
  end
466
466
 
467
467
  def self.create_wxs_file(wxs_file, input, ext)
@@ -553,7 +553,6 @@ class Wix
553
553
  wix_bin_dir = "#{wix_install_path}/tools" unless(Dir.exists?(wix_bin_dir))
554
554
  raise "Unable to locate candle.exe. Expecting to have a sub directory bin or tools in the wix installtion directory: #{wix_install_path}" unless(Dir.exists?(wix_bin_dir))
555
555
 
556
-
557
556
  ext_args = "-ext WixUtilExtension -ext WixNetfxExtension -ext WixUIExtension"
558
557
  candle_cmd = Execute.new("\"#{wix_bin_dir}/candle.exe\" #{ext_args} -out \"#{wixobj_file}\" \"#{wxs_file}\"", { quiet: true })
559
558
  candle_cmd.execute
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wixgem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.108.0
4
+ version: 0.110.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Marshall
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-24 00:00:00.000000000 Z
11
+ date: 2023-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: execute
@@ -140,6 +140,8 @@ files:
140
140
  - lib/associate_extension.rb
141
141
  - lib/custom_action.rb
142
142
  - lib/file.rb
143
+ - lib/registry_entries.rb
144
+ - lib/registry_key.rb
143
145
  - lib/service.rb
144
146
  - lib/shortcut.rb
145
147
  - lib/temp_directory.rb
@@ -163,7 +165,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
165
  - !ruby/object:Gem::Version
164
166
  version: '0'
165
167
  requirements: []
166
- rubygems_version: 3.2.3
168
+ rubygems_version: 3.2.15
167
169
  signing_key:
168
170
  specification_version: 4
169
171
  summary: Simple Ruby interface to facilitate working with Wix Toolset