wixgem 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wixgem.rb +34 -14
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea5a8b4134eda9ccd33e1a56d9962adc2114be18
|
4
|
+
data.tar.gz: b8a7ee5f5c9d6593f69227f22487cadbd51ffea8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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.
|
26
|
-
|
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?("#{
|
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} #{
|
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("#{
|
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
|
-
|
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
|
-
|
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))
|