lib/u3d/commands.rb in u3d-1.0.11 vs lib/u3d/commands.rb in u3d-1.0.12
- old
+ new
@@ -309,39 +309,42 @@
return unity
end
nil
end
+ # rubocop:disable Metrics/BlockNesting
def enforce_setup_coherence(packages, options, unity, definition)
if options[:all]
packages.clear
packages.concat(definition.available_packages)
end
- if unity
- UI.important "Unity #{unity.version} is already installed"
- # Not needed since Linux custom u3d files contain only one entry wich is Unity
- # return false if definition.os == :linux
- if packages.include?('Unity')
- UI.important 'Ignoring Unity module, it is already installed'
- packages.delete('Unity')
+ if options[:install]
+ if unity
+ UI.important "Unity #{unity.version} is already installed"
+ # Not needed since Linux custom u3d files contain only one entry wich is Unity
+ # return false if definition.os == :linux
+ if packages.include?('Unity')
+ UI.important 'Ignoring Unity module, it is already installed'
+ packages.delete('Unity')
- # FIXME: Move me to the WindowsInstaller
- options[:installation_path] ||= unity.root_path if definition.os == :win
- end
- if unity.packages
- unity.packages.each do |pack|
- UI.important "Ignoring #{pack} module, it is already installed" if packages.delete(pack)
+ # FIXME: Move me to the WindowsInstaller
+ options[:installation_path] ||= unity.root_path if definition.os == :win
end
+ packages.select { |pack| unity.package_installed?(pack) }.each do |pack|
+ packages.delete pack
+ UI.important "Ignoring #{pack} module, it is already installed"
+ end
+ return false if packages.empty?
+ else
+ unless packages.include?('Unity')
+ UI.error 'Please install Unity before any of its packages'
+ return false
+ end
end
- return false if packages.empty?
- else
- unless packages.include?('Unity')
- UI.error 'Please install Unity before any of its packages'
- return false
- end
end
true
end
+ # rubocop:enable Metrics/BlockNesting
def get_administrative_privileges(options)
U3dCore::Globals.use_keychain = true if options[:keychain] && Helper.mac?
UI.important 'Root privileges are required'
raise 'Could not get administrative privileges' unless U3dCore::CommandExecutor.has_admin_privileges?