wixgem 0.49.0 → 0.50.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/wixgem.rb +38 -16
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 061afe43dfa14c1ecd5d5b2a48babc203e36866e
4
- data.tar.gz: 4e4593073b5edd42f7535603b5eef5a87cfb1cc3
3
+ metadata.gz: 85eefebc51d585b590f61f47d2f6d82323b136d1
4
+ data.tar.gz: 211f7c629cbacaa238283f619785f98193b95492
5
5
  SHA512:
6
- metadata.gz: aad6ca671d146d3014ceaa699a7e8ed6cf846d315951331fbacf0bb88760083627f92d3d0478109fa87f4ca69749d6560ff63d8a19e130ac4d093c9203f2988d
7
- data.tar.gz: 8e2726e75b477f13b12c58f50e2f3d9e95741360c8f9e2c541029857d60f92acca34cd7d7053504291288be24d66d2620ad5bc6cc59c624ba3ced2e6c2ad5118
6
+ metadata.gz: fc87d1d1d6dde547bd360213898da22842737059e2f3fc5a230f90c3931d16796199ac14f5c377c04857a0906b0e8e4d0c3e0ad145711c20f4138ea0d04c09a3
7
+ data.tar.gz: 0363a2b4e114e75878531a1dc3a3157ad051ae2e96e1aab5f05e49e3f9a5825e51b6ffa9e2fbf62bd597886f7d7542f852e6ab093c585d9010dead1423877be8
data/lib/wixgem.rb CHANGED
@@ -154,8 +154,7 @@ class Wix
154
154
 
155
155
  def self.copy_install_files(directory, input)
156
156
  files = files(input)
157
- raise 'No files were given to wixgem' if(files.length == 0)
158
-
157
+
159
158
  missing_files = []
160
159
  files.each do |file|
161
160
  if(File.file?(file))
@@ -174,8 +173,10 @@ class Wix
174
173
  end
175
174
 
176
175
  if(@debug)
177
- max_path = files.max { |a, b| a.length <=> b.length }
178
- columen_size = max_path.length + 10
176
+ if(files.length > 0)
177
+ max_path = files.max { |a, b| a.length <=> b.length }
178
+ columen_size = max_path.length + 10
179
+ end
179
180
 
180
181
  @logger << "------------------------------------ Installation Paths -----------------------------------" unless(@logger.nil?)
181
182
  @logger << "%-#{columen_size}s %s\n" % ['File path', 'Installation Path'] unless(@logger.nil?)
@@ -188,9 +189,17 @@ class Wix
188
189
  @logger << "%-#{columen_size}s %s\n" % [file, install_path] unless(@logger.nil?)
189
190
  end
190
191
  end
192
+
193
+ if(input.has_key?(:ignore_files))
194
+ @logger << "------------------------------------ ignoring files -----------------------------------" unless(@logger.nil?)
195
+ input[:ignore_files].each { |file| @logger << file }
196
+ end
197
+
191
198
  @logger << "-------------------------------------------------------------------------------------------" unless(@logger.nil?)
192
199
  end
193
200
 
201
+ raise 'No files were given to wixgem' if(files.length == 0)
202
+
194
203
  if(missing_files.length > 0)
195
204
  missing_files_str = ''
196
205
  missing_files.each { |f|
@@ -230,7 +239,6 @@ class Wix
230
239
 
231
240
  def self.execute_heat(input, cmd_line_options)
232
241
  heat_cmd = Command.new("\"#{install_path}/bin/heat.exe\" #{modify_heat_commandline(input, cmd_line_options)}", { quiet: true })
233
- heat_cmd[:debug] = true
234
242
  heat_cmd.execute
235
243
  log_wix_output(heat_cmd)
236
244
  end
@@ -248,6 +256,10 @@ class Wix
248
256
 
249
257
  install_files.reject! { |f| install_ignore_files.include?(f) }
250
258
 
259
+ package_type = 'installation'
260
+ package_type = 'merge module' if(template_option.include?('module'))
261
+ raise "At least one file is required to build a #{package_type}" if(install_files.length == 0)
262
+
251
263
  directory_fragments = {}
252
264
  wxs_files = {}
253
265
  install_files.each do |file|
@@ -311,7 +323,7 @@ class Wix
311
323
  def self.create_wxs_file(wxs_file, input, ext)
312
324
  template_option = "-template product"
313
325
  template_option = "-template module" unless(ext == ".msi")
314
-
326
+
315
327
  if(input.has_key?(:ignore_files))
316
328
  execute_heat_file(wxs_file, input, template_option)
317
329
  else
@@ -377,8 +389,17 @@ class Wix
377
389
  log_wix_output(light_cmd)
378
390
  end
379
391
 
392
+ def self.verify_input_keys(input)
393
+ if(input.kind_of?(Hash))
394
+ [:files,:ignore_files].each { |key| raise "Hash key #{key} cannot be nil" if(input.has_key?(key) && input[key].nil?)}
395
+ end
396
+ end
397
+
380
398
  def self.create_package(output, input)
381
399
  raise 'WIX path is not set!' if(install_path.nil?)
400
+
401
+ verify_input_keys(input)
402
+
382
403
  input = { files: input } unless(input.kind_of?(Hash))
383
404
  @debug = input[:debug] if(!@debug && input.has_key?(:debug))
384
405
 
@@ -396,21 +417,22 @@ class Wix
396
417
  #FileUtils.rm_rf(dir) if(Dir.exists?(dir))
397
418
  #FileUtils.mkdir(dir)
398
419
  Dir.mktmpdir do |dir|
399
- copy_install_files(dir, input)
400
-
401
420
  wxs_file = "#{basename}.wxs"
402
- Dir.chdir(dir) do |current_dir|
403
- begin
421
+ begin
422
+ copy_install_files(dir, input)
423
+
424
+ Dir.chdir(dir) do |current_dir|
404
425
  create_wxs_file(wxs_file, input, ext)
405
426
  create_output(wxs_file, output_absolute_path)
406
- rescue Exception => e
407
- raise "Wixgem exception: #{e}"
408
- ensure
409
- FileUtils.cp(wxs_file, "#{output_absolute_path}.wxs") if(File.exists?(wxs_file) && @debug)
410
- File.open("#{output_absolute_path}.log", 'w') { |f| f.puts(@logger) } if(@debug &!@logger.nil?)
411
427
  end
412
- end
428
+ rescue Exception => e
429
+ raise "Wixgem exception: #{e}"
430
+ ensure
431
+ FileUtils.cp("#{dir}/#{wxs_file}", "#{output_absolute_path}.wxs") if(File.exists?("#{dir}/#{wxs_file}") && @debug)
432
+ File.open("#{output_absolute_path}.log", 'w') { |f| f.puts(@logger) } if(@debug &!@logger.nil?)
433
+ end
413
434
  end
435
+
414
436
  pdb_file = output_absolute_path.gsub(ext,'.wixpdb')
415
437
  FileUtils.rm(pdb_file) if(File.exists?(pdb_file))
416
438
 
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.49.0
4
+ version: 0.50.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Marshall