From cc577a3174f19fe5589de373dbca01dd1eb5d32d Mon Sep 17 00:00:00 2001 From: Laurent Sansonetti Date: Sun, 6 Nov 2011 14:06:50 +0100 Subject: [PATCH] validate given sdk_version --- lib/motion/rake/app.rb | 1 + lib/motion/rake/config.rb | 24 ++++++++++++++++++++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/lib/motion/rake/app.rb b/lib/motion/rake/app.rb index 673516b2..91507e5e 100644 --- a/lib/motion/rake/app.rb +++ b/lib/motion/rake/app.rb @@ -11,6 +11,7 @@ module Motion def setup yield config + config.validate end def build(platform) diff --git a/lib/motion/rake/config.rb b/lib/motion/rake/config.rb index f7dc015a..7f6a403b 100644 --- a/lib/motion/rake/config.rb +++ b/lib/motion/rake/config.rb @@ -52,6 +52,22 @@ module Motion map end + def validate + # sdk_version + ['iPhoneSimulator', 'iPhoneOS'].each do |platform| + sdk_path = File.join(platforms_dir, platform + '.platform', + "Developer/SDKs/#{platform}#{sdk_version}.sdk") + unless File.exist?(sdk_path) + $stderr.puts "Can't locate #{platform} SDK #{sdk_version} at `#{sdk_path}'" + exit 1 + end + end + unless File.exist?(datadir) + $stderr.puts "iOS SDK #{sdk_version} is not supported by this version of RubyMotion" + exit 1 + end + end + attr_reader :project_dir def project_file @@ -80,12 +96,16 @@ module Motion ary end + def motiondir + File.expand_path(File.join(File.dirname(__FILE__), '../../..')) + end + def bindir - File.expand_path(File.join(File.dirname(__FILE__), '../../../bin')) + File.join(motiondir, 'bin') end def datadir - File.expand_path(File.join(File.dirname(__FILE__), '../../../data', sdk_version)) + File.join(motiondir, 'data', sdk_version) end def platform_dir(platform)