incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [21/78] [abbrv] git commit: Copying in common www assets at build time
Date Fri, 27 Jul 2012 00:29:15 GMT
Copying in common www assets at build time


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/commit/00d14a23
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/tree/00d14a23
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/diff/00d14a23

Branch: refs/heads/cordova-client
Commit: 00d14a232438701accb47f92ae908beccbfe144d
Parents: 96b8511
Author: Fil Maj <maj.fil@gmail.com>
Authored: Tue Jul 17 15:01:28 2012 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Tue Jul 17 15:01:28 2012 -0700

----------------------------------------------------------------------
 README.md    |    1 +
 src/build.js |   33 ++++++++++++++++++++++++++++++++-
 2 files changed, 33 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/00d14a23/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 9ba5c9d..d5b7816 100644
--- a/README.md
+++ b/README.md
@@ -112,4 +112,5 @@ launch for.
 - clean up build + emulate commands
 - add plugin integration via pluginstall
 - `grep` through this project for 'TODO'
+- blackberry support
 - moar tests

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/00d14a23/src/build.js
----------------------------------------------------------------------
diff --git a/src/build.js b/src/build.js
index be380ac..5554574 100644
--- a/src/build.js
+++ b/src/build.js
@@ -1,6 +1,9 @@
 var cordova_util = require('./util'),
     path = require('path'),
     exec = require('child_process').exec,
+    wrench = require('wrench'),
+    rmrf = wrench.rmdirSyncRecursive,
+    cpr = wrench.copyDirSyncRecursive,
     config_parser = require('./config_parser'),
     fs = require('fs'),
     util = require('util');
@@ -14,11 +17,39 @@ module.exports = function build () {
     }
 
     var xml = path.join(projectRoot, 'www', 'config.xml');
+    var assets = path.join(projectRoot, 'www');
     var cfg = new config_parser(xml);
     var platforms = cfg.ls_platforms();
 
-    // Iterate over each added platform and shell out to debug command
+    // Iterate over each added platform 
     platforms.map(function(platform) {
+        // Copy in latest www assets.
+        var assetsPath;
+        switch (platform) {
+            // First clean out the existing www.
+            case 'android':
+                assetsPath = path.join(projectRoot, 'platforms', 'android', 'assets', 'www');
+                break;
+            case 'ios':
+                assetsPath = path.join(projectRoot, 'platforms', 'ios', 'www');
+                break;
+        } 
+        rmrf(assetsPath);
+        cpr(assets, assetsPath);
+        // Copy in the appropriate JS
+        var js;
+        var jsPath = path.join(assetsPath, 'cordova.js');
+        switch (platform) {
+            case 'android':
+                js = path.join(__dirname, '..', 'lib', 'android', 'framework', 'assets',
'js', 'cordova.android.js');
+                break;
+            case 'ios':
+                js = path.join(__dirname, '..', 'lib', 'ios', 'CordovaLib', 'javascript',
'cordova.ios.js');
+                break;
+        }
+        fs.writeFileSync(jsPath, fs.readFileSync(js));
+
+        // shell out to debug command
         var cmd = path.join(projectRoot, 'platforms', platform, 'cordova', 'debug');
         exec(cmd, function(err, stderr, stdout) {
             if (err) 


Mime
View raw message