lib/xcode/install/simulators.rb in xcode-install-2.2.0 vs lib/xcode/install/simulators.rb in xcode-install-2.2.1

- old
+ new

@@ -6,16 +6,20 @@ self.command = 'simulators' self.summary = 'List or install iOS simulators.' def self.options [['--install=name', 'Install simulator beginning with name, e.g. \'iOS 8.4\', \'tvOS 9.0\'.'], + ['--force', 'Install even if the same version is already installed.'], + ['--no-install', 'Only download DMG, but do not install it.'], ['--no-progress', 'Don’t show download progress.']].concat(super) end def initialize(argv) @installed_xcodes = Installer.new.installed_versions @install = argv.option('install') + @force = argv.flag?('force', false) + @should_install = argv.flag?('install', true) @progress = argv.flag?('progress', true) super end def run @@ -34,12 +38,12 @@ puts "[!] No simulator matching #{@install} was found. Please specify a version from the following available simulators:".ansi.red list exit 1 when 1 simulator = filtered_simulators.first - fail Informative, "#{simulator.name} is already installed." if simulator.installed? + fail Informative, "#{simulator.name} is already installed." if simulator.installed? && !@force puts "Installing #{simulator.name} for Xcode #{simulator.xcode.bundle_version}..." - simulator.install(@progress) + simulator.install(@progress, @should_install) else puts "[!] More than one simulator matching #{@install} was found. Please specify the full version.".ansi.red filtered_simulators.each do |candidate| puts "Xcode #{candidate.xcode.bundle_version} (#{candidate.xcode.path})".ansi.green puts "xcversion simulators --install=#{candidate.name}"