Skip to content

Commit

Permalink
[iOS Extension] Provide 1 way to invoke rake tasks of target.
Browse files Browse the repository at this point in the history
  • Loading branch information
alloy authored and Watson1978 committed Dec 11, 2014
1 parent 506b536 commit 65e9c13
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions lib/motion/project/target/extension_target.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,27 @@ def initialize(path, type, config, opts)
@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
Expand All @@ -54,11 +71,7 @@ def build(platform)
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
Expand Down Expand Up @@ -106,9 +119,7 @@ def codesign(platform)
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)
Expand Down

0 comments on commit 65e9c13

Please sign in to comment.