make Simulator installation the same model as Xcode

This commit is contained in:
Jacob Zaval 2018-04-03 12:02:57 -07:00
Родитель b2fbc3b694
Коммит 57078b3dc8
3 изменённых файлов: 14 добавлений и 15 удалений

Просмотреть файл

@ -79,18 +79,17 @@ module MacOS
shell_out!(XCVersion.list_simulators).stdout
end
class << self
def installed?(semantic_version)
shell_out!(XCVersion.list_simulators)
.stdout.include?("#{semantic_version} Simulator (installed)")
end
def installed?
shell_out!(XCVersion.list_simulators)
.stdout.include?("#{@version} Simulator (installed)")
end
def included_major_version
version_matcher = /\d{1,2}\.\d{0,2}\.?\d{0,3}/
sdks = shell_out!('/usr/bin/xcodebuild -showsdks').stdout
included_simulator = sdks.match(/Simulator - iOS (?<version>#{version_matcher})/)
included_simulator[:version].split('.').first.to_i
end
def included_major_version
version_matcher = /\d{1,2}\.\d{0,2}\.?\d{0,3}/
sdks = shell_out!('/usr/bin/xcodebuild -showsdks').stdout
included_simulator = sdks.match(/Simulator - iOS (?<version>#{version_matcher})/)
included_simulator[:version].split('.').first.to_i
end
end
end
end

Просмотреть файл

@ -15,8 +15,8 @@ module MacOS
xcversion + 'simulators'
end
def install_simulator(version)
xcversion + "simulators --install='#{version}'"
def install_simulator(simulator)
xcversion + "simulators --install='#{simulator.version}'"
end
def list_xcodes

Просмотреть файл

@ -44,8 +44,8 @@ action :install_simulators do
simulator = Xcode::Simulator.new(major_version)
execute "install iOS #{simulator.version} Simulator" do
command XCVersion.install_simulator(simulator.version)
not_if { Xcode::Simulator.installed?(simulator.version) }
command XCVersion.install_simulator(simulator)
not_if { simulator.installed? }
end
end
end