WindowsInstaller 0.1.7 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/WindowsInstaller.rb +24 -41
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed4c11b8ab31668f99fdde77e82b442dfdbd85ab
|
4
|
+
data.tar.gz: d9fd41348525b7a3efbc85cb241e513a50ee81fd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ff033255a4bbd424330a44ac16a8cd87e31aa4b9182c312ae99d22e6fc292cc295e5ffccefc3a91c857af7652963a66c19247639c68e2a83269d8104c226cf0
|
7
|
+
data.tar.gz: ed5c94b06dccc63dd6414559930759bbb0c97a932ae59bb9b13b2f5470c15060b8f86e22fd9a8c88852aab80dbd58e9c1a4739ee9d555c4763c938de5f09e8f4
|
data/lib/WindowsInstaller.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'win32ole'
|
2
|
-
require '
|
2
|
+
require 'cmd_windows'
|
3
3
|
require 'sys/proctable'
|
4
|
+
require 'tempfile'
|
4
5
|
|
5
6
|
class WindowsInstaller < Hash
|
6
7
|
@@default_options = {mode: '/passive'}
|
@@ -14,7 +15,7 @@ class WindowsInstaller < Hash
|
|
14
15
|
hash.each { |key,value| @@default_options[key] = value }
|
15
16
|
end
|
16
17
|
|
17
|
-
def msi_installed?(msi_file)
|
18
|
+
def msi_installed?(msi_file)
|
18
19
|
info = msi_properties(msi_file)
|
19
20
|
return product_code_installed?(info['ProductCode'])
|
20
21
|
end
|
@@ -96,50 +97,32 @@ class WindowsInstaller < Hash
|
|
96
97
|
|
97
98
|
installer.ole_free
|
98
99
|
installer = nil
|
99
|
-
|
100
|
+
|
100
101
|
return properties
|
101
102
|
end
|
102
103
|
|
103
|
-
def msiexec(
|
104
|
-
|
105
|
-
|
106
|
-
msiexec_admin(cmd, cmd_options)
|
107
|
-
else
|
108
|
-
command = CMD.new(cmd, cmd_options)
|
109
|
-
command.execute
|
110
|
-
end
|
111
|
-
end
|
112
|
-
|
113
|
-
def msiexec_admin(cmd, options)
|
114
|
-
cmd = "runas /noprofile /savecred /user:#{self[:administrative_user]} \"#{cmd}\""
|
115
|
-
command = CMD.new(cmd, options)
|
116
|
-
wait_on_spawned(cmd) { cmd.execute }
|
104
|
+
def msiexec(command)
|
105
|
+
cmd = CMD.new(command)
|
106
|
+
cmd.execute
|
117
107
|
end
|
118
108
|
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
109
|
+
private
|
110
|
+
def msiexec_block
|
111
|
+
original_value = '0'
|
112
|
+
raise ':administrative_user must be set to setup always_install_elevated priviledges' if(self[:always_installed_elevated] && self.has_key?[:administrative_user])
|
113
|
+
register_reg_file('1') if(self[:always_install_elevated])
|
114
|
+
yield
|
115
|
+
register_reg_file(current_value) if(self[:always_install_elevated])
|
116
|
+
end
|
126
117
|
|
127
|
-
|
128
|
-
|
129
|
-
|
118
|
+
def register_reg_file(value)
|
119
|
+
lib_directory = File.dirname(__FILE__)
|
120
|
+
reg_file = File.read("#{lib_directory}/always_install_elevated_template.reg")
|
121
|
+
reg_file=reg_file.gsub(/VALUE/,value)
|
122
|
+
file = Tempfile.new('wininst')
|
123
|
+
file.write(reg_file)
|
130
124
|
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
msiexe_pid = ps.pid if((ps.name.downcase == exe.downcase) && pre_pids.index(ps.pid).nil?)
|
135
|
-
end
|
136
|
-
|
137
|
-
if(msiexe_pid != 0)
|
138
|
-
loop do
|
139
|
-
s = Sys::ProcTable.ps(msiexe_pid)
|
140
|
-
break if(s.nil?)
|
141
|
-
sleep(1)
|
142
|
-
end
|
143
|
-
end
|
144
|
-
end
|
125
|
+
cmd = CMD.new("#{ENV['SystemRoot']}\\System32\\regedit.exe /s #{file.path}", { echo_command: true })
|
126
|
+
cmd.execute_as(self[:administrative_user])
|
127
|
+
end
|
145
128
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: WindowsInstaller
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Marshall
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|