diff --git a/src/tasks/build/after/local/ios.coffee b/src/tasks/build/after/local/ios.coffee index b6fd17b..819a0b4 100644 --- a/src/tasks/build/after/local/ios.coffee +++ b/src/tasks/build/after/local/ios.coffee @@ -4,12 +4,14 @@ module.exports = ios = (grunt) -> tasks = buildIcons: require('./ios/icons')(grunt).build buildScreens: require('./ios/screens')(grunt).build + buildResources: require('./ios/resources')(grunt).build setStatusBar: require('./ios/plist')(grunt).setStatusBar run: (fn) -> fluid(tasks) .buildIcons() .buildScreens() + .buildResources() .setStatusBar() .go (err, result) -> if err then grunt.fatal err diff --git a/src/tasks/build/after/local/ios/resources.coffee b/src/tasks/build/after/local/ios/resources.coffee new file mode 100644 index 0000000..03e41ea --- /dev/null +++ b/src/tasks/build/after/local/ios/resources.coffee @@ -0,0 +1,23 @@ +path = require 'path' + +module.exports = resources = (grunt) -> + helpers = require('../../../../helpers')(grunt) + + build: (fn) -> + resources = helpers.config 'resources' + phonegapPath = helpers.config 'path' + appName = helpers.config 'name' + + dest = path.join phonegapPath, 'platforms', 'ios', appName + + if resources?.ios + for resource in resources?.ios + console.log 'resource from:'+resource.from+", to:"+resource.to + grunt.file.recurse resource.from, (file, root, filepath, filename) -> + console.log "copying "+file+ ","+root+","+filepath+","+filename + if filepath + grunt.file.copy file, path.join dest, resource.to, filepath, filename + else + grunt.file.copy file, path.join dest, resource.to, filename + + if fn then fn() diff --git a/tasks/build/after/local/ios.js b/tasks/build/after/local/ios.js index be57075..252db5e 100644 --- a/tasks/build/after/local/ios.js +++ b/tasks/build/after/local/ios.js @@ -8,11 +8,12 @@ tasks = { buildIcons: require('./ios/icons')(grunt).build, buildScreens: require('./ios/screens')(grunt).build, + buildResources: require('./ios/resources')(grunt).build, setStatusBar: require('./ios/plist')(grunt).setStatusBar }; return { run: function(fn) { - return fluid(tasks).buildIcons().buildScreens().setStatusBar().go(function(err, result) { + return fluid(tasks).buildIcons().buildScreens().buildResources().setStatusBar().go(function(err, result) { if (err) { grunt.fatal(err); } diff --git a/tasks/build/after/local/ios/resources.js b/tasks/build/after/local/ios/resources.js new file mode 100644 index 0000000..705d3fe --- /dev/null +++ b/tasks/build/after/local/ios/resources.js @@ -0,0 +1,38 @@ +(function() { + var path, resources; + + path = require('path'); + + module.exports = resources = function(grunt) { + var helpers; + helpers = require('../../../../helpers')(grunt); + return { + build: function(fn) { + var appName, dest, phonegapPath, resource, _i, _len, _ref; + resources = helpers.config('resources'); + phonegapPath = helpers.config('path'); + appName = helpers.config('name'); + dest = path.join(phonegapPath, 'platforms', 'ios', appName); + if (resources != null ? resources.ios : void 0) { + _ref = resources != null ? resources.ios : void 0; + for (_i = 0, _len = _ref.length; _i < _len; _i++) { + resource = _ref[_i]; + console.log('resource from:' + resource.from + ", to:" + resource.to); + grunt.file.recurse(resource.from, function(file, root, filepath, filename) { + console.log("copying " + file + "," + root + "," + filepath + "," + filename); + if (filepath) { + return grunt.file.copy(file, path.join(dest, resource.to, filepath, filename)); + } else { + return grunt.file.copy(file, path.join(dest, resource.to, filename)); + } + }); + } + } + if (fn) { + return fn(); + } + } + }; + }; + +}).call(this);