wixgem 0.17.0 → 0.18.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: dcab5b805971c3bd561d29a61cdb4e65df483482
4
- data.tar.gz: cc14dbc41912184286544ce90319ada1ab3829cb
3
+ metadata.gz: 534047f23141f404ce3310c55db3c599157cbeb7
4
+ data.tar.gz: 7574488f9c177562ad081f4fad69e88b8b13e95f
5
5
  SHA512:
6
- metadata.gz: 16c8423f29f4b45b5f4ba5007a2c8f2d5e7084eca375cd3928774085b540cfb29bfa5f174c36f1467c2e1b7008c6031b7793f5231e41fc0ddc3887b4c17cc22e
7
- data.tar.gz: a402219a160d556a391be7912be1b4f6da0a8d45254a37444238eefaa034361f5b2897c8e0aef870e525a11b0524b199ddb215b3b58e390435a62d7bbf0d9f0f
6
+ metadata.gz: 373487b87ce98a131e59aa09fcbc8f0fb08a058816805299ebb6b0b1fe57c3ae24ca688bb9cc24f837b919bd2f9ba4f3ebd89d02062640d3b2e3d74807affed1
7
+ data.tar.gz: 6f1444e90174f06dd96aa70f5713502710783dadd00cecb4acd915992298d054108b50b72a5be5be0ea4e828a3cfbcbe9bd7a0ad42e414cca3a3c095bdb559b8
data/lib/wixgem.rb CHANGED
@@ -46,7 +46,6 @@ class Wix
46
46
 
47
47
  raise 'Hash must have a version key if the hash has a :remove_existing_products key' unless(input.has_key?(:version))
48
48
  raise 'Hash must have an upgrade_code key if the hash has a :remove_existing_products key' unless(input.has_key?(:upgrade_code))
49
-
50
49
 
51
50
  upgrade = product[0].add_element 'Upgrade', { 'Id' => input[:upgrade_code] }
52
51
  upgrade.add_element 'UpgradeVersion', { 'Minimum' => input[:version], 'OnlyDetect'=>'yes', 'Property'=>'NEWPRODUCTFOUND' }
@@ -106,6 +105,9 @@ class Wix
106
105
  files = input
107
106
  files = input[:files] if(input.kind_of?(Hash))
108
107
 
108
+ raise 'No files were given to wixgem' if(files.length == 0)
109
+
110
+ missing_files = []
109
111
  files.each do |file|
110
112
  if(File.file?(file))
111
113
  install_path = file
@@ -116,17 +118,27 @@ class Wix
116
118
  install_path = "#{directory}/#{install_path}"
117
119
  FileUtils.mkpath(File.dirname(install_path)) unless(Dir.exists?(File.dirname(install_path)))
118
120
  FileUtils.cp(file, install_path)
121
+ elsif(!File.exists?(file))
122
+ missing_files.insert(missing_files.length, file)
119
123
  end
120
124
  end
125
+
126
+ if(missing_files.length > 0)
127
+ missing_files_str = ''
128
+ missing_files.each { |f| msg = "#{missing_files_str}, #{f}" }
129
+ raise "Missing files: #{missing_files_str}"
130
+ end
121
131
  end
122
132
 
123
133
  def self.create_wxs_file(wxs_file, input, ext)
124
- @debug = input[:debug] if(!@debug && input.kind_of?(Hash) && input.has_key?(:debug))
125
-
126
134
  template_option = "-template product"
127
135
  template_option = "-template module" unless(ext == ".msi")
136
+
137
+ wix_cmd = "\"#{install_path}/bin/heat.exe\" dir . #{template_option} -cg InstallionFiles -gg -nologo -srd -o \"#{wxs_file}\""
138
+ wix_cmd = wix_cmd.gsub(/-srd/, '-svb6 -srd') if(input.kind_of?(Hash) && input.has_key?(:has_vb6_files))
139
+ File.open("#{File.basename(wxs_file,'.wxs')}.wix_cmds", 'w') { |f| f.puts wix_cmd } if(@debug)
128
140
 
129
- stdout = %x[\"#{install_path}/bin/heat.exe\" dir . #{template_option} -cg InstallionFiles -gg -nologo -srd -o \"#{wxs_file}\"]
141
+ stdout = %x[#{wix_cmd}]
130
142
  raise "#{stdout}\nFailed to generate .wxs file" unless(File.exists?(wxs_file))
131
143
 
132
144
  product_name = File.basename(wxs_file, '.wxs')
@@ -170,18 +182,24 @@ class Wix
170
182
  end
171
183
 
172
184
  def self.create_output(wxs_file, output)
173
- wixobj_file = "#{File.basename(wxs_file)}.wixobj"
185
+ wixobj_file = "#{File.basename(wxs_file,'.wxs')}.wixobj"
174
186
 
175
- stdout = %x[\"#{install_path}\\bin\\candle.exe\" -out \"#{wixobj_file}\" \"#{wxs_file}\"]
187
+ wix_cmd = "\"#{install_path}\\bin\\candle.exe\" -out \"#{wixobj_file}\" \"#{wxs_file}\""
188
+ File.open("#{File.basename(wxs_file,'.wxs')}.wix_cmds", 'a') { |f| f.puts wix_cmd } if(@debug)
189
+ stdout = %x[#{wix_cmd}]
176
190
  raise "#{stdout}\nFailed to generate .wixobj file" unless(File.exists?(wixobj_file))
177
191
 
178
- stdout = %x[\"#{install_path}\\bin\\light.exe\" -nologo -out \"#{output}\" \"#{wixobj_file}\"]
192
+ wix_cmd = "\"#{install_path}\\bin\\light.exe\" -nologo -out \"#{output}\" \"#{wixobj_file}\""
193
+ File.open("#{File.basename(wxs_file,'.wxs')}.wix_cmds", 'a') { |f| f.puts wix_cmd } if(@debug)
194
+ stdout = %x[#{wix_cmd}]
179
195
  raise "#{stdout}\nFailed to generate #{output} file" unless(File.exists?(output))
180
196
  end
181
197
 
182
198
  def self.apply_wix_template(output, input, template)
183
199
  raise 'WIX path is not set!' if(install_path.nil?)
184
-
200
+
201
+ @debug = input[:debug] if(!@debug && input.kind_of?(Hash) && input.has_key?(:debug))
202
+
185
203
  ext = File.extname(output)
186
204
  basename = File.basename(output, ext)
187
205
  FileUtils.rm(output) if(File.exists?(output))
@@ -195,8 +213,13 @@ class Wix
195
213
  Dir.chdir(dir) do |current_dir|
196
214
  create_wxs_file(wxs_file, input, ext)
197
215
  create_output(wxs_file, output_absolute_path)
216
+
217
+ if(@debug)
218
+ FileUtils.cp("#{wxs_file}", "#{output_absolute_path}.wxs")
219
+ wix_cmds_file = "#{File.basename(wxs_file,'.wxs')}.wix_cmds"
220
+ FileUtils.cp(wix_cmds_file, "#{File.dirname(output_absolute_path)}/#{wix_cmds_file}")
221
+ end
198
222
  end
199
- FileUtils.cp("#{dir}/#{wxs_file}", "#{output_absolute_path}.wxs") if(@debug)
200
223
  end
201
224
  pdb_file = output_absolute_path.gsub(ext,'.wixpdb')
202
225
  FileUtils.rm(pdb_file) if(File.exists?(pdb_file))
@@ -38,14 +38,22 @@ describe 'Wixgem' do
38
38
  describe 'Packaging excptions' do
39
39
  exception_test_arguments = {
40
40
  test1: ['test/wixgem_install_test1.msi', nil],
41
- test1: ['test/wixgem_install_test1.msi', []],
42
- test2: ['test/wixgem_install_test1.msi', ['does_not_exist.txt']]
41
+ test2: ['test/wixgem_install_test1.msi', []],
42
+ test3: ['test/wixgem_install_test1.msi', ['does_not_exist.txt']]
43
43
  }
44
44
 
45
45
  exception_test_arguments.each { |key, value|
46
- it "should raise an exception" do
46
+ it "#{key} should raise an exception" do
47
47
  expect { Wix.make_installation(value[0], value[1]) }.to raise_error
48
48
  end
49
49
  }
50
50
  end
51
+
52
+ describe 'includding vb6 files' do
53
+ it "the wix's heat command should contain the -svb6 flag" do
54
+ Wix.make_installation('test/wixgem_install_vb6_files.msi', {manufacturer: 'musco', has_vb6_files: true, files: ['rakefile.rb'], debug: true})
55
+ wix_cmd_text = File.read('test/wixgem_install_vb6_files.wix_cmds')
56
+ expect(wix_cmd_text.include?('-svb6')).to eq(true)
57
+ end
58
+ end
51
59
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wixgem
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.0
4
+ version: 0.18.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Marshall