From f40cf8b529b2bb84f587cfa0b36004e5e0592221 Mon Sep 17 00:00:00 2001 From: Watson Date: Fri, 28 Nov 2014 21:31:15 +0900 Subject: [PATCH] merge 92391851 commit for Framework --- lib/motion/project/target/framework_target.rb | 29 +++++++++++++------ 1 file changed, 20 insertions(+), 9 deletions(-) diff --git a/lib/motion/project/target/framework_target.rb b/lib/motion/project/target/framework_target.rb index 85b11bc9..3c9e558a 100644 --- a/lib/motion/project/target/framework_target.rb +++ b/lib/motion/project/target/framework_target.rb @@ -39,10 +39,27 @@ module Motion; module Project @opts = opts end + # This takes care of changing into the target's work directory, setting the + # required environment variables, and passing on whether to be verbose. + # + # @param [String] task + # The rake task to invoke in the target's context. + # + # @return [Boolean] Whether or not invoking the rake task succeeded. + # + def rake(task) + command = "cd #{@full_path} && #{environment_variables} rake #{task}" + if App::VERBOSE + command << " --trace" + puts command + end + system(command) + end + def build(platform) @platform = platform - command = if platform == 'iPhoneSimulator' + task = if platform == 'iPhoneSimulator' "build:simulator" else if @config.distribution_mode @@ -52,11 +69,7 @@ module Motion; module Project end end - args = '' - args << " --trace" if App::VERBOSE - - success = system("cd #{@full_path} && #{environment_variables} rake #{command} #{args}") - unless success + unless rake(task) App.fail "Target '#{@path}' failed to build" end end @@ -120,9 +133,7 @@ PLIST end def clean - args = '' - args << " --trace" if App::VERBOSE - system("cd #{@full_path} && #{environment_variables} rake clean #{args}") + rake 'clean' end def build_dir(config, platform)