rake simulator's 'retina' option can now take 3.5 and 4 as values (for iphone5 retina mode)

This commit is contained in:
Laurent Sansonetti
2012-09-14 18:07:16 +02:00
parent b6a750bdfe
commit f662faa61c
2 changed files with 14 additions and 5 deletions

View File

@@ -81,13 +81,13 @@ task :simulator => ['build:simulator'] do
else
App.config.device_family_ints[0]
end
retina = ENV['retina'] == 'true'
retina = ENV['retina']
# Configure the SimulateDevice variable (the only way to specify if we want to run in retina mode or not).
simulate_device = App.config.device_family_string(family_int, retina)
simulate_device = App.config.device_family_string(family_int, target, retina)
if `/usr/bin/defaults read com.apple.iphonesimulator "SimulateDevice"`.strip != simulate_device
system("/usr/bin/killall \"iPhone Simulator\" >& /dev/null")
system("/usr/bin/defaults write com.apple.iphonesimulator \"SimulateDevice\" \"'#{App.config.device_family_string(family_int, retina)}'\"")
system("/usr/bin/defaults write com.apple.iphonesimulator \"SimulateDevice\" \"'#{simulate_device}'\"")
end
# Launch the simulator.

View File

@@ -464,14 +464,23 @@ EOS
end
end
def device_family_string(family, retina)
def device_family_string(family, target, retina)
device = case family
when :iphone, 1
"iPhone"
when :ipad, 2
"iPad"
end
retina ? device + " (Retina)" : device
case retina
when 'true'
device + (family == 1 and target >= '6.0' ? ' (Retina 4-inch)' : ' (Retina)')
when '3.5'
device + ' (Retina 3.5-inch)'
when '4'
device + ' (Retina 4-inch)'
else
device
end
end
def device_family_ints