wixgem 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/wixgem.rb +34 -14
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f33ca2b374cc6f4dd65b7ef6821e7382b04c2e5a
4
- data.tar.gz: e3a12d71814b190b87da4121d7c8e0de5f02841a
3
+ metadata.gz: ea5a8b4134eda9ccd33e1a56d9962adc2114be18
4
+ data.tar.gz: b8a7ee5f5c9d6593f69227f22487cadbd51ffea8
5
5
  SHA512:
6
- metadata.gz: c2e4980e71e5da16e3df4d9ca5366f4f2e105dc8ad29bffa35a35a6bfdfef679c8281d665a3fe686df4cf1d0490fec32e9820afa5b6e88cfd97692d680154a5f
7
- data.tar.gz: 1d21874d28f1aca739b979df2e4fd1233568d2c906d8a1a3c254387709beedbe020d6e57717197de672180694a872a507909104ef083530affd606dc26b0cba3
6
+ metadata.gz: 0bfbb2cb95eabb61ca6d9492ff639619d2cdf89ecba34c1cb802795b6b443077aa9bed61be0c7e9bbd7b64ef5c0d321b254081b66f057b15466b249fd982bb45
7
+ data.tar.gz: 669baf8ddb9216b6eb3d5c83104ac52e42210dd6f7fd8bd8b76a6dcab048f2cabfaabb9954098ea8a3265dda15175e408af1348df70ec3f11bfdfc56f8ab1827
data/lib/wixgem.rb CHANGED
@@ -12,6 +12,16 @@ class Wix
12
12
  return @install_path
13
13
  end
14
14
 
15
+ def self.create_mergemodule_wixfile(output_wixfile, input)
16
+ gem_dir = File.dirname(__FILE__)
17
+ create_wix_file(output_wixfile, input, "#{gem_dir}/templates/mergemodule.wxs")
18
+ end
19
+
20
+ def self.create_installation_wixfile(output_wixfile, input)
21
+ gem_dir = File.dirname(__FILE__)
22
+ create_wix_file(output_wixfile, input, "#{gem_dir}/templates/mergemodule.wxs")
23
+ end
24
+
15
25
  def self.make_mergemodule(output, input)
16
26
  gem_dir = File.dirname(__FILE__)
17
27
  apply_wix_template(output, input, "#{gem_dir}/templates/mergemodule.wxs")
@@ -22,13 +32,8 @@ class Wix
22
32
  apply_wix_template(output, input, "#{gem_dir}/templates/Install.wxs")
23
33
  end
24
34
 
25
- def self.apply_wix_template(output, input, template)
26
- ext = File.extname(output)
27
- wix_basename = File.basename(output, ext)
28
- Dir.glob("#{wix_basename}#{ext}") { |file| FileUtils.rm(file) }
29
-
30
- wix_file = "#{wix_basename}.wxs"
31
-
35
+ def self.create_wix_file(wix_file, input, template)
36
+ wix_basename = File.basename(wix_file, '.wxs')
32
37
  wxs_text = File.read(template)
33
38
 
34
39
  files = input
@@ -60,22 +65,36 @@ class Wix
60
65
 
61
66
  #puts wxs_text
62
67
  File.open(wix_file, 'w') { |f| f.puts(wxs_text) }
68
+ end
69
+
70
+ def self.apply_wix_template(output, input, template)
71
+ ext = File.extname(output)
72
+ basename = File.basename(output, ext)
73
+ FileUtils.rm(output) if(File.exists?(output))
63
74
 
75
+ output_path = File.dirname(output)
76
+ wix_file = "#{File.dirname(output)}/#{basename}.wxs"
77
+ create_wix_file(wix_file, input, template)
78
+
64
79
  raise 'WIX path is not set!' if(install_path.nil?)
65
80
 
66
- stdout = %x[\"#{install_path}\\bin\\candle.exe\" #{wix_file}]
67
- raise "#{stdout}\nFailed to generate .wixobj file" unless(File.exists?("#{wix_basename}.wixobj"))
81
+ stdout = %x[\"#{install_path}\\bin\\candle.exe\" -out \"#{output_path}/#{basename}.wixobj\" \"#{wix_file}\"]
82
+ raise "#{stdout}\nFailed to generate .wixobj file" unless(File.exists?("#{output_path}/#{basename}.wixobj"))
68
83
 
69
- stdout = %x[\"#{install_path}\\bin\\light.exe\" -nologo -out #{output} #{wix_basename}.wixobj]
84
+ stdout = %x[\"#{install_path}\\bin\\light.exe\" -nologo -out \"#{output}\" \"#{output_path}/#{basename}.wixobj\"]
70
85
  raise "#{stdout}\nFailed to generate #{output} file" unless(File.exists?(output))
71
86
 
72
- Dir.glob("#{File.dirname(output)}/#{wix_basename}.{wxs,wixobj,wixpdb}") { |file| FileUtils.rm(file) }
87
+ Dir.glob("#{output_path}/#{basename}.{wxs,wixobj,wixpdb}") { |file| FileUtils.rm(file) }
73
88
  end
74
89
 
75
90
  def self.wix_id(file)
76
- return "id_#{file}".gsub(/[^a-zA-Z0-9_\.]/) { |s| s = '_' }
91
+ id = "id_#{file}".gsub(/[^a-zA-Z0-9_\.]/) { |s| s = '_' }
92
+ max_id_length = 72
93
+ id = id.slice(id.length-max_id_length, max_id_length) unless(id.length <= max_id_length)
94
+ id[0] = '_' if(id[0] == '.')
95
+ return id
77
96
  end
78
-
97
+
79
98
  def self.files_to_xml(files)
80
99
  xml = ''
81
100
  files.each do |file|
@@ -127,7 +146,8 @@ class Wix
127
146
  files.each do |file|
128
147
  if(File.file?(file))
129
148
  dir_path = File.dirname(file)
130
- dir_hash = dir_files
149
+
150
+ dir_hash = dir_files
131
151
  dir_path.split('/').each do |d|
132
152
  if(!dir_hash.has_key?(d))
133
153
  dir_hash[d] = Hash.new unless(dir_hash.has_key?(d))
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.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Marshall