Class: U3d::Installer

Inherits:
Object
  • Object
show all
Defined in:
lib/u3d/installer.rb

Class Method Summary collapse

Class Method Details

.createObject



234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
# File 'lib/u3d/installer.rb', line 234

def self.create
  installer = if Helper.mac?
                MacInstaller.new
              elsif Helper.linux?
                LinuxInstaller.new
              else
                WindowsInstaller.new
              end
  if UI.interactive?
    unclean = []
    installer.installed.each { |unity| unclean << unity unless unity.path =~ UNITY_DIR_CHECK }
    if !unclean.empty? && UI.confirm("#{unclean.count} Unity installation should be moved. Proceed?")
      unclean.each { |unity| installer.sanitize_install(unity) }
    end
  end
  installer
end

.install_module(file_path, version, installation_path: nil, info: {}) ⇒ Object



252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
# File 'lib/u3d/installer.rb', line 252

def self.install_module(file_path, version, installation_path: nil, info: {})
  extension = File.extname(file_path)
  if extension == '.pkg'
    path = installation_path || DEFAULT_MAC_INSTALL
    MacInstaller.install_pkg(
      file_path,
      version: version,
      target_path: path
    )
  elsif extension == '.exe'
    path = installation_path || File.join(DEFAULT_WINDOWS_INSTALL, UNITY_DIR % version)
    WindowsInstaller.install_exe(
      file_path,
      installation_path: path,
      info: info
    )
  elsif extension == '.sh'
    path = installation_path || File.join(DEFAULT_LINUX_INSTALL, UNITY_DIR % version)
    LinuxInstaller.install_sh(
      file_path,
      installation_path: path
    )
  else
    raise "File type #{extension} not yet supported"
  end
end