From f662faa61c2974ab9a1c8bb65e421cb0ddda1095 Mon Sep 17 00:00:00 2001 From: Laurent Sansonetti Date: Fri, 14 Sep 2012 18:07:16 +0200 Subject: [PATCH] rake simulator's 'retina' option can now take 3.5 and 4 as values (for iphone5 retina mode) --- lib/motion/project.rb | 6 +++--- lib/motion/project/config.rb | 13 +++++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/motion/project.rb b/lib/motion/project.rb index e4f29247..55e658f4 100644 --- a/lib/motion/project.rb +++ b/lib/motion/project.rb @@ -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. diff --git a/lib/motion/project/config.rb b/lib/motion/project/config.rb index b0b65523..85770768 100644 --- a/lib/motion/project/config.rb +++ b/lib/motion/project/config.rb @@ -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