wixgem 0.107.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: d4df5be0ad2b518b79605ff0df4352189113f98f04151cdaa67cd872a6bb9be6
4
- data.tar.gz: 13415131c4b51d1587e536fe17aebf41e6195104ab375f219384b1582d5ca041
3
+ metadata.gz: 10e61c62d03979266feff1ade5dcef49603123b87b8fa6e6103466783c9ef203
4
+ data.tar.gz: 3ceb485b6e95b995d43d09e53fa89738a533d70ac1b3bec2d5390f8c3b5954ea
5
5
  SHA512:
6
- metadata.gz: a2425b542ace8a5b0260713b345f435d26c87c200a46a14023b17d02391909070da6b62263c1e01e16c9fe9ce187ce8299cd83c7a4ef0ba6794fd70002d11e4b
7
- data.tar.gz: 6dd5953c029b3c504881f1b4b5f92ffb6b5e1fffa85e427c4dbe0d5814652bc813799882415409569cd777dd7a4401c5af565c8513629b8c5c41ed307f0db06c
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/service.rb CHANGED
@@ -37,7 +37,7 @@ class Service
37
37
 
38
38
  if(service.key?(:logonasservice))
39
39
  raise ':logonasservice requires an :account element' unless(service.key?(:account))
40
-
40
+
41
41
  wix = REXML::XPath.match(xml_doc, "/Wix")[0]
42
42
  wix.add_attribute('xmlns:Util', 'http://schemas.microsoft.com/wix/UtilExtension')
43
43
 
@@ -50,6 +50,7 @@ class Service
50
50
 
51
51
  account = words[1]
52
52
  end
53
+
53
54
  user_element.attributes['Id'] = "logon_as_service_#{SecureRandom.uuid.gsub(/-/,'')}"
54
55
  user_element.add_attribute('Name', account)
55
56
  user_element.add_attribute('LogonAsService', service[:logonasservice])
@@ -57,7 +58,6 @@ class Service
57
58
  user_element.add_attribute('UpdateIfExists', 'yes')
58
59
 
59
60
  service.delete(:logonasservice)
60
- service.delete(:domain) if(service.key?(:domain))
61
61
  end
62
62
  service_element = parent_element.add_element('ServiceInstall')
63
63
 
data/lib/wixgem.rb CHANGED
@@ -281,43 +281,43 @@ class Wix
281
281
  end
282
282
 
283
283
  def self.copy_install_files(directory, input)
284
- files = files(input)
284
+ files = files(input)
285
285
 
286
- missing_files = []
287
- files.each do |file|
288
- if(File.file?(file))
286
+ missing_files = []
287
+ files.each do |file|
288
+ if(File.exists?(file))
289
289
  install_path = file
290
290
  if(input.has_key?(:modify_file_paths))
291
291
  input[:modify_file_paths].each { |regex, replacement_string| install_path = install_path.gsub(regex, replacement_string) }
292
292
  end
293
- raise "Invalid relative installation path: #{install_path}" if(install_path.include?(':'))
293
+ raise "Invalid relative installation path: #{install_path}" if(install_path.include?(':'))
294
294
 
295
295
  install_path = "#{directory}/#{install_path}"
296
- FileUtils.mkpath(File.dirname(install_path)) unless(Dir.exists?(File.dirname(install_path)))
297
- FileUtils.cp(file, install_path, { preserve: true })
298
- elsif(!File.exists?(file))
299
- missing_files.insert(missing_files.length, file)
300
- end
296
+ FileUtils.mkpath(File.dirname(install_path)) unless(Dir.exists?(File.dirname(install_path)))
297
+ FileUtils.cp(file, install_path, preserve: true)
298
+ elsif(!File.exists?(file))
299
+ missing_files.insert(missing_files.length, file)
301
300
  end
301
+ end
302
302
 
303
303
  if(@debug)
304
- if(files.length > 0)
305
- max_path = files.max { |a, b| a.length <=> b.length }
306
- columen_size = max_path.length + 10
307
- end
304
+ if(files.length > 0)
305
+ max_path = files.max { |a, b| a.length <=> b.length }
306
+ columen_size = max_path.length + 10
307
+ end
308
308
 
309
- ingore_files = self.ignore_files(input)
310
- if(input.has_key?(:ignore_files))
311
- @logger << "------------------------------------ ignoring files -----------------------------------" unless(@logger.nil?)
312
- input[:ignore_files].each { |file| @logger << file }
313
- end
309
+ ingore_files = self.ignore_files(input)
310
+ if(input.has_key?(:ignore_files))
311
+ @logger << "------------------------------------ ignoring files -----------------------------------" unless(@logger.nil?)
312
+ input[:ignore_files].each { |file| @logger << file }
313
+ end
314
314
 
315
- @logger << "------------------------------------ Installation Paths -----------------------------------" unless(@logger.nil?)
316
- @logger << "%-#{columen_size}s %s\n" % ['File path', 'Installation Path'] unless(@logger.nil?)
317
- files.reject! { |f| ingore_files.include?(f) }
315
+ @logger << "------------------------------------ Installation Paths -----------------------------------" unless(@logger.nil?)
316
+ @logger << "%-#{columen_size}s %s\n" % ['File path', 'Installation Path'] unless(@logger.nil?)
317
+ files.reject! { |f| ingore_files.include?(f) }
318
318
 
319
- files.each do |file|
320
- if(File.file?(file))
319
+ files.each do |file|
320
+ if(File.exists?(file))
321
321
  install_path = file
322
322
  if(input.has_key?(:modify_file_paths))
323
323
  input[:modify_file_paths].each { |regex, replacement_string| install_path = install_path.gsub(regex, replacement_string) }
@@ -325,22 +325,22 @@ class Wix
325
325
  @logger << "%-#{columen_size}s %s\n" % [file, install_path] unless(@logger.nil?)
326
326
  end
327
327
  end
328
- @logger << "-------------------------------------------------------------------------------------------" unless(@logger.nil?)
329
- end
328
+ @logger << "-------------------------------------------------------------------------------------------" unless(@logger.nil?)
329
+ end
330
330
 
331
- raise 'No files were given to wixgem' if(files.length == 0)
331
+ raise 'No files were given to wixgem' if(files.length == 0)
332
332
 
333
- if(missing_files.length > 0)
334
- missing_files_str = ''
335
- missing_files.each { |f|
336
- if(missing_files_str.empty?)
337
- missing_files_str = f
338
- else
339
- missing_files_str = "#{missing_files_str}, #{f}"
340
- end
341
- }
342
- raise "Wixgem missing files: #{missing_files_str}"
343
- end
333
+ if(missing_files.length > 0)
334
+ missing_files_str = ''
335
+ missing_files.each { |f|
336
+ if(missing_files_str.empty?)
337
+ missing_files_str = f
338
+ else
339
+ missing_files_str = "#{missing_files_str}, #{f}"
340
+ end
341
+ }
342
+ raise "Wixgem missing files: #{missing_files_str}"
343
+ end
344
344
  end
345
345
 
346
346
  def self.modify_binary_files(input)
@@ -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.107.0
4
+ version: 0.110.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Marshall
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-07-18 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
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
- name: dev
70
+ name: raykit
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
@@ -124,7 +124,7 @@ dependencies:
124
124
  version: '0'
125
125
  description: Simple Ruby interface to facilitate creating and compiling windows installation
126
126
  files with the Wix Toolset.
127
- email:
127
+ email:
128
128
  executables: []
129
129
  extensions: []
130
130
  extra_rdoc_files: []
@@ -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
@@ -148,7 +150,7 @@ homepage: http://rubygems.org/gems/wixgem
148
150
  licenses:
149
151
  - Apache 2.0
150
152
  metadata: {}
151
- post_install_message:
153
+ post_install_message:
152
154
  rdoc_options: []
153
155
  require_paths:
154
156
  - lib
@@ -163,8 +165,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
163
165
  - !ruby/object:Gem::Version
164
166
  version: '0'
165
167
  requirements: []
166
- rubygems_version: 3.0.3
167
- signing_key:
168
+ rubygems_version: 3.2.15
169
+ signing_key:
168
170
  specification_version: 4
169
171
  summary: Simple Ruby interface to facilitate working with Wix Toolset
170
172
  test_files: []