Class: U3d::LinuxInstaller
- Inherits:
-
Object
- Object
- U3d::LinuxInstaller
- Defined in:
- lib/u3d/installer.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.install_sh(file, installation_path: nil) ⇒ Object
364 365 366 367 368 369 370 371 372 373 374 375 376 |
# File 'lib/u3d/installer.rb', line 364 def self.install_sh(file, installation_path: nil) cmd = file.shellescape if installation_path Utils.ensure_dir(installation_path) U3dCore::CommandExecutor.execute(command: "cd #{installation_path}; #{cmd}", admin: true) else U3dCore::CommandExecutor.execute(command: cmd, admin: true) end rescue => e UI.error "Failed to install bash file at #{file_path}: #{e}" else UI.success 'Installation successful' end |
Instance Method Details
#installed ⇒ Object
356 357 358 359 360 361 362 |
# File 'lib/u3d/installer.rb', line 356 def installed find = File.join(DEFAULT_LINUX_INSTALL, 'Unity*') versions = Dir[find].map { |path| LinuxInstallation.new(path: path) } # sorting should take into account stable/patch etc versions.sort! { |x, y| x.version <=> y.version } end |
#sanitize_install(unity) ⇒ Object
342 343 344 345 346 347 348 349 350 351 352 353 354 |
# File 'lib/u3d/installer.rb', line 342 def sanitize_install(unity) source_path = File.(unity.path) parent = File.('..', source_path) new_path = File.join(parent, UNITY_DIR % unity.version) UI.important "Moving #{source_path} to #{new_path}..." source_path = "\"#{source_path}\"" if source_path =~ / / new_path = "\"#{new_path}\"" if new_path =~ / / U3dCore::CommandExecutor.execute(command: "mv #{source_path} #{new_path}", admin: true) rescue => e UI.error "Unable to move #{source_path} to #{new_path}: #{e}" else UI.success "Successfully moved #{source_path} to #{new_path}" end |