lib/u3d/installer.rb in u3d-1.0.13 vs lib/u3d/installer.rb in u3d-1.0.14

- old
+ new

@@ -61,11 +61,12 @@ end def self.install_modules(files, version, installation_path: nil) installer = Installer.create files.each do |name, file, info| - UI.verbose "Installing #{name}#{info['mandatory'] ? ' (mandatory package)' : ''}, with file #{file}" + UI.header "Installing #{info['title']} (#{name})" + UI.message 'Installing with ' + file installer.install(file, version, installation_path: installation_path, info: info) end end def self.uninstall(unity: nil) @@ -292,36 +293,40 @@ Dir[find].map { |path| WindowsInstallation.new(root_path: File.expand_path('../..', path)) } end def install(file_path, version, installation_path: nil, info: {}) extension = File.extname(file_path) - raise "Installation of #{extension} files is not supported on Windows" if extension != '.exe' + raise "Installation of #{extension} files is not supported on Windows" unless %w[.exe .msi].include? extension path = installation_path || File.join(DEFAULT_WINDOWS_INSTALL, format(UNITY_DIR, version: version)) install_exe( file_path, installation_path: path, info: info ) end def install_exe(file_path, installation_path: nil, info: {}) installation_path ||= DEFAULT_WINDOWS_INSTALL - final_path = installation_path.tr('/', '\\') + final_path = Utils.windows_path(installation_path) Utils.ensure_dir(final_path) begin command = nil if info['cmd'] command = info['cmd'] - command.sub!(/{FILENAME}/, file_path) + if /msiexec/ =~ command + command.sub!(/{FILENAME}/, '"' + Utils.windows_path(file_path) + '"') + else + command.sub!(/{FILENAME}/, file_path) + end command.sub!(/{INSTDIR}/, final_path) command.sub!(/{DOCDIR}/, final_path) command.sub!(/{MODULEDIR}/, final_path) command.sub!(%r{\/D=}, '/S /D=') unless %r{\/S} =~ command end command ||= file_path.to_s U3dCore::CommandExecutor.execute(command: command, admin: true) rescue StandardError => e - UI.error "Failed to install exe at #{file_path}: #{e}" + UI.error "Failed to install package at #{file_path}: #{e}" else UI.success "Successfully installed #{info['title']}" end end