Class: Nbuild::MsiExecCmd

Inherits:
Cmd
  • Object
show all
Defined in:
lib/nbuild/msi_exec_cmd.rb

Instance Method Summary collapse

Methods inherited from Cmd

#execute, #execute_in

Constructor Details

#initialize(params = {}) ⇒ MsiExecCmd

Returns a new instance of MsiExecCmd.



6
7
8
# File 'lib/nbuild/msi_exec_cmd.rb', line 6

def initialize params={}
  @params = params
end

Instance Method Details

#commandObject



10
11
12
13
14
15
16
17
# File 'lib/nbuild/msi_exec_cmd.rb', line 10

def command
  msi = @params[:msi]
  command = "/package" if  @params[:install]
  command = "/uninstall" if  @params[:uninstall]
  @params[:parameters] ||= {}
  parameters = @params[:parameters].map{|k,v| "#{k}=\"#{v}\""}.join(' ')
  "msiexec.exe #{command} \"#{msi}\" /passive #{parameters}"
end

#execute_internalObject



19
20
21
22
23
24
25
# File 'lib/nbuild/msi_exec_cmd.rb', line 19

def execute_internal
  the_command = self.command
  puts "executing \"#{the_command}\""
  process = Process.create(:command_line => the_command)
  puts "waiting for pid #{process.process_id}"
  Process.waitpid process.process_id
end