class XcodeInstall::Command

Public Instance Methods

install() click to toggle source
# File lib/xcode/install/simulators.rb, line 32
def install
  filtered_simulators = @installed_xcodes.map(&:available_simulators).flatten.uniq(&:name).select do |sim|
    sim.name.start_with?(@install)
  end
  case filtered_simulators.count
  when 0
    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? && !@force
    puts "Installing #{simulator.name} for Xcode #{simulator.xcode.bundle_version}..."
    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}"
    end
    exit 1
  end
end
list() click to toggle source
# File lib/xcode/install/simulators.rb, line 56
def list
  @installed_xcodes.each do |xcode|
    puts "Xcode #{xcode.version} (#{xcode.path})".ansi.green
    xcode.available_simulators.each do |simulator|
      puts simulator.to_s
    end
  end
end