wixgem 0.59.0 → 0.62.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9f19f075a64ef471bc3a74d93348d15e9064040a
4
- data.tar.gz: e7be58797e3d6eae9ae2f6b95a753e218845008f
3
+ metadata.gz: 5b6b2f61ea32efb419ef261aba962de55b9dec07
4
+ data.tar.gz: a6475f9f4c3f836c333ca324cbd0b123eb713e9a
5
5
  SHA512:
6
- metadata.gz: 82ec730418cdb61d38795c874c6d23c5041c85e7c8a0efe3f5cbf1306e82b6ecc0f5a9fb81d16080636eba2fc511d023d03291bb142a637548e05a0c130b6ae2
7
- data.tar.gz: 22858d0fc49d4cfc0e8bd490af0902cb59606ca5d357c37e6b5c19d0670d289d454d2320eb127f14b23e3d92174f2f72358da2100ed3713daaed33f6ba3711a1
6
+ metadata.gz: 1f00a242f5f8aa952448708b09aaf3044fe20cf12a3bc88f60628bfd2265e0166fef0bbb721fdc9d1b10960fe174a519abdc4556419d7c965ee32e7c0c3f13c8
7
+ data.tar.gz: 67311a57be6cf3084e23bf0463cc7529a98674c4d3e6d844e38dd32dc9053d6bcfd8c90c854e5b50b940742ae5de3dd15c370285d8a6ca75fa9ad90ded8df839
data/example/example.msi CHANGED
Binary file
@@ -0,0 +1,15 @@
1
+ ------------------------------------ Installation Paths -----------------------------------
2
+ File path Installation Path
3
+ ./example.msm ./example.msm
4
+ -------------------------------------------------------------------------------------------
5
+ ----------------------------------------------------------------------------
6
+ {:output=>"", :error=>"", :exit_code=>0, :ignore_exit_code=>false, :debug=>false, :quiet=>true, :command=>"\"C:\\Development\\dep\\OpenSource\\WixToolset\\3.9/bin/heat.exe\" dir . -template product -cg InstallionFiles -gg -nologo -srd -o \"example.wxs\""}
7
+ ----------------------------------------------------------------------------
8
+ {:output=>"Windows Installer XML Toolset Compiler version 3.9.1006.0\nCopyright (c) Outercurve Foundation. All rights reserved.\n\nexample.wxs\n", :error=>"", :exit_code=>0, :ignore_exit_code=>false, :debug=>false, :quiet=>true, :command=>"\"C:\\Development\\dep\\OpenSource\\WixToolset\\3.9/bin/candle.exe\" -out \"example.wixobj\" \"example.wxs\""}
9
+ --------------------------- std output -----------------------------------
10
+ Windows Installer XML Toolset Compiler version 3.9.1006.0
11
+ Copyright (c) Outercurve Foundation. All rights reserved.
12
+
13
+ example.wxs
14
+ ----------------------------------------------------------------------------
15
+ {:output=>"", :error=>"", :exit_code=>0, :ignore_exit_code=>false, :debug=>false, :quiet=>true, :command=>"\"C:\\Development\\dep\\OpenSource\\WixToolset\\3.9/bin/light.exe\" -nologo -out \"E:/Development/wrk/github/wixgem/example/example.msi\" \"example.wixobj\""}
@@ -0,0 +1,16 @@
1
+ <?xml version='1.0' encoding='UTF-8'?>
2
+ <Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>
3
+ <Product Id='{53554FC3-4143-48A8-82D9-9D39442FABBC}' Language='1033' Manufacturer='Not Set' Name='example' UpgradeCode='{a62c35a7-6a6d-4392-822b-f6aca7eef88b}' Version='0.62.0'>
4
+ <Package Compressed='yes' InstallerVersion='450'/>
5
+ <Directory Id='TARGETDIR' Name='SourceDir'><Merge DiskId='1' Id='merge2F9F417DD98EE2C2308398A4A8E9E006' Language='1033' SourceFile='.\example.msm'/></Directory>
6
+ <Feature Id='ProductFeature' Level='1' Title='Files to Install'>
7
+ <ComponentGroupRef Id='InstallionFiles'/>
8
+ <MergeRef Id='merge2F9F417DD98EE2C2308398A4A8E9E006'/></Feature>
9
+ <Media Cabinet='product.cab' EmbedCab='yes' Id='1'/>
10
+ <CustomAction Execute='firstSequence' Id='SetTARGETDIR' Property='TARGETDIR' Return='check' Value='[ProgramFilesFolder][ProductName]'/><InstallExecuteSequence><Custom Action='SetTARGETDIR' Before='CostInitialize'/></InstallExecuteSequence><InstallUISequence><Custom Action='SetTARGETDIR' Before='CostInitialize'/></InstallUISequence><AdminExecuteSequence><Custom Action='SetTARGETDIR' Before='CostInitialize'/></AdminExecuteSequence><AdminUISequence><Custom Action='SetTARGETDIR' Before='CostInitialize'/></AdminUISequence></Product>
11
+ <Fragment>
12
+ <ComponentGroup Id='InstallionFiles'>
13
+
14
+ </ComponentGroup>
15
+ </Fragment>
16
+ </Wix>
data/example/example.msm CHANGED
Binary file
data/example/rakefile.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'wixgem'
2
2
 
3
- #Wixgem::Wix.install_path = 'E:\Development\dep\OpenSource\WixToolset\3.9'
4
- Wixgem::Wix.install_path = '<Path to the root directory of the wix toolset>'
3
+ Wixgem::Wix.install_path = 'C:\Development\dep\OpenSource\WixToolset\3.9'
4
+ #Wixgem::Wix.install_path = '<Path to the root directory of the wix toolset>'
5
5
 
6
6
  task :create_installation_files do
7
7
  FileUtils.mkpath('./install_files/directory')
@@ -20,7 +20,7 @@ desc "Generate an installation msi file"
20
20
  task :installation => [:mergemodule] do
21
21
  installation_files = Dir.glob('./example.msm')
22
22
  Wixgem::Wix.make_installation("./example.msi",
23
- { upgrade_code: '{a62c35a7-6a6d-4392-822b-f6aca7eef88b}',
23
+ { upgrade_code: '{a62c35a7-6a6d-4392-822b-f6aca7eef88b}', debug: true,
24
24
  files: installation_files }
25
25
  )
26
26
  end
data/lib/shortcut.rb CHANGED
@@ -28,18 +28,15 @@ class Shortcut
28
28
  shortcut_element.attributes['Arguments'] = @hash[:arguments] if(@hash.has_key?(:arguments))
29
29
 
30
30
  shortcut_name = File.basename(@file)
31
- shortcut_name = @hash[:name] if(@hash.has_key?(:name))
31
+ if(@hash.has_key?(:name))
32
+ shortcut_name = @hash[:name]
33
+ else
34
+ @hash[:name] = shortcut_name
35
+ end
32
36
  shortcut_element.attributes['Name'] = shortcut_name
33
37
 
34
38
  shortcut_element.attributes['Description'] = @hash[:description] if(@hash.has_key?(:description))
35
- if(@hash.has_key?(:directory))
36
- case @hash[:directory]
37
- when :desktop
38
- shortcut_element.attributes['Directory'] = 'DesktopFolder'
39
- else
40
- shortcut_element.attributes['Directory'] = @hash[:directory]
41
- end
42
- end
39
+ shortcut_element.attributes['Directory'] = 'DesktopFolder'
43
40
 
44
41
  shortcut_element.attributes['Advertise']="yes"
45
42
  shortcut_element.attributes['Advertise'] = "no" if(@hash.has_key?(:advertise) && !@hash[:advertise])
@@ -0,0 +1,129 @@
1
+ require 'rexml/document'
2
+ require 'SecureRandom'
3
+
4
+ module Wixgem
5
+
6
+ class Shortcut
7
+
8
+ def initialize(file, hash)
9
+ @file = file
10
+ @hash = hash
11
+ end
12
+
13
+ def create(xml_doc)
14
+ raise "Shortcut #{@file} does not exist" unless(File.exists?(@file))
15
+
16
+ file_elements = REXML::XPath.match(xml_doc, "//File[@Source='.\\#{@file.gsub(/\//,'\\')}']")
17
+ raise "Shortcut #{@file} does not match an installation file" if(file_elements.length == 0)
18
+
19
+ case @hash[:directory]
20
+ when :desktop
21
+ create_file_shortcut(file_elements[0])
22
+ xml_doc = create_desktop_folder(xml_doc)
23
+ # when :start_menu
24
+ # program_files_element = create_start_menu_shortcut(xml_doc)
25
+ # create_start_menu_item(program_files_element)
26
+ else
27
+ raise 'Support for #{:directory} shortcut has not been added'
28
+ end
29
+
30
+ return xml_doc
31
+ end
32
+
33
+ def create_file_shortcut(file_element)
34
+ shortcut_element = file_element.add_element 'Shortcut'
35
+
36
+ shortcut_element.attributes['Id'] = "Shortcut_#{SecureRandom.uuid.gsub(/-/,'')}"
37
+ shortcut_element.attributes['Arguments'] = @hash[:arguments] if(@hash.has_key?(:arguments))
38
+
39
+ shortcut_name = File.basename(@file)
40
+ if(@hash.has_key?(:name))
41
+ shortcut_name = @hash[:name]
42
+ else
43
+ @hash[:name] = shortcut_name
44
+ end
45
+ shortcut_element.attributes['Name'] = shortcut_name
46
+
47
+ shortcut_element.attributes['Description'] = @hash[:description] if(@hash.has_key?(:description))
48
+ shortcut_element.attributes['Directory'] = 'DesktopFolder'
49
+
50
+ shortcut_element.attributes['Advertise']="yes"
51
+ shortcut_element.attributes['Advertise'] = "no" if(@hash.has_key?(:advertise) && !@hash[:advertise])
52
+ create_icon_element(shortcut_element) if(@hash.has_key?(:icon))
53
+
54
+ return shortcut_element
55
+ end
56
+
57
+ def create_icon_element(shortcut_element)
58
+ icon_element = shortcut_element.add_element 'Icon'
59
+ icon_element.attributes['Id'] = File.basename(@hash[:icon])
60
+ icon_element.attributes['SourceFile'] = ".\\#{@hash[:icon].gsub(/\//, '\\')}"
61
+ return icon_element
62
+ end
63
+
64
+ def create_desktop_folder(xml_doc)
65
+ desktop_elements = REXML::XPath.match(xml_doc, "//DesktopFolder")
66
+ if(desktop_elements.length == 0)
67
+ wix_elements = REXML::XPath.match(xml_doc, "//Wix")
68
+ fragment_element = wix_elements[0].add_element 'Fragment'
69
+ target_dir = fragment_element.add_element 'DirectoryRef', { 'Id' => 'TARGETDIR' }
70
+ target_dir.add_element 'Directory', { 'Id' => 'DesktopFolder', 'Name' => 'Desktop' }
71
+ end
72
+ return xml_doc
73
+ end
74
+
75
+ # def create_start_menu_shortcut(program_folder_element)
76
+ # puts "1"
77
+ # shortcut_element = program_folder_element.add_element 'Shortcut'
78
+ #
79
+ # shortcut_element.attributes['Id'] = 'ApplicationStartMenuShortcut'
80
+ #
81
+ # shortcut_name = File.basename(@file)
82
+ # ext = File.extname(@file)
83
+ # if(@hash.has_key?(:name))
84
+ # shortcut_name = @hash[:name]
85
+ # else
86
+ # shortcut_name = File.basename(shortcut_name, ext) if(ext != '')
87
+ # @hash[:name] = shortcut_name
88
+ # end
89
+ # shortcut_element.attributes['Name'] = shortcut_name
90
+
91
+ # puts "2"
92
+ # shortcut_element.attributes['Description'] = @hash[:description] if(@hash.has_key?(:description))
93
+ # shortcut_element.attributes['Target'] = @file
94
+ #
95
+ # puts "3"
96
+ # remove_folder_element = program_folder_element.add_element 'RemoveFolder'
97
+ # remove_folder_element.attributes['Id'] = 'ApplicationProgramsFolder'
98
+ # remove_folder_element.attributes['On'] = 'uninstall'
99
+
100
+ # puts "4"
101
+ # registry_folder_element = program_folder_element.add_element 'RegistryValue'
102
+ # remove_folder_element.attributes['Root'] = 'HKCU'
103
+ # remove_folder_element.attributes['Key'] = "Software\\Microsoft\\#{shortcut_name.gsub(/ /,'')}"
104
+ # remove_folder_element.attributes['Name'] = 'installed'
105
+ # remove_folder_element.attributes['Type'] = 'integer'
106
+ # remove_folder_element.attributes['Value'] = '1'
107
+ # remove_folder_element.attributes['KeyPath'] = 'yes'
108
+
109
+ # return shortcut_element
110
+ # end
111
+
112
+ # def create_start_menu_component(xml_doc)
113
+ # app_programs_elements = REXML::XPath.match(xml_doc, "//ApplicationProgramsFolder")
114
+ # app_programs_element = nil
115
+ # if(app_programs_elements.length == 0)
116
+ # wix_elements = REXML::XPath.match(xml_doc, "//Wix")
117
+ # fragment_element = wix_elements[0].add_element 'Fragment'
118
+ # app_programs_element = fragment_element.add_element 'DirectoryRef', { 'Id' => 'ApplicationProgramsFolder' }
119
+ # else if(app_programs_elements.length == 1)
120
+ # app_programs_element = app_programs_elements[0]
121
+ # else
122
+ # raise "Wix file contains multiple ApplicationProgramsFolder's"
123
+ # end
124
+
125
+ # return app_programs_element.add_element 'Component', { 'Id' => 'ApplicationShortcut', 'Guid' => '{a9e94876-60b5-4038-8baa-ea76a3f9ebe1}' }
126
+ # end
127
+ end
128
+
129
+ #end
data/lib/wixgem.rb CHANGED
@@ -80,6 +80,7 @@ class Wix
80
80
  product = REXML::XPath.match(xml_doc, '//Wix/Product')
81
81
  return xml_doc if(product.length == 0)
82
82
 
83
+ product[0].add_element 'SetProperty', { 'Id' => 'ARPINSTALLLOCATION', 'Value' => '#{install_path}', 'After' => 'CostFinalize', 'Sequence' => 'both' }
83
84
  product[0].add_element 'CustomAction', { 'Id' => 'SetTARGETDIR', 'Property' => 'TARGETDIR', 'Value' => "#{install_path}", 'Execute' => 'firstSequence', 'Return' => 'check'}
84
85
 
85
86
  install_execute_sequence = product[0].add_element 'InstallExecuteSequence'
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.59.0
4
+ version: 0.62.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: 2015-09-03 00:00:00.000000000 Z
11
+ date: 2015-11-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -76,6 +76,8 @@ files:
76
76
  - LICENSE
77
77
  - README.md
78
78
  - example/example.msi
79
+ - example/example.msi.log
80
+ - example/example.msi.wxs
79
81
  - example/example.msm
80
82
  - example/install_files/directory/file2.txt
81
83
  - example/install_files/file1.txt
@@ -84,6 +86,7 @@ files:
84
86
  - lib/command.rb
85
87
  - lib/file.rb
86
88
  - lib/shortcut.rb
89
+ - lib/shortcut.rb.kev
87
90
  - lib/wixgem.rb
88
91
  homepage: http://rubygems.org/gems/wixgem
89
92
  licenses: