From ac0fa619436fd768df3077edea9a33c409464e14 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eloy=20Dur=C3=A1n?= Date: Wed, 26 Feb 2014 14:22:17 +0100 Subject: [PATCH] [rake/iOS] Fail when trying to use retina=false on iOS >= 7. --- lib/motion/project/template/ios.rb | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/lib/motion/project/template/ios.rb b/lib/motion/project/template/ios.rb index 166fa36d..76e31d9a 100644 --- a/lib/motion/project/template/ios.rb +++ b/lib/motion/project/template/ios.rb @@ -60,12 +60,30 @@ end desc "Run the simulator" task :simulator do + deployment_target = Motion::Util::Version.new(App.config.deployment_target) + target = ENV['target'] - if target && Motion::Util::Version.new(target) < Motion::Util::Version.new(App.config.deployment_target) - App.fail "It is not possible to simulate an SDK version (#{target}) lower than the app’s deployment target (#{App.config.deployment_target})" + if target && Motion::Util::Version.new(target) < deployment_target + App.fail "It is not possible to simulate an SDK version (#{target}) " \ + "lower than the app’s deployment target (#{deployment_target})" end target ||= App.config.sdk_version + retina = ENV['retina'] + if retina && retina.strip.downcase == 'false' + ios_7 = Motion::Util::Version.new('7') + if Motion::Util::Version.new(target) >= ios_7 + if deployment_target < ios_7 + App.fail "In order to simulate on a non-retina device, please use " \ + "the `target' option to specify the simulated SDK version. " \ + "E.g.: rake target=#{deployment_target} retina=false" + else + App.fail "It is not possible to simulate on a non-retina device " \ + "when not deploying to iOS < 7." + end + end + end + unless ENV["skip_build"] Rake::Task["build:simulator"].invoke end @@ -104,7 +122,6 @@ END else App.config.device_family_ints[0] end - retina = ENV['retina'] simulate_device = App.config.device_family_string(family_int, target, retina) # Launch the simulator.