Class: U3d::BaseInstaller

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

Direct Known Subclasses

LinuxInstaller, MacInstaller, WindowsInstaller

Instance Method Summary collapse

Instance Method Details

#installed_sorted_by_versionsObject



84
85
86
87
88
89
90
91
92
93
94
# File 'lib/u3d/installer.rb', line 84

def installed_sorted_by_versions
  list = installed
  return [] if list.empty?
  # version -> installations
  arraym = list.map { |a| [a.version, a] }
  map = Hash[*arraym.flatten]
  # sorted versions
  vcomparators = map.keys.map { |k| UnityVersionComparator.new(k) }
  sorted_keys = vcomparators.sort.map { |v| v.version.to_s }
  sorted_keys.map { |k| map[k] }
end

#sanitize_installsObject



71
72
73
74
75
76
77
78
79
80
81
82
# File 'lib/u3d/installer.rb', line 71

def sanitize_installs
  return unless UI.interactive? || Helper.test?
  unclean = []
  installed.each { |unity| unclean << unity unless unity.clean_install? }
  return if unclean.empty?
  UI.important("u3d can optionally standardize the existing Unity installation names and locations.")
  UI.important("Check the documentation for more information:")
  UI.important("** https://github.com/DragonBox/u3d/blob/master/README.md#default-installation-paths **")
  unclean.each { |unity| sanitize_install(unity, dry_run: true) }
  return unless UI.confirm("#{unclean.count} Unity installation(s) will be moved. Proceed??")
  unclean.each { |unity| sanitize_install(unity) }
end