WindowsInstaller 0.1.14 → 0.1.15
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 +4 -4
- data/lib/WindowsInstaller.rb +26 -5
- 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: bc69b5a9bfaf4057bd08f3d3a431a596af7e4d15
|
4
|
+
data.tar.gz: 917d55175c816b8dd6d506726f8af01db92f655a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cea33f07180d9f22b9f8b43ec3edc48ae0686ca6e3af7b181b774c01679cf1760ba48fcc9fc6911af7a546a8c28c44e4198c24c02ec55d76e7a24030b9270521
|
7
|
+
data.tar.gz: 731787034a6d0b61da149f99a62a0502fdd16e499db44deab2c2372d6580c1cc4e2d5bed493a4517fe1a4f2c3f84123fe64b7af8426d294d6fe728264f60202e
|
data/lib/WindowsInstaller.rb
CHANGED
@@ -33,6 +33,12 @@ class WindowsInstaller < Hash
|
|
33
33
|
return false
|
34
34
|
end
|
35
35
|
|
36
|
+
def installed_products
|
37
|
+
products = []
|
38
|
+
@installer.Products.each { |installed_product_code| products << installed_product_code }
|
39
|
+
return products
|
40
|
+
end
|
41
|
+
|
36
42
|
def install_msi(msi_file)
|
37
43
|
raise "#{msi_file} does not exist!" unless(File.exists?(msi_file))
|
38
44
|
|
@@ -114,6 +120,11 @@ class WindowsInstaller < Hash
|
|
114
120
|
return properties
|
115
121
|
end
|
116
122
|
|
123
|
+
def product_codes_from_upgrade_code(upgrade_code)
|
124
|
+
upgrade_codes = get_upgrade_codes
|
125
|
+
return (upgrade_codes.key?(upgrade_code)) ? upgrade_codes[upgrade_code] : nil
|
126
|
+
end
|
127
|
+
|
117
128
|
private
|
118
129
|
def installed_get_product_code(product_name)
|
119
130
|
return '' if(product_name.empty?)
|
@@ -141,9 +152,8 @@ class WindowsInstaller < Hash
|
|
141
152
|
return hash
|
142
153
|
end
|
143
154
|
|
144
|
-
def
|
145
|
-
|
146
|
-
|
155
|
+
def get_upgrade_codes
|
156
|
+
upgrade_codes = {}
|
147
157
|
property_value = @installer.ProductsEx('','',7).each do |prod|
|
148
158
|
begin
|
149
159
|
local_pkg = prod.InstallProperty('LocalPackage')
|
@@ -157,12 +167,23 @@ class WindowsInstaller < Hash
|
|
157
167
|
record = view.Fetch
|
158
168
|
unless(record.nil?)
|
159
169
|
upgrade_code = record.StringData(1)
|
160
|
-
|
170
|
+
|
171
|
+
upgrade_codes[upgrade_code] ||= []
|
172
|
+
upgrade_codes[upgrade_code] << prod.ProductCode
|
161
173
|
end
|
162
174
|
end
|
163
|
-
return
|
175
|
+
return upgrade_codes
|
164
176
|
end
|
165
177
|
|
178
|
+
def get_upgrade_code(product_code)
|
179
|
+
return nil if(!product_code_installed?(product_code))
|
180
|
+
upgrade_codes = get_upgrade_codes
|
181
|
+
upgrade_codes.each do |upgrade_code, product_codes|
|
182
|
+
product_codes.each { |pc| return upgrade_code if(pc == produt_code) }
|
183
|
+
end
|
184
|
+
return nil
|
185
|
+
end
|
186
|
+
|
166
187
|
def msiexec(cmd)
|
167
188
|
cmd_options = { echo_command: false, echo_output: false} unless(self[:debug])
|
168
189
|
if(self.has_key?(:administrative_user))
|