wixgem 0.0.13 → 0.0.14
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/wixgem.rb +58 -13
- metadata +18 -30
- data/lib/templates/Install.wxs +0 -26
- data/lib/templates/mergemodule.wxs +0 -15
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 85ca0608a1c377cdb8475522b47ed8753b3194d3
|
4
|
+
data.tar.gz: ddb8f3e03e2fb7c7bc99e311ed4e633e581d79e6
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 72062f7807acd5a2e3fc23168196481279c8741e00cb1b7c89ff69bcee494161b22133e2a198a507031ed0242b75fd5005ab0d3c925f038f858e0f2c5119a1d0
|
7
|
+
data.tar.gz: c98837859540b2eb65136998fc650e63a31508274d6e27693d44091b544828195d65c22d71c89afc414ed10c377053973b70a87bf1aece9d963f61260c0775fd
|
data/lib/wixgem.rb
CHANGED
@@ -3,15 +3,20 @@ require 'SecureRandom'
|
|
3
3
|
require 'tmpdir.rb'
|
4
4
|
|
5
5
|
class Wix
|
6
|
-
def self.install_path=(
|
7
|
-
|
8
|
-
@install_path = value
|
6
|
+
def self.install_path=(path)
|
7
|
+
@install_path = path
|
9
8
|
end
|
10
|
-
|
11
9
|
def self.install_path
|
12
|
-
|
10
|
+
return @install_path
|
13
11
|
end
|
14
|
-
|
12
|
+
|
13
|
+
def self.debug=(bool)
|
14
|
+
@debug = bool
|
15
|
+
end
|
16
|
+
def self.debug
|
17
|
+
return @debug
|
18
|
+
end
|
19
|
+
|
15
20
|
def self.make_mergemodule(output, input)
|
16
21
|
gem_dir = File.dirname(__FILE__)
|
17
22
|
apply_wix_template(output, input, "#{gem_dir}/templates/mergemodule.wxs")
|
@@ -22,7 +27,37 @@ class Wix
|
|
22
27
|
apply_wix_template(output, input, "#{gem_dir}/templates/Install.wxs")
|
23
28
|
end
|
24
29
|
|
25
|
-
private
|
30
|
+
private
|
31
|
+
def self.manage_upgrade(wxs_text, input)
|
32
|
+
if(input.kind_of?(Hash) &&
|
33
|
+
input.has_key?(:remove_existing_products) &&
|
34
|
+
input[:remove_existing_products])
|
35
|
+
|
36
|
+
raise 'Hash must have a version key if the hash has a :remove_existing_products key' unless(input.has_key?(:version))
|
37
|
+
raise 'Hash must have an upgrade_code key if the hash has a :remove_existing_products key' unless(input.has_key?(:upgrade_code))
|
38
|
+
|
39
|
+
upgrade = "
|
40
|
+
<Upgrade Id=\"#{input[:upgrade_code]}\">
|
41
|
+
<UpgradeVersion Minimum=\"#{input[:version]}\"
|
42
|
+
OnlyDetect='yes'
|
43
|
+
Property='NEWPRODUCTFOUND' />
|
44
|
+
<UpgradeVersion Minimum='1.0.0'
|
45
|
+
IncludeMinimum='yes'
|
46
|
+
Maximum=\"#{input[:version]}\"
|
47
|
+
IncludeMaximum='no'
|
48
|
+
Property='UPGRADEFOUND' />
|
49
|
+
</Upgrade>
|
50
|
+
<CustomAction"
|
51
|
+
wxs_text = wxs_text.gsub(/<CustomAction/, upgrade)
|
52
|
+
|
53
|
+
remove_existing_products = " <RemoveExistingProducts After='InstallValidate' />
|
54
|
+
</InstallExecuteSequence>"
|
55
|
+
wxs_text = wxs_text.gsub(/<\/InstallExecuteSequence>/, remove_existing_products)
|
56
|
+
end
|
57
|
+
|
58
|
+
return wxs_text
|
59
|
+
end
|
60
|
+
|
26
61
|
def self.manage_msm_files(wxs_text)
|
27
62
|
indent_merge = ' '
|
28
63
|
indent_directory = ' '
|
@@ -47,7 +82,7 @@ class Wix
|
|
47
82
|
directory_element = "<Directory Id='TARGETDIR' Name='SourceDir'>\n#{merge_ids}#{indent_directory}</Directory>"
|
48
83
|
wxs_text = wxs_text.gsub('<Directory Id="TARGETDIR" Name="SourceDir" />', directory_element)
|
49
84
|
|
50
|
-
wxs_text = wxs_text.gsub(/\s+<\/Feature>/, "\n#{merge_refs}</Feature>")
|
85
|
+
wxs_text = wxs_text.gsub(/\s+<\/Feature>/, "\n#{merge_refs} </Feature>")
|
51
86
|
|
52
87
|
return wxs_text
|
53
88
|
end
|
@@ -58,22 +93,28 @@ class Wix
|
|
58
93
|
|
59
94
|
files.each do |file|
|
60
95
|
if(File.file?(file))
|
61
|
-
|
96
|
+
install_path = file
|
97
|
+
if(input.kind_of?(Hash) && input.has_key?(:modify_install_path))
|
98
|
+
input[:modify_install_path].each { |regex, replacement_string| install_path = install_path.gsub(regex, replacement_string) }
|
99
|
+
end
|
100
|
+
|
101
|
+
install_path = "#{directory}/#{install_path}"
|
62
102
|
FileUtils.mkpath(File.dirname(install_path)) unless(Dir.exists?(File.dirname(install_path)))
|
63
103
|
FileUtils.cp(file, install_path)
|
64
|
-
# else if(!Dir.exists?(file) && !File.exists?(file))
|
65
|
-
# raise "File: '#{file}' does not exist!"
|
66
104
|
end
|
67
105
|
end
|
68
106
|
end
|
69
107
|
|
70
108
|
def self.create_wxs_file(wxs_file, input, ext)
|
109
|
+
@debug = input[:debug] if(input.kind_of?(Hash) && input.has_key?(:debug))
|
110
|
+
|
71
111
|
template_option = "-template product"
|
72
112
|
template_option = "-template module" unless(ext == ".msi")
|
73
113
|
|
74
114
|
stdout = %x[\"#{install_path}/bin/heat.exe\" dir . #{template_option} -cg InstallionFiles -gg -nologo -srd -o \"#{wxs_file}\"]
|
75
115
|
raise "#{stdout}\nFailed to generate .wxs file" unless(File.exists?(wxs_file))
|
76
116
|
|
117
|
+
|
77
118
|
product_name = File.basename(wxs_file, '.wxs')
|
78
119
|
product_name = input[:product_name] if(input.kind_of?(Hash) && input.has_key?(:product_name))
|
79
120
|
|
@@ -85,6 +126,9 @@ class Wix
|
|
85
126
|
|
86
127
|
product_code = ''
|
87
128
|
product_code = input[:product_code] if(input.kind_of?(Hash) && input.has_key?(:product_code))
|
129
|
+
|
130
|
+
upgrade_code = ''
|
131
|
+
upgrade_code = input[:upgrade_code] if(input.kind_of?(Hash) && input.has_key?(:upgrade_code))
|
88
132
|
|
89
133
|
wxs_text = File.read(wxs_file)
|
90
134
|
|
@@ -96,6 +140,7 @@ class Wix
|
|
96
140
|
|
97
141
|
wxs_text = wxs_text.gsub(/Version=\"1.0.0.0\"/) { |s| s = "Version=\"#{product_version}\"" } unless(product_version.empty?)
|
98
142
|
wxs_text = wxs_text.gsub(/Product Id=\"[^\"]+\"/) { |s| s = "Product Id=\"#{product_code}\"" } unless(product_code.empty?)
|
143
|
+
wxs_text = wxs_text.gsub(/UpgradeCode=\"[^\"]+\"/) { |s| s = "UpgradeCode=\"#{upgrade_code}\"" } unless(upgrade_code.empty?)
|
99
144
|
|
100
145
|
install_path = '[ProgramFilesFolder][ProductName]'
|
101
146
|
install_path = "[ProgramFilesFolder][Manufacturer]\\[ProductName]" unless(manufacturer == 'Not Set')
|
@@ -115,6 +160,7 @@ class Wix
|
|
115
160
|
</Product>"
|
116
161
|
wxs_text = wxs_text.gsub(/<\/Product>/) { |s| s = custom_action }
|
117
162
|
|
163
|
+
wxs_text = manage_upgrade(wxs_text,input)
|
118
164
|
wxs_text = manage_msm_files(wxs_text)
|
119
165
|
|
120
166
|
File.open(wxs_file, 'w') { |f| f.puts(wxs_text) }
|
@@ -139,8 +185,6 @@ class Wix
|
|
139
185
|
|
140
186
|
output_absolute_path = File.absolute_path(output)
|
141
187
|
|
142
|
-
#dir = 'tmp_dir'
|
143
|
-
#FileUtils.rm_rf(dir) if(Dir.exists?(dir))
|
144
188
|
Dir.mktmpdir do |dir|
|
145
189
|
copy_install_files(dir, input)
|
146
190
|
|
@@ -149,6 +193,7 @@ class Wix
|
|
149
193
|
create_wxs_file(wxs_file, input, ext)
|
150
194
|
create_output(wxs_file, output_absolute_path)
|
151
195
|
end
|
196
|
+
FileUtils.cp(wxs_file, output_absolute_path.gsub(ext,'.wxs')) if(@debug)
|
152
197
|
end
|
153
198
|
pdb_file = output_absolute_path.gsub(ext,'.wixpdb')
|
154
199
|
FileUtils.rm(pdb_file) if(File.exists?(pdb_file))
|
metadata
CHANGED
@@ -1,83 +1,74 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wixgem
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.14
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Kevin Marshall
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2015-01-
|
11
|
+
date: 2015-01-10 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: bundler
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: '0'
|
22
20
|
type: :development
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: '0'
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: rake
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: '0'
|
38
34
|
type: :development
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '0'
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rspec
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - ~>
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - ~>
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: dev_tasks
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - ~>
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - ~>
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
|
-
description:
|
79
|
-
|
80
|
-
|
69
|
+
description: 'Simple Ruby interface to facilitate creating and compiling windows installation
|
70
|
+
files with the Wix Toolset.\n\nNote: This gem currently does not handle registration
|
71
|
+
of COM objects or registry entries.'
|
81
72
|
email: KCCKSMarshall@gmail.com
|
82
73
|
executables: []
|
83
74
|
extensions: []
|
@@ -85,33 +76,30 @@ extra_rdoc_files: []
|
|
85
76
|
files:
|
86
77
|
- LICENSE
|
87
78
|
- README.md
|
88
|
-
- lib/templates/Install.wxs
|
89
|
-
- lib/templates/mergemodule.wxs
|
90
79
|
- lib/wixgem.rb
|
91
80
|
homepage: http://rubygems.org/gems/wixgem
|
92
81
|
licenses:
|
93
82
|
- Apache 2.0
|
83
|
+
metadata: {}
|
94
84
|
post_install_message:
|
95
85
|
rdoc_options: []
|
96
86
|
require_paths:
|
97
87
|
- lib
|
98
88
|
required_ruby_version: !ruby/object:Gem::Requirement
|
99
|
-
none: false
|
100
89
|
requirements:
|
101
|
-
- -
|
90
|
+
- - '>='
|
102
91
|
- !ruby/object:Gem::Version
|
103
92
|
version: 1.9.1
|
104
93
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
94
|
requirements:
|
107
|
-
- -
|
95
|
+
- - '>='
|
108
96
|
- !ruby/object:Gem::Version
|
109
97
|
version: '0'
|
110
98
|
requirements: []
|
111
99
|
rubyforge_project:
|
112
|
-
rubygems_version:
|
100
|
+
rubygems_version: 2.2.0
|
113
101
|
signing_key:
|
114
|
-
specification_version:
|
102
|
+
specification_version: 4
|
115
103
|
summary: Simple Ruby interface to facilitate working with Wix Toolset
|
116
104
|
test_files: []
|
117
105
|
has_rdoc:
|
data/lib/templates/Install.wxs
DELETED
@@ -1,26 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
3
|
-
<Product Id="PRODUCT_CODE" Name="PRODUCT_NAME" Language="1033" Version="VERSION" Manufacturer="MANUFACTURER" UpgradeCode="UPGRADE_CODE">
|
4
|
-
<Package InstallerVersion="200" Compressed="yes" InstallScope="perMachine" />
|
5
|
-
|
6
|
-
<MajorUpgrade DowngradeErrorMessage="A newer version of [ProductName] is already installed." />
|
7
|
-
<Media Id="1" Cabinet="WixgemTest.cab" EmbedCab="yes" />
|
8
|
-
|
9
|
-
<!-- Step 1: Define the directory structure -->
|
10
|
-
<Directory Id="TARGETDIR" Name="SourceDir">
|
11
|
-
<Directory Id="ProgramFilesFolder">
|
12
|
-
INSTALL_DIR
|
13
|
-
</Directory>
|
14
|
-
</Directory>
|
15
|
-
|
16
|
-
<!-- Step 2: Add files to installer package -->
|
17
|
-
<DirectoryRef Id="INSTALLFOLDER">
|
18
|
-
FILES
|
19
|
-
</DirectoryRef>
|
20
|
-
|
21
|
-
<!-- Step 3: Tell Wix to install the files-->
|
22
|
-
<Feature Id="ProductFeature" Title="PRODUCT_NAME Installation" Level="1">
|
23
|
-
COMPONENT_REFS
|
24
|
-
</Feature>
|
25
|
-
</Product>
|
26
|
-
</Wix>
|
@@ -1,15 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="utf-8"?>
|
2
|
-
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
|
3
|
-
<Module Id="MODULE_NAME" Language="1033" Version="VERSION">
|
4
|
-
<Package Id="PRODUCT_CODE" InstallerVersion="200" Manufacturer="MANUFACTURER" />
|
5
|
-
COMPONENT_REFS
|
6
|
-
<Directory Id="TARGETDIR" Name="SourceDir">
|
7
|
-
<Directory Id="MergeRedirectFolder" />
|
8
|
-
</Directory>
|
9
|
-
</Module>
|
10
|
-
<Fragment>
|
11
|
-
<DirectoryRef Id="MergeRedirectFolder">
|
12
|
-
FILES
|
13
|
-
</DirectoryRef>
|
14
|
-
</Fragment>
|
15
|
-
</Wix>
|