class U3d::Installation

Constants

NOT_PLAYBACKENGINE_PACKAGES
PACKAGE_ALIASES

Attributes

root_path[RW]

Public Class Methods

create(root_path: nil, path: nil) click to toggle source
# File lib/u3d/installation.rb, line 58
def self.create(root_path: nil, path: nil)
  UI.deprecated("path is deprecated. Use root_path instead") unless path.nil?
  if Helper.mac?
    MacInstallation.new(root_path: root_path, path: path)
  elsif Helper.linux?
    LinuxInstallation.new(root_path: root_path, path: path)
  else
    WindowsInstallation.new(root_path: root_path, path: path)
  end
end
new(root_path: nil, path: nil) click to toggle source
# File lib/u3d/installation.rb, line 53
def initialize(root_path: nil, path: nil)
  @root_path = root_path
  @path = path
end

Public Instance Methods

do_not_move!(dry_run: false) click to toggle source
# File lib/u3d/installation.rb, line 77
def do_not_move!(dry_run: false)
  if dry_run
    UI.message "Would create '#{do_not_move_file_path}'"
  else
    begin
      FileUtils.touch do_not_move_file_path
    rescue Errno::EACCES => _e
      U3dCore::AdminTools.create_file(Helper.operating_system, do_not_move_file_path)
    end
  end
end
do_not_move?() click to toggle source
# File lib/u3d/installation.rb, line 73
def do_not_move?
  File.exist?(@root_path) && File.exist?(do_not_move_file_path)
end
package_installed?(package) click to toggle source
# File lib/u3d/installation.rb, line 89
def package_installed?(package)
  return true if (packages || []).include?(package)

  aliases = PACKAGE_ALIASES[package]

  # If no aliases for the package are found, then it's a new package not yet known by Unity
  # If the exact name doesn't match then we have to suppose it's not installed
  return false unless aliases

  return !(aliases & packages).empty?
end
packages() click to toggle source
# File lib/u3d/installation.rb, line 69
def packages
  false
end

Private Instance Methods

do_not_move_file_path() click to toggle source
# File lib/u3d/installation.rb, line 103
def do_not_move_file_path
  File.join(@root_path, U3D_DO_NOT_MOVE)
end