WindowsInstaller 0.1.14 → 0.1.15

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/WindowsInstaller.rb +26 -5
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b7fd5c6b3bb1348c6ed0594ed92209a7d62f7c15
4
- data.tar.gz: f86696a2ac7e66865941c57b829f501b23080d5d
3
+ metadata.gz: bc69b5a9bfaf4057bd08f3d3a431a596af7e4d15
4
+ data.tar.gz: 917d55175c816b8dd6d506726f8af01db92f655a
5
5
  SHA512:
6
- metadata.gz: c9087e8ff74556064ec00d6efd9ebd9a34b4c966db06c97b3611733894fdbfa6edb5f83d0d60dfbb37b76362b2cd0af5f4e05995537de3e0ea8ede5c8148829b
7
- data.tar.gz: b70351ba9c03a8426ef253e7191ee0779eef319a024958b7eae8b3fa368de21849ee340fabc3b79b61da855cc436540348acaa2ff8c45f75d78f1e338bcfecd0
6
+ metadata.gz: cea33f07180d9f22b9f8b43ec3edc48ae0686ca6e3af7b181b774c01679cf1760ba48fcc9fc6911af7a546a8c28c44e4198c24c02ec55d76e7a24030b9270521
7
+ data.tar.gz: 731787034a6d0b61da149f99a62a0502fdd16e499db44deab2c2372d6580c1cc4e2d5bed493a4517fe1a4f2c3f84123fe64b7af8426d294d6fe728264f60202e
@@ -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 get_upgrade_code(product_code)
145
- return nil if(!product_code_installed?(product_code))
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
- return upgrade_code if(prod.ProductCode == product_code)
170
+
171
+ upgrade_codes[upgrade_code] ||= []
172
+ upgrade_codes[upgrade_code] << prod.ProductCode
161
173
  end
162
174
  end
163
- return nil
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))
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: WindowsInstaller
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kevin Marshall