You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by gt...@apache.org on 2013/03/22 23:49:46 UTC

[01/14] git commit: Small readme tweak.

Updated Branches:
  refs/heads/next 0aef8e9bc -> a17c20568


Small readme tweak.


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/7a1934d5
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/7a1934d5
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/7a1934d5

Branch: refs/heads/next
Commit: 7a1934d525d65c58e6efe3be68caeaf6c3703b11
Parents: 2bb8bac
Author: Fil Maj <ma...@gmail.com>
Authored: Thu Feb 21 12:01:32 2013 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Thu Feb 21 12:01:32 2013 -0800

----------------------------------------------------------------------
 README.md |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/7a1934d5/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index a4b4a33..146a5d4 100644
--- a/README.md
+++ b/README.md
@@ -24,7 +24,7 @@ In it's prototype stages, cordova-cli only works with Cordova v2.3.0.
 npm install -g cordova
 ```
 
-**NOTE**: on Mac OS X, you may want to change the owner of the cordova directory that npm installs to. This will allow you to run cordova as local user without requiring root permissions. Assuming your node_modules directory is in `/usr/local/lib/`, you can do this by running: `sudo chown -R <username> /usr/local/lib/node_modules/cordova`
+**NOTE**: on Unix-based machines, you may want to change the owner of the cordova directory that npm installs to. This will allow you to run cordova as local user without requiring root permissions. Assuming your node_modules directory is in `/usr/local/lib/`, you can do this by running: `sudo chown -R <username> /usr/local/lib/node_modules/cordova`
 
 # Getting Started
 


[11/14] git commit: Added Michael Wolf to committers list, expanded on "merges" functionality in README

Posted by gt...@apache.org.
Added Michael Wolf to committers list, expanded on "merges" functionality in README


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/bb776c0a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/bb776c0a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/bb776c0a

Branch: refs/heads/next
Commit: bb776c0a0321b0d78bd033f078d7246847c9483c
Parents: ec020e7
Author: Fil Maj <ma...@gmail.com>
Authored: Mon Mar 4 16:19:20 2013 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Mar 4 16:19:20 2013 -0800

----------------------------------------------------------------------
 README.md    |   38 +++++++++++++++++++++++++++-----------
 package.json |    3 ++-
 2 files changed, 29 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/bb776c0a/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 25c3f31..d98ff82 100644
--- a/README.md
+++ b/README.md
@@ -20,7 +20,9 @@ cordova-cli has been tested on Mas OS X and Linux.
 npm install -g cordova
 ```
 
-**NOTE**: on Unix-based machines, you may want to change the owner of the cordova directory that npm installs to. This will allow you to run cordova as local user without requiring root permissions. Assuming your node_modules directory is in `/usr/local/lib/`, you can do this by running: `sudo chown -R <username> /usr/local/lib/node_modules/cordova`
+**NOTE**: on Unix-based machines, you may want to change the owner of the cordova directory that npm installs to. This will allow you to run cordova as local user without requiring root permissions. Assuming your node_modules directory is in `/usr/local/lib/`, you can do this by running: 
+
+    sudo chown -R <username> /usr/local/lib/node_modules/cordova
 
 # Getting Started
 
@@ -47,15 +49,20 @@ cordova-cli has a single global `create` command that creates new cordova projec
 
 
 # Project Directory Structure
-A Cordova application built with cordova-cli will have the following
-directory structure:
+A Cordova application built with cordova-cli will have the following directory structure:
 
     myApp/
-    |-.cordova/
-    |- merges/
-    |- platforms/
-    |- plugins/
-    `- www/
+    |--.cordova/
+    |-- merges/
+    | |-- android/
+    | |-- blackberry/
+    | `-- ios/
+    |-- platforms/
+    | |-- android/
+    | |-- blackberry/
+    | `-- ios/
+    |-- plugins/
+    `-- www/
 
 ## .cordova/
 This directory identifies a tree as a cordova project. Simple configuration information is stored in here (such as BlackBerry environment variables).
@@ -63,11 +70,20 @@ This directory identifies a tree as a cordova project. Simple configuration info
 Commands other than `create` operate against the project directory itself, rather than the current directory - a search up the current directory's parents is made to find the project directory. Thus, any command (other than `create`) can be used from any subdirectory whose parent is a cordova project directory (same as git).
 
 ## merges/
-Platform specific web artifacts, such as .html, .css and .js files which is deployed on build to the appropriate native directory.  Files placed in merges will override matching files in www for a specific platform.
+Platform-specific web assets (HTML, CSS and JavaScript files) are contained within appropriate subfolders in this directory. These are deployed during a `prepare` to the appropriate native directory.  Files placed under `merges/` will override matching files in the `www/` folder for the relevant platform. A quick example, assuming a project structure of:
+
+    merges/
+    |-- ios/
+    | `-- app.js
+    |-- android/
+    | `-- android.js
+    www/
+      `-- app.js
+
+After building the Android and iOS projects, the Android application will contain both `app.js` and `android.js`. However, the iOS application will only contain an `app.js`, and it will override the "common" `app.js` located inside the `www/` folder above.
 
 ## platforms/
-Platforms added to your application will have the native
- application project structures laid out within this directory.
+Platforms added to your application will have the native application project structures laid out within this directory.
 
 ## plugins/
 Any added plugins will be extracted or copied into this directory.

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/bb776c0a/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index ac0bedc..c213ca2 100644
--- a/package.json
+++ b/package.json
@@ -45,7 +45,8 @@
     {"name": "Michael Brooks", "email":"michael@michaelbrooks.ca"},
     {"name": "Braden Shepherdson", "email":"braden@chromium.org"},
     {"name": "Gord Tanner", "email":"gtanner@gmail.com"},
-    {"name": "Tim Kim", "email": "timk@adobe.com"}
+    {"name": "Tim Kim", "email": "timk@adobe.com"},
+    {"name": "Michael Wolf", "email": "Michael.Wolf@Cynergy.com"}
   ],
   "license": "Apache version 2.0"
 }


[03/14] git commit: addition of merges functionality

Posted by gt...@apache.org.
addition of merges functionality

merges functionality which allows for merging in www content per
platform.  For more detail see the following email thread with
brian.leroux@gmail.com
-----------------
Dude, first thing I have to say that I love this, I think its a really
great addition, and will clean up project code a tonne. Some
feedback/queries:

- don't like the folder name. Its precious, I know, but I think we can
some up w/ some better than isn't camel cased. www-overrides or maybe
just "clobbers" or "merges" seems more descriptive to me (in my ideal
fantasy world platforms wouldn't even be in revision control and would
be a build artifact. we're not there yet obviously!)

- if I have something in the overrides folder that IS NOT in the www
equiv would it just get copied/merged in? seems this would be so but
this isn't clear

This def belongs in the cordova-cli project. What I also like is that
we could really start envisioning more shim type code working here.
(For cases like Chrome Packaged Apps or what have you.)

On Sun, Feb 10, 2013 at 3:22 AM, Michael Wolf
<Mi...@cynergy.com> wrote:
Awesome.  Its funny you mention the platform name, when I first did
this in our build system I ended up following the iOS pattern of doing
like ~platform name like they do ~iphone or ~ipad.  However it just
became a pain as you had to change file names and more importantly it
confused as to what was purely in browser versus what would go into the
platform builds.  So what I ended up having us do was have an overrides
folder that just has the same file structure of the www such that you
just copy over and what evers in the overrides folder overwrites the
www file which had been copied in.  see below as an example.  Anywho…
happy to contribute is this the map git
https://github.com/apache/cordova-cli ?

mw

On 2/9/13 5:52 AM, "Brian LeRoux" <b...@brian.io> wrote:

I love this idea. A much older prototype of the CLI stuff had some
smarts that when it detected a file with a platform name in the string
it copied it only to that platform.

Do a pull request and link in this thread for discussion. I think it
would be a great addition to the workflow.

On Fri, Feb 8, 2013 at 6:15 PM, Michael Wolf <Mi...@cynergy.com>
wrote:
Hey Man:

I have been loving the updates in the phone gap cli.  Have a feature Id
love
to add, its something which I had in our internal cynergy build scripts
to
support building for multiple platforms at once and mocking in, in
browser.
The idea is a platform overrides folder, which will override
css/js/html/images etc when deployed to a specific platform.  For
example
images you want to replace on android but not iOS, or js code you want
to
mock in browser, but then replace w/ a real implementation when
building for
android/ios, or instead of writing conditional platform logic for a fix
in
iOS or android you replace the actual js file on each platform.   This
is a
strategy which we have used on our projects since the early halo days,
and
it has helped a lot in simplifying production code…. Particualry when
you
try and build for a common base between say something for ios/android
and
windows phone. Anywho….

I have an implantation working in the cordova cli node scripts.  How
might I
go about swinging this idea by team, more than happy to add the feature.

mw


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/b7bd89ac
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/b7bd89ac
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/b7bd89ac

Branch: refs/heads/next
Commit: b7bd89ac4cf4383b3fff7728b3987314bd482069
Parents: c1c6638
Author: michael.wolf <mi...@MWolf-MBP.local>
Authored: Mon Feb 11 22:28:58 2013 -0500
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Mar 4 10:43:35 2013 -0800

----------------------------------------------------------------------
 src/create.js                     |    1 +
 src/metadata/android_parser.js    |    8 ++++++++
 src/metadata/blackberry_parser.js |    9 +++++++++
 src/metadata/ios_parser.js        |    9 +++++++++
 src/platform.js                   |    8 ++++++++
 5 files changed, 35 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b7bd89ac/src/create.js
----------------------------------------------------------------------
diff --git a/src/create.js b/src/create.js
index c2f20bd..c4ddb1d 100644
--- a/src/create.js
+++ b/src/create.js
@@ -59,6 +59,7 @@ module.exports = function create (dir, id, name) {
     // Create basic project structure.
     shell.mkdir('-p', dotCordova);
     shell.mkdir('-p', path.join(dir, 'platforms'));
+    shell.mkdir('-p', path.join(dir, 'merges'));
     shell.mkdir('-p', path.join(dir, 'plugins'));
     var hooks = path.join(dotCordova, 'hooks');
     shell.mkdir('-p', hooks);

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b7bd89ac/src/metadata/android_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/android_parser.js b/src/metadata/android_parser.js
index a79101f..e83bb82 100644
--- a/src/metadata/android_parser.js
+++ b/src/metadata/android_parser.js
@@ -144,6 +144,14 @@ module.exports.prototype = {
         // delete any .svn folders copied over
         util.deleteSvnFolders(platformWww);
     },
+
+    // update the overrides folder into the www folder
+    update_overrides:function() {
+        var projectRoot = util.isCordova(this.path);
+        var overrides = path.join(projectRoot, 'merges','android','*');
+        shell.cp('-rf', overrides, this.www_dir());
+    },
+
     update_project:function(cfg, callback) {
         this.update_from_config(cfg);
         this.update_www();

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b7bd89ac/src/metadata/blackberry_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/blackberry_parser.js b/src/metadata/blackberry_parser.js
index e10fa83..91d0f60 100644
--- a/src/metadata/blackberry_parser.js
+++ b/src/metadata/blackberry_parser.js
@@ -120,6 +120,15 @@ module.exports.prototype = {
 
         util.deleteSvnFolders(platformWww);
     },
+
+    // update the overrides folder into the www folder
+    update_overrides:function() {
+        var projectRoot = util.isCordova(this.path);
+        var platformWww = path.join(this.path, 'www');
+        var overrides = path.join(projectRoot, 'merges','blackberry');
+        shell.cp('-rf', overrides+'/*',platformWww);
+    },
+
     write_project_properties:function() {
         // TODO: eventually support all blackberry sub-platforms
         var projectRoot = util.isCordova(this.path);

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b7bd89ac/src/metadata/ios_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/ios_parser.js b/src/metadata/ios_parser.js
index 9a9f306..03455ed 100644
--- a/src/metadata/ios_parser.js
+++ b/src/metadata/ios_parser.js
@@ -153,6 +153,15 @@ module.exports.prototype = {
 
         util.deleteSvnFolders(project_www);
     },
+
+    // update the overrides folder into the www folder
+    update_overrides:function() {
+        var projectRoot = util.isCordova(this.path);
+        var project_www = path.join(this.path, 'www');
+        var overrides = path.join(projectRoot, 'merges','ios');
+        shell.cp('-rf', overrides+'/*',project_www);
+    },
+
     update_project:function(cfg, callback) {
         var self = this;
         this.update_from_config(cfg, function() {

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/b7bd89ac/src/platform.js
----------------------------------------------------------------------
diff --git a/src/platform.js b/src/platform.js
index cd3098b..4705130 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -38,6 +38,10 @@ module.exports = function platform(command, targets, callback) {
     var hooks = new hooker(projectRoot),
         end;
 
+    var createOverrides = function(target){
+        shell.mkdir('-p', path.join('merges',target));
+    };
+
     if (arguments.length === 0) command = 'ls';
     if (targets) {
         if (!(targets instanceof Array)) targets = [targets];
@@ -91,12 +95,14 @@ module.exports = function platform(command, targets, callback) {
                                 case 'android':
                                     var android = new android_parser(output);
                                     android.update_project(cfg);
+                                    createOverrides(target);
                                     hooks.fire('after_platform_add');
                                     end();
                                     break;
                                 case 'ios':
                                     var ios = new ios_parser(output);
                                     ios.update_project(cfg, function() {
+                                        createOverrides(target);
                                         hooks.fire('after_platform_add');
                                         end();
                                     });
@@ -104,6 +110,7 @@ module.exports = function platform(command, targets, callback) {
                                 case 'blackberry':
                                     var bb = new blackberry_parser(output);
                                     bb.update_project(cfg, function() {
+                                        createOverrides(target);
                                         hooks.fire('after_platform_add');
                                         end();
                                     });
@@ -119,6 +126,7 @@ module.exports = function platform(command, targets, callback) {
             targets.forEach(function(target) {
                 hooks.fire('before_platform_rm');
                 shell.rm('-rf', path.join(projectRoot, 'platforms', target));
+                shell.rm('-rf', path.join(projectRoot,'merges',target));
                 hooks.fire('after_platform_rm');
             });
             break;


[12/14] git commit: 2.5.2 package.json version.

Posted by gt...@apache.org.
2.5.2 package.json version.


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/7c0d0091
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/7c0d0091
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/7c0d0091

Branch: refs/heads/next
Commit: 7c0d0091c6f1c1974d520a0bc19f9539dc3f6980
Parents: bb776c0
Author: Fil Maj <ma...@gmail.com>
Authored: Mon Mar 4 16:20:01 2013 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Mar 4 16:20:01 2013 -0800

----------------------------------------------------------------------
 package.json |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/7c0d0091/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index c213ca2..bab301c 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "cordova",
-  "version": "2.5.1",
+  "version": "2.5.2",
   "preferGlobal": "true",
   "description": "Cordova command line interface tool",
   "main": "cordova",


[05/14] git commit: Update .gitignore

Posted by gt...@apache.org.
Update .gitignore


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/6dd54105
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/6dd54105
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/6dd54105

Branch: refs/heads/next
Commit: 6dd541050ab7792366eb881690c3e672ca080ae5
Parents: 30f2d5c
Author: geekpunk <mi...@hotmail.com>
Authored: Sat Mar 2 13:17:12 2013 -0500
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Mar 4 10:47:31 2013 -0800

----------------------------------------------------------------------
 .gitignore |    5 -----
 1 files changed, 0 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/6dd54105/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 3abe651..1228061 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,8 +6,3 @@ spec/fixtures/projects/native
 spec/fixtures/projects/cordova
 lib/cordova-android/framework/bin
 lib/cordova-android/framework/gen
-.idea/*
-spec/fixtures/*
-.gitcore
-*.jar
-lib/*


[02/14] git commit: Merge branch 'next'

Posted by gt...@apache.org.
Merge branch 'next'


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/c1c66386
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/c1c66386
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/c1c66386

Branch: refs/heads/next
Commit: c1c66386ec81762a41d94d8d4d4dde22eafe2db3
Parents: 7a1934d 0aef8e9
Author: Fil Maj <ma...@gmail.com>
Authored: Wed Feb 27 13:55:10 2013 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed Feb 27 13:55:10 2013 -0800

----------------------------------------------------------------------
 README.md                                          |    6 +-
 VERSION                                            |    2 +-
 lib/cordova-android/VERSION                        |    2 +-
 .../bin/templates/cordova/appinfo.jar              |  Bin 1574 -> 1574 bytes
 .../bin/templates/project/assets/www/index.html    |    2 +-
 .../framework/assets/js/cordova.android.js         |   26 +-
 .../framework/assets/www/index.html                |    2 +-
 .../framework/src/org/apache/cordova/Device.java   |    2 +-
 lib/cordova-blackberry/VERSION                     |    2 +-
 .../bin/templates/project/www/VERSION              |    2 +-
 .../bin/templates/project/www/index.html           |    2 +-
 .../ext/src/org/apache/cordova/device/Device.java  |    2 +-
 .../javascript/cordova.blackberry.js               |  345 ++++++++++++---
 lib/cordova-ios/CordovaLib/Classes/CDVCamera.h     |    1 +
 lib/cordova-ios/CordovaLib/Classes/CDVCamera.m     |   62 ++-
 lib/cordova-ios/CordovaLib/VERSION                 |    2 +-
 lib/cordova-ios/CordovaLib/cordova.ios.js          |   30 ++-
 lib/cordova-ios/RELEASENOTES.md                    |   56 +++-
 .../guides/Cordova Plugin Upgrade Guide.md         |   58 +++-
 package.json                                       |    2 +-
 20 files changed, 497 insertions(+), 109 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/c1c66386/README.md
----------------------------------------------------------------------


[06/14] git commit: added merges tests

Posted by gt...@apache.org.
added merges tests

- added tests for merges to buid.spec to watch for the update_overrides
method to be called.

- added tests to individual parses to ensure that the copys process
correctly

- added merges directory to bootstape for use in fixtures


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/51f1cc35
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/51f1cc35
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/51f1cc35

Branch: refs/heads/next
Commit: 51f1cc353f1b5b45a4f5bd0767420f8aa98a3275
Parents: 293ec62
Author: michael.wolf <mi...@MWolf-MBP.local>
Authored: Sun Feb 17 18:42:08 2013 -0500
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Mar 4 10:47:31 2013 -0800

----------------------------------------------------------------------
 bootstrap.js                            |    5 +-
 spec/build.spec.js                      |   62 +++++++++++-
 spec/metadata/android_parser.spec.js    |   41 +++++++
 spec/metadata/blackberry_parser.spec.js |   41 +++++++
 spec/metadata/ios_parser.spec.js        |  150 ++++++++++++++++----------
 5 files changed, 242 insertions(+), 57 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/51f1cc35/bootstrap.js
----------------------------------------------------------------------
diff --git a/bootstrap.js b/bootstrap.js
index 7152a6b..e45a5f9 100644
--- a/bootstrap.js
+++ b/bootstrap.js
@@ -90,7 +90,9 @@ platforms.forEach(function(platform) {
                     shell.rm('-rf', path.join(dub, 'spec'));
                     // copy over to full cordova project test fixture
                     shell.mkdir('-p', platformDir);
-                    shell.cp('-rf', path.join(fix_path, '*'), platformDir); 
+                    shell.cp('-rf', path.join(fix_path, '*'), platformDir);
+                    shell.mkdir('-p',path.join(cordovaDir,'merges',platform));
+
                     // set permissions on executables
                     var scripts_path = path.join(fix_path, 'cordova');
                     var other_path = path.join(platformDir, 'cordova');
@@ -108,3 +110,4 @@ platforms.forEach(function(platform) {
         }
     });
 });
+

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/51f1cc35/spec/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/build.spec.js b/spec/build.spec.js
index 2427a0b..9eeffb5 100644
--- a/spec/build.spec.js
+++ b/spec/build.spec.js
@@ -29,7 +29,12 @@ var cordova = require('../cordova'),
     fixtures = path.join(__dirname, 'fixtures'),
     hooks = path.join(fixtures, 'hooks'),
     tempDir = path.join(__dirname, '..', 'temp'),
-    cordova_project = path.join(fixtures, 'projects', 'cordova');
+    cordova_project = path.join(fixtures, 'projects', 'cordova'),
+    ios_project_path = path.join(cordova_project, 'platforms', 'ios'),
+    blackberry_project_path = path.join(cordova_project, 'platforms', 'blackberry'),
+    www_config = path.join(cordova_project, 'www', 'config.xml');
+
+
 
 var cwd = process.cwd();
 
@@ -135,5 +140,60 @@ describe('build command', function() {
                 expect(s).not.toHaveBeenCalledWith('after_build');
             });
         });
+
+    });
+
+    describe('merges', function() {
+        describe('per platform', function() {
+            beforeEach(function() {
+                process.chdir(cordova_project);
+            });
+
+            afterEach(function() {
+                process.chdir(cwd);
+            });
+
+            describe('Android', function() {
+                it('should call android_parser\'s update_overrides', function() {
+                    spyOn(require('shelljs'), 'exec').andReturn({code:0});
+                    var s = spyOn(android_parser.prototype, 'update_overrides');
+
+                    cordova.build('android');
+                    expect(s).toHaveBeenCalled();
+                });
+
+            });
+
+            describe('iOS', function() {
+                it('should call ios_parser\'s update_overrides', function(done) {
+                    var parser = new ios_parser(ios_project_path);
+                    var config = new config_parser(www_config);
+
+                    var s = spyOn(parser, 'update_overrides');
+                    parser.update_project(config, function() {
+                        expect(s).toHaveBeenCalled();
+                        done();
+                    });
+                });
+
+            });
+
+            describe('BlackBerry', function() {
+                it('should call blackberry_parser\'s update_overrides', function(done) {
+                    var parser = new blackberry_parser(blackberry_project_path);
+                    var config = new config_parser(www_config);
+
+                    var s = spyOn(parser, 'update_overrides');
+                    parser.update_project(config, function() {
+                        expect(s).toHaveBeenCalled();
+                        done();
+                    });
+                });
+
+            });
+
+
+        });
     });
+
 });

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/51f1cc35/spec/metadata/android_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/android_parser.spec.js b/spec/metadata/android_parser.spec.js
index 5429dec..0f965e7 100644
--- a/spec/metadata/android_parser.spec.js
+++ b/spec/metadata/android_parser.spec.js
@@ -177,6 +177,47 @@ describe('android project parser', function() {
             });
         });
 
+        describe('update_overrides method',function() {
+
+            it('should copy a new file from merges into www', function() {
+
+                var newFile = path.join(project_path, 'merges','android', 'merge.js');
+
+                this.after(function() {
+                    shell.rm('-rf', path.join(project_path, 'merges','android','merge.js'));
+                });
+
+                fs.writeFileSync(newFile, 'alert("sup");', 'utf-8');
+                parser.update_overrides();
+                expect(fs.existsSync(path.join(android_project_path, 'assets', 'www', 'merge.js'))).toBe(true);
+            });
+
+            it('should copy a file from merges over a file in www', function() {
+
+                var newFile = path.join(project_path, 'merges','android', 'merge.js');
+                var newFileWWW = path.join(project_path, 'www','merge.js');
+
+                this.after(function() {
+                    shell.rm('-rf', path.join(project_path, 'merges','android','merge.js'));
+                    shell.rm('-rf',path.join(project_path,'www','merge.js'));
+                });
+
+                fs.writeFileSync(newFile, 'var foo=2;', 'utf-8');
+                fs.writeFileSync(newFileWWW, 'var foo=1;', 'utf-8');
+                parser.update_overrides();
+                expect(fs.existsSync(path.join(android_project_path, 'assets', 'www', 'merge.js'))).toBe(true);
+                console.log(fs.readFileSync(path.join(android_project_path, 'assets', 'www', 'merge.js')));
+                expect(fs.readFileSync(path.join(android_project_path, 'assets', 'www', 'merge.js'),'utf-8')).toEqual('var foo=2;');
+            });
+
+
+            it('should call out to util.deleteSvnFolders', function() {
+                var spy = spyOn(util, 'deleteSvnFolders');
+                parser.update_overrides();
+                expect(spy).toHaveBeenCalled();
+            });
+        });
+
         describe('update_project method', function() {
             it('should invoke update_www', function() {
                 var spyWww = spyOn(parser, 'update_www');

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/51f1cc35/spec/metadata/blackberry_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/blackberry_parser.spec.js b/spec/metadata/blackberry_parser.spec.js
index 17cb905..21eb826 100644
--- a/spec/metadata/blackberry_parser.spec.js
+++ b/spec/metadata/blackberry_parser.spec.js
@@ -145,6 +145,47 @@ describe('blackberry project parser', function() {
             });
         });
 
+        describe('update_overrides method',function() {
+
+            it('should copy a new file from merges into www', function() {
+
+                var newFile = path.join(project_path, 'merges','blackberry', 'merge.js');
+
+                this.after(function() {
+                    shell.rm('-rf', path.join(project_path, 'merges','blackberry','merge.js'));
+                });
+
+                fs.writeFileSync(newFile, 'alert("sup");', 'utf-8');
+                parser.update_overrides();
+                expect(fs.existsSync(path.join(blackberry_project_path, 'www', 'merge.js'))).toBe(true);
+            });
+
+            it('should copy a file from merges over a file in www', function() {
+
+                var newFile = path.join(project_path, 'merges','blackberry', 'merge.js');
+                var newFileWWW = path.join(project_path, 'www','merge.js');
+
+                this.after(function() {
+                    shell.rm('-rf', path.join(project_path, 'merges','blackberry','merge.js'));
+                    shell.rm('-rf',path.join(project_path,'www','merge.js'));
+                });
+
+                fs.writeFileSync(newFile, 'var foo=2;', 'utf-8');
+                fs.writeFileSync(newFileWWW, 'var foo=1;', 'utf-8');
+                parser.update_overrides();
+                expect(fs.existsSync(path.join(blackberry_project_path, 'www', 'merge.js'))).toBe(true);
+                expect(fs.readFileSync(path.join(blackberry_project_path, 'www', 'merge.js'),'utf-8')).toEqual('var foo=2;');
+            });
+
+
+            it('should call out to util.deleteSvnFolders', function() {
+                var spy = spyOn(util, 'deleteSvnFolders');
+                parser.update_overrides();
+                expect(spy).toHaveBeenCalled();
+            });
+        });
+
+
         describe('update_project method', function() {
             var cordova_config_path = path.join(project_path, '.cordova', 'config.json');
             var original_config_json = fs.readFileSync(cordova_config_path, 'utf-8');

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/51f1cc35/spec/metadata/ios_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/ios_parser.spec.js b/spec/metadata/ios_parser.spec.js
index b467fef..de62b1c 100644
--- a/spec/metadata/ios_parser.spec.js
+++ b/spec/metadata/ios_parser.spec.js
@@ -1,21 +1,21 @@
 /**
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-*/
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+ */
 
 var ios_parser = require('../../src/metadata/ios_parser'),
     config_parser = require('../../src/config_parser'),
@@ -26,28 +26,28 @@ var ios_parser = require('../../src/metadata/ios_parser'),
     fs = require('fs'),
     et = require('elementtree'),
     projects_path = path.join(__dirname, '..', 'fixtures', 'projects')
-    ios_path = path.join(projects_path, 'native', 'ios_fixture'),
+ios_path = path.join(projects_path, 'native', 'ios_fixture'),
     project_path = path.join(projects_path, 'cordova'),
     ios_project_path = path.join(project_path, 'platforms', 'ios');
 
 var www_config = path.join(project_path, 'www', 'config.xml');
 var original_www_config = fs.readFileSync(www_config, 'utf-8');
 
-describe('ios project parser', function() {
-    it('should throw an exception with a path that is not a native ios project', function() {
-        expect(function() {
+describe('ios project parser', function () {
+    it('should throw an exception with a path that is not a native ios project', function () {
+        expect(function () {
             var project = new ios_parser(process.cwd());
         }).toThrow();
     });
-    it('should accept a proper native ios project path as construction parameter', function() {
+    it('should accept a proper native ios project path as construction parameter', function () {
         var project;
-        expect(function() {
+        expect(function () {
             project = new ios_parser(ios_path);
         }).not.toThrow();
         expect(project).toBeDefined();
     });
 
-    describe('update_from_config method', function() {
+    describe('update_from_config method', function () {
         var project, config;
 
         var ios_plist = path.join(ios_path, 'cordovaExample', 'cordovaExample-Info.plist'),
@@ -58,48 +58,48 @@ describe('ios project parser', function() {
         var original_plist = fs.readFileSync(ios_plist, 'utf-8');
         var original_ios_config = fs.readFileSync(ios_config_xml, 'utf-8');
 
-        beforeEach(function() {
+        beforeEach(function () {
             project = new ios_parser(ios_path);
             config = new config_parser(www_config);
         });
-        afterEach(function() {
+        afterEach(function () {
             fs.writeFileSync(ios_pbx, original_pbx, 'utf-8');
             fs.writeFileSync(ios_config_xml, original_ios_config, 'utf-8');
             fs.writeFileSync(ios_plist, original_plist, 'utf-8');
             fs.writeFileSync(www_config, original_www_config, 'utf-8');
         });
-        it('should throw an exception if a non config_parser object is passed into it', function() {
-            expect(function() {
+        it('should throw an exception if a non config_parser object is passed into it', function () {
+            expect(function () {
                 project.update_from_config({});
             }).toThrow();
         });
-        it('should update the application name properly', function(done) {
+        it('should update the application name properly', function (done) {
             config.name('bond. james bond.');
-            project.update_from_config(config, function() {
+            project.update_from_config(config, function () {
                 var pbx_contents = fs.readFileSync(ios_pbx, 'utf-8');
                 expect(pbx_contents.match(/PRODUCT_NAME\s*=\s*"bond. james bond."/)[0]).toBe('PRODUCT_NAME = "bond. james bond."');
                 done();
             });
         });
-        it('should update the application package name (bundle identifier) properly', function(done) {
+        it('should update the application package name (bundle identifier) properly', function (done) {
             config.packageName('ca.filmaj.dewd');
-            project.update_from_config(config, function() {
+            project.update_from_config(config, function () {
                 var plist_contents = fs.readFileSync(ios_plist, 'utf-8');
                 expect(plist_contents).toMatch(/<string>ca.filmaj.dewd/);
                 done();
             });
         });
-        it('should update the whitelist in the project config.xml', function(done) {
-            project.update_from_config(config, function() {
+        it('should update the whitelist in the project config.xml', function (done) {
+            project.update_from_config(config, function () {
                 var config_contents = fs.readFileSync(ios_config_xml, 'utf-8');
                 expect(config_contents).toMatch(/<access origin="\*" \/>/);
                 done();
             });
         });
-        describe('preferences', function() {
-            it('should not change default project preferences and copy over additional project preferences to platform-level config.xml', function(done) {
-                config.preference.add({name:'henrik',value:'sedin'});
-                project.update_from_config(config, function() {
+        describe('preferences', function () {
+            it('should not change default project preferences and copy over additional project preferences to platform-level config.xml', function (done) {
+                config.preference.add({name:'henrik', value:'sedin'});
+                project.update_from_config(config, function () {
                     var native_config = new et.ElementTree(et.XML(fs.readFileSync(ios_config_xml, 'utf-8')));
                     var ps = native_config.findall('preference');
                     expect(ps.length).toEqual(17);
@@ -110,9 +110,9 @@ describe('ios project parser', function() {
                     done();
                 });
             });
-            it('should override a default project preference if applicable', function(done) {
-                config.preference.add({name:'UIWebViewBounce',value:'false'});
-                project.update_from_config(config, function() {
+            it('should override a default project preference if applicable', function (done) {
+                config.preference.add({name:'UIWebViewBounce', value:'false'});
+                project.update_from_config(config, function () {
                     var native_config = new et.ElementTree(et.XML(fs.readFileSync(ios_config_xml, 'utf-8')));
                     var ps = native_config.findall('preference');
                     expect(ps.length).toEqual(16);
@@ -124,7 +124,7 @@ describe('ios project parser', function() {
         });
     });
 
-    describe('cross-platform project level methods', function() {
+    describe('cross-platform project level methods', function () {
         var parser, config;
         var ios_plist = path.join(ios_project_path, 'cordovaExample', 'cordovaExample-Info.plist'),
             ios_pbx = path.join(ios_project_path, 'cordovaExample.xcodeproj', 'project.pbxproj'),
@@ -134,49 +134,89 @@ describe('ios project parser', function() {
         var original_plist = fs.readFileSync(ios_plist, 'utf-8');
         var original_ios_config = fs.readFileSync(ios_config_xml, 'utf-8');
 
-        beforeEach(function() {
+        beforeEach(function () {
             parser = new ios_parser(ios_project_path);
             config = new config_parser(www_config);
         });
-        afterEach(function() {
+        afterEach(function () {
             fs.writeFileSync(ios_pbx, original_pbx, 'utf-8');
             fs.writeFileSync(ios_config_xml, original_ios_config, 'utf-8');
             fs.writeFileSync(ios_plist, original_plist, 'utf-8');
             fs.writeFileSync(www_config, original_www_config, 'utf-8');
         });
 
-        describe('update_www method', function() {
-            it('should update all www assets', function() {
+        describe('update_www method', function () {
+            it('should update all www assets', function () {
                 var newFile = path.join(project_path, 'www', 'somescript.js');
-                this.after(function() {
+                this.after(function () {
                     shell.rm('-f', newFile);
                 });
                 fs.writeFileSync(newFile, 'alert("sup");', 'utf-8');
                 parser.update_www();
                 expect(fs.existsSync(path.join(ios_project_path, 'www', 'somescript.js'))).toBe(true);
             });
-            it('should write out ios js to cordova.js', function() {
+            it('should write out ios js to cordova.js', function () {
                 parser.update_www();
-                expect(fs.readFileSync(path.join(ios_project_path, 'www', 'cordova.js'),'utf-8')).toBe(fs.readFileSync(path.join(util.libDirectory, 'cordova-ios', 'CordovaLib', 'cordova.ios.js'), 'utf-8'));
+                expect(fs.readFileSync(path.join(ios_project_path, 'www', 'cordova.js'), 'utf-8')).toBe(fs.readFileSync(path.join(util.libDirectory, 'cordova-ios', 'CordovaLib', 'cordova.ios.js'), 'utf-8'));
             });
-            it('should call out to util.deleteSvnFolders', function() {
+            it('should call out to util.deleteSvnFolders', function () {
                 var spy = spyOn(util, 'deleteSvnFolders');
                 parser.update_www();
                 expect(spy).toHaveBeenCalled();
             });
         });
 
-        describe('update_project method', function() {
-            it('should invoke update_www', function(done) {
+        describe('update_overrides method', function () {
+
+            it('should copy a new file from merges into www', function () {
+
+                var newFile = path.join(project_path, 'merges', 'ios', 'merge.js');
+
+                this.after(function () {
+                    shell.rm('-rf', path.join(project_path, 'merges','ios','merge.js'));
+                });
+
+                fs.writeFileSync(newFile, 'alert("sup");', 'utf-8');
+                parser.update_overrides();
+                expect(fs.existsSync(path.join(ios_project_path, 'www', 'merge.js'))).toBe(true);
+            });
+
+            it('should copy a file from merges over a file in www', function () {
+
+                var newFile = path.join(project_path, 'merges', 'ios', 'merge.js');
+                var newFileWWW = path.join(project_path, 'www', 'merge.js');
+
+                this.after(function () {
+                    shell.rm('-rf', path.join(project_path, 'merges','ios','merge.js'));
+                    shell.rm('-rf', path.join(project_path, 'www', 'merge.js'));
+                });
+
+                fs.writeFileSync(newFile, 'var foo=2;', 'utf-8');
+                fs.writeFileSync(newFileWWW, 'var foo=1;', 'utf-8');
+                parser.update_overrides();
+                expect(fs.existsSync(path.join(ios_project_path, 'www', 'merge.js'))).toBe(true);
+                expect(fs.readFileSync(path.join(ios_project_path, 'www', 'merge.js'), 'utf-8')).toEqual('var foo=2;');
+            });
+
+            it('should call out to util.deleteSvnFolders', function() {
+                var spy = spyOn(util, 'deleteSvnFolders');
+                parser.update_overrides();
+                expect(spy).toHaveBeenCalled();
+            });
+
+        });
+
+        describe('update_project method', function () {
+            it('should invoke update_www', function (done) {
                 var spyWww = spyOn(parser, 'update_www');
-                parser.update_project(config, function() {
+                parser.update_project(config, function () {
                     expect(spyWww).toHaveBeenCalled();
                     done();
                 });
             });
-            it('should invoke update_from_config', function(done) {
+            it('should invoke update_from_config', function (done) {
                 var spyConfig = spyOn(parser, 'update_from_config').andCallThrough();
-                parser.update_project(config, function() {
+                parser.update_project(config, function () {
                     expect(spyConfig).toHaveBeenCalled();
                     done();
                 });


[08/14] git commit: added merges to base cli documentation

Posted by gt...@apache.org.
added merges to base cli documentation


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/30f2d5cf
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/30f2d5cf
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/30f2d5cf

Branch: refs/heads/next
Commit: 30f2d5cf32b12ba79063554e46fdab903202e4ff
Parents: a94d290
Author: michael.wolf <mi...@MWolf-MBP.local>
Authored: Sat Mar 2 13:09:25 2013 -0500
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Mar 4 10:47:31 2013 -0800

----------------------------------------------------------------------
 .gitignore |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/30f2d5cf/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 1228061..3abe651 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,8 @@ spec/fixtures/projects/native
 spec/fixtures/projects/cordova
 lib/cordova-android/framework/bin
 lib/cordova-android/framework/gen
+.idea/*
+spec/fixtures/*
+.gitcore
+*.jar
+lib/*


[10/14] git commit: test fixes and convention tweaks following merging in "merges" functionality

Posted by gt...@apache.org.
test fixes and convention  tweaks following merging in "merges" functionality


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/ec020e7f
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/ec020e7f
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/ec020e7f

Branch: refs/heads/next
Commit: ec020e7f4f2903566d1a1907f545241f9dc8fef0
Parents: c20111f
Author: Fil Maj <ma...@gmail.com>
Authored: Mon Mar 4 16:06:15 2013 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Mar 4 16:06:15 2013 -0800

----------------------------------------------------------------------
 spec/build.spec.js                      |  199 --------------------------
 spec/metadata/android_parser.spec.js    |   48 +++----
 spec/metadata/blackberry_parser.spec.js |   52 +++----
 spec/metadata/ios_parser.spec.js        |   48 +++----
 spec/platform.spec.js                   |    3 +-
 src/metadata/android_parser.js          |   17 ++-
 src/metadata/blackberry_parser.js       |   13 +-
 src/metadata/ios_parser.js              |   15 +-
 src/platform.js                         |   48 ++----
 9 files changed, 100 insertions(+), 343 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ec020e7f/spec/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/build.spec.js b/spec/build.spec.js
deleted file mode 100644
index 9eeffb5..0000000
--- a/spec/build.spec.js
+++ /dev/null
@@ -1,199 +0,0 @@
-/**
-    Licensed to the Apache Software Foundation (ASF) under one
-    or more contributor license agreements.  See the NOTICE file
-    distributed with this work for additional information
-    regarding copyright ownership.  The ASF licenses this file
-    to you under the Apache License, Version 2.0 (the
-    "License"); you may not use this file except in compliance
-    with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-    Unless required by applicable law or agreed to in writing,
-    software distributed under the License is distributed on an
-    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-    KIND, either express or implied.  See the License for the
-    specific language governing permissions and limitations
-    under the License.
-*/
-var cordova = require('../cordova'),
-    et = require('elementtree'),
-    shell = require('shelljs'),
-    path = require('path'),
-    fs = require('fs'),
-    config_parser = require('../src/config_parser'),
-    android_parser = require('../src/metadata/android_parser'),
-    ios_parser = require('../src/metadata/ios_parser'),
-    blackberry_parser = require('../src/metadata/blackberry_parser'),
-    hooker = require('../src/hooker'),
-    fixtures = path.join(__dirname, 'fixtures'),
-    hooks = path.join(fixtures, 'hooks'),
-    tempDir = path.join(__dirname, '..', 'temp'),
-    cordova_project = path.join(fixtures, 'projects', 'cordova'),
-    ios_project_path = path.join(cordova_project, 'platforms', 'ios'),
-    blackberry_project_path = path.join(cordova_project, 'platforms', 'blackberry'),
-    www_config = path.join(cordova_project, 'www', 'config.xml');
-
-
-
-var cwd = process.cwd();
-
-describe('build command', function() {
-    beforeEach(function() {
-        shell.rm('-rf', tempDir);
-        shell.mkdir('-p', tempDir);
-    });
-
-    it('should not run inside a Cordova-based project with no added platforms', function() {
-        this.after(function() {
-            process.chdir(cwd);
-        });
-
-        cordova.create(tempDir);
-        process.chdir(tempDir);
-        expect(function() {
-            cordova.build();
-        }).toThrow();
-    });
-    
-    it('should run inside a Cordova-based project with at least one added platform', function() {
-        // move platform project fixtures over to fake cordova into thinking platforms were added
-        // TODO: possibly add this to helper?
-        shell.mv('-f', path.join(cordova_project, 'platforms', 'blackberry'), path.join(tempDir));
-        shell.mv('-f', path.join(cordova_project, 'platforms', 'ios'), path.join(tempDir));
-        this.after(function() {
-            process.chdir(cwd);
-            shell.mv('-f', path.join(tempDir, 'blackberry'), path.join(cordova_project, 'platforms', 'blackberry'));
-            shell.mv('-f', path.join(tempDir, 'ios'), path.join(cordova_project, 'platforms', 'ios'));
-        });
-
-        process.chdir(cordova_project);
-
-        var prepare_spy = spyOn(cordova, 'prepare');
-        var compile_spy = spyOn(cordova, 'compile');
-        expect(function() {
-            cordova.build();
-            var prep_cb = prepare_spy.mostRecentCall.args[0];
-            prep_cb();
-            expect(prepare_spy).toHaveBeenCalled();
-            expect(compile_spy).toHaveBeenCalled();
-        }).not.toThrow();
-    });
-    it('should not run outside of a Cordova-based project', function() {
-        this.after(function() {
-            process.chdir(cwd);
-        });
-
-        shell.mkdir('-p', tempDir);
-        process.chdir(tempDir);
-
-        expect(function() {
-            cordova.build();
-        }).toThrow();
-    });
-
-    describe('hooks', function() {
-        var s, p, c;
-        beforeEach(function() {
-            s = spyOn(hooker.prototype, 'fire').andReturn(true);
-            p = spyOn(cordova, 'prepare');
-            c = spyOn(cordova, 'compile');
-        });
-
-        describe('when platforms are added', function() {
-            beforeEach(function() {
-                shell.mv('-f', path.join(cordova_project, 'platforms', 'blackberry'), path.join(tempDir));
-                shell.mv('-f', path.join(cordova_project, 'platforms', 'ios'), path.join(tempDir));
-                process.chdir(cordova_project);
-            });
-            afterEach(function() {
-                shell.mv('-f', path.join(tempDir, 'blackberry'), path.join(cordova_project, 'platforms', 'blackberry'));
-                shell.mv('-f', path.join(tempDir, 'ios'), path.join(cordova_project, 'platforms', 'ios'));
-                process.chdir(cwd);
-            });
-
-            it('should fire before hooks through the hooker module', function() {
-                cordova.build();
-                expect(s).toHaveBeenCalledWith('before_build');
-            });
-            it('should fire after hooks through the hooker module', function() {
-                cordova.build();
-                p.mostRecentCall.args[0](); // prep cb
-                c.mostRecentCall.args[0](); // compile cb
-                expect(s).toHaveBeenCalledWith('after_build');
-            });
-        });
-
-        describe('with no platforms added', function() {
-            beforeEach(function() {
-                cordova.create(tempDir);
-                process.chdir(tempDir);
-            });
-            afterEach(function() {
-                process.chdir(cwd);
-            });
-            it('should not fire the hooker', function() {
-                expect(function() {
-                    cordova.build();
-                }).toThrow();
-                expect(s).not.toHaveBeenCalledWith('before_build');
-                expect(s).not.toHaveBeenCalledWith('after_build');
-            });
-        });
-
-    });
-
-    describe('merges', function() {
-        describe('per platform', function() {
-            beforeEach(function() {
-                process.chdir(cordova_project);
-            });
-
-            afterEach(function() {
-                process.chdir(cwd);
-            });
-
-            describe('Android', function() {
-                it('should call android_parser\'s update_overrides', function() {
-                    spyOn(require('shelljs'), 'exec').andReturn({code:0});
-                    var s = spyOn(android_parser.prototype, 'update_overrides');
-
-                    cordova.build('android');
-                    expect(s).toHaveBeenCalled();
-                });
-
-            });
-
-            describe('iOS', function() {
-                it('should call ios_parser\'s update_overrides', function(done) {
-                    var parser = new ios_parser(ios_project_path);
-                    var config = new config_parser(www_config);
-
-                    var s = spyOn(parser, 'update_overrides');
-                    parser.update_project(config, function() {
-                        expect(s).toHaveBeenCalled();
-                        done();
-                    });
-                });
-
-            });
-
-            describe('BlackBerry', function() {
-                it('should call blackberry_parser\'s update_overrides', function(done) {
-                    var parser = new blackberry_parser(blackberry_project_path);
-                    var config = new config_parser(www_config);
-
-                    var s = spyOn(parser, 'update_overrides');
-                    parser.update_project(config, function() {
-                        expect(s).toHaveBeenCalled();
-                        done();
-                    });
-                });
-
-            });
-
-
-        });
-    });
-
-});

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ec020e7f/spec/metadata/android_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/android_parser.spec.js b/spec/metadata/android_parser.spec.js
index 0f965e7..d051c6f 100644
--- a/spec/metadata/android_parser.spec.js
+++ b/spec/metadata/android_parser.spec.js
@@ -170,51 +170,32 @@ describe('android project parser', function() {
                 parser.update_www();
                 expect(fs.readFileSync(path.join(android_project_path, 'assets', 'www', 'cordova.js'),'utf-8')).toBe(fs.readFileSync(path.join(util.libDirectory, 'cordova-android', 'framework', 'assets', 'js', 'cordova.android.js'), 'utf-8'));
             });
-            it('should call out to util.deleteSvnFolders', function() {
-                var spy = spyOn(util, 'deleteSvnFolders');
-                parser.update_www();
-                expect(spy).toHaveBeenCalled();
-            });
         });
 
         describe('update_overrides method',function() {
-
-            it('should copy a new file from merges into www', function() {
-
-                var newFile = path.join(project_path, 'merges','android', 'merge.js');
-
-                this.after(function() {
-                    shell.rm('-rf', path.join(project_path, 'merges','android','merge.js'));
-                });
-
+            var mergesPath = path.join(project_path, 'merges', 'android');
+            var newFile = path.join(mergesPath, 'merge.js');
+            beforeEach(function() {
+                shell.mkdir('-p', mergesPath);
                 fs.writeFileSync(newFile, 'alert("sup");', 'utf-8');
+            });
+            afterEach(function() {
+                shell.rm('-rf', mergesPath);
+            });
+            it('should copy a new file from merges into www', function() {
                 parser.update_overrides();
                 expect(fs.existsSync(path.join(android_project_path, 'assets', 'www', 'merge.js'))).toBe(true);
             });
 
             it('should copy a file from merges over a file in www', function() {
-
-                var newFile = path.join(project_path, 'merges','android', 'merge.js');
                 var newFileWWW = path.join(project_path, 'www','merge.js');
-
+                fs.writeFileSync(newFileWWW, 'var foo=1;', 'utf-8');
                 this.after(function() {
-                    shell.rm('-rf', path.join(project_path, 'merges','android','merge.js'));
-                    shell.rm('-rf',path.join(project_path,'www','merge.js'));
+                    shell.rm('-rf', newFileWWW);
                 });
-
-                fs.writeFileSync(newFile, 'var foo=2;', 'utf-8');
-                fs.writeFileSync(newFileWWW, 'var foo=1;', 'utf-8');
                 parser.update_overrides();
                 expect(fs.existsSync(path.join(android_project_path, 'assets', 'www', 'merge.js'))).toBe(true);
-                console.log(fs.readFileSync(path.join(android_project_path, 'assets', 'www', 'merge.js')));
-                expect(fs.readFileSync(path.join(android_project_path, 'assets', 'www', 'merge.js'),'utf-8')).toEqual('var foo=2;');
-            });
-
-
-            it('should call out to util.deleteSvnFolders', function() {
-                var spy = spyOn(util, 'deleteSvnFolders');
-                parser.update_overrides();
-                expect(spy).toHaveBeenCalled();
+                expect(fs.readFileSync(path.join(android_project_path, 'assets', 'www', 'merge.js'),'utf-8')).toEqual('alert("sup");');
             });
         });
 
@@ -229,6 +210,11 @@ describe('android project parser', function() {
                 parser.update_project(config);
                 expect(spyConfig).toHaveBeenCalled();
             });
+            it('should call out to util.deleteSvnFolders', function() {
+                var spy = spyOn(util, 'deleteSvnFolders');
+                parser.update_project(config);
+                expect(spy).toHaveBeenCalled();
+            });
         });
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ec020e7f/spec/metadata/blackberry_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/blackberry_parser.spec.js b/spec/metadata/blackberry_parser.spec.js
index 21eb826..3336b59 100644
--- a/spec/metadata/blackberry_parser.spec.js
+++ b/spec/metadata/blackberry_parser.spec.js
@@ -138,54 +138,36 @@ describe('blackberry project parser', function() {
                 var bb_cfg = fs.readFileSync(blackberry_config, 'utf-8');
                 expect(bb_cfg).not.toBe(www_cfg);
             });
-            it('should call out to util.deleteSvnFolders', function() {
-                var spy = spyOn(util, 'deleteSvnFolders');
-                parser.update_www();
-                expect(spy).toHaveBeenCalled();
-            });
         });
 
         describe('update_overrides method',function() {
+            var mergesPath = path.join(project_path, 'merges', 'blackberry');
+            var newFile = path.join(mergesPath, 'merge.js');
+            beforeEach(function() {
+                shell.mkdir('-p', mergesPath);
+                fs.writeFileSync(newFile, 'alert("sup");', 'utf-8');
+            });
+            afterEach(function() {
+                shell.rm('-rf', mergesPath);
+            });
 
             it('should copy a new file from merges into www', function() {
-
-                var newFile = path.join(project_path, 'merges','blackberry', 'merge.js');
-
-                this.after(function() {
-                    shell.rm('-rf', path.join(project_path, 'merges','blackberry','merge.js'));
-                });
-
-                fs.writeFileSync(newFile, 'alert("sup");', 'utf-8');
                 parser.update_overrides();
                 expect(fs.existsSync(path.join(blackberry_project_path, 'www', 'merge.js'))).toBe(true);
             });
 
             it('should copy a file from merges over a file in www', function() {
-
-                var newFile = path.join(project_path, 'merges','blackberry', 'merge.js');
                 var newFileWWW = path.join(project_path, 'www','merge.js');
-
+                fs.writeFileSync(newFileWWW, 'var foo=1;', 'utf-8');
                 this.after(function() {
-                    shell.rm('-rf', path.join(project_path, 'merges','blackberry','merge.js'));
-                    shell.rm('-rf',path.join(project_path,'www','merge.js'));
+                    shell.rm('-rf', newFileWWW);
                 });
-
-                fs.writeFileSync(newFile, 'var foo=2;', 'utf-8');
-                fs.writeFileSync(newFileWWW, 'var foo=1;', 'utf-8');
                 parser.update_overrides();
                 expect(fs.existsSync(path.join(blackberry_project_path, 'www', 'merge.js'))).toBe(true);
-                expect(fs.readFileSync(path.join(blackberry_project_path, 'www', 'merge.js'),'utf-8')).toEqual('var foo=2;');
-            });
-
-
-            it('should call out to util.deleteSvnFolders', function() {
-                var spy = spyOn(util, 'deleteSvnFolders');
-                parser.update_overrides();
-                expect(spy).toHaveBeenCalled();
+                expect(fs.readFileSync(path.join(blackberry_project_path, 'www', 'merge.js'),'utf-8')).toEqual('alert("sup");');
             });
         });
 
-
         describe('update_project method', function() {
             var cordova_config_path = path.join(project_path, '.cordova', 'config.json');
             var original_config_json = fs.readFileSync(cordova_config_path, 'utf-8');
@@ -217,10 +199,18 @@ describe('blackberry project parser', function() {
                     parser.update_project(config);
                     expect(spyEnv).not.toHaveBeenCalled();
                 });
-                it('should write out project properties', function() {
+                it('should write out project properties', function(done) {
                     var spyProps = spyOn(parser, 'write_project_properties');
                     parser.update_project(config, function() { 
                         expect(spyProps).toHaveBeenCalled();
+                        done();
+                    });
+                });
+                it('should call out to util.deleteSvnFolders', function(done) {
+                    var spy = spyOn(util, 'deleteSvnFolders');
+                    parser.update_project(config, function() {
+                        expect(spy).toHaveBeenCalled();
+                        done();
                     });
                 });
             });

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ec020e7f/spec/metadata/ios_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/ios_parser.spec.js b/spec/metadata/ios_parser.spec.js
index de62b1c..dbd4816 100644
--- a/spec/metadata/ios_parser.spec.js
+++ b/spec/metadata/ios_parser.spec.js
@@ -159,51 +159,35 @@ describe('ios project parser', function () {
                 parser.update_www();
                 expect(fs.readFileSync(path.join(ios_project_path, 'www', 'cordova.js'), 'utf-8')).toBe(fs.readFileSync(path.join(util.libDirectory, 'cordova-ios', 'CordovaLib', 'cordova.ios.js'), 'utf-8'));
             });
-            it('should call out to util.deleteSvnFolders', function () {
-                var spy = spyOn(util, 'deleteSvnFolders');
-                parser.update_www();
-                expect(spy).toHaveBeenCalled();
-            });
         });
 
         describe('update_overrides method', function () {
+            var mergesPath = path.join(project_path, 'merges', 'ios');
+            var newFile = path.join(mergesPath, 'merge.js');
+            beforeEach(function() {
+                shell.mkdir('-p', mergesPath);
+                fs.writeFileSync(newFile, 'alert("sup");', 'utf-8');
+            });
+            afterEach(function() {
+                shell.rm('-rf', mergesPath);
+            });
 
             it('should copy a new file from merges into www', function () {
-
-                var newFile = path.join(project_path, 'merges', 'ios', 'merge.js');
-
-                this.after(function () {
-                    shell.rm('-rf', path.join(project_path, 'merges','ios','merge.js'));
-                });
-
-                fs.writeFileSync(newFile, 'alert("sup");', 'utf-8');
                 parser.update_overrides();
                 expect(fs.existsSync(path.join(ios_project_path, 'www', 'merge.js'))).toBe(true);
             });
 
             it('should copy a file from merges over a file in www', function () {
-
-                var newFile = path.join(project_path, 'merges', 'ios', 'merge.js');
                 var newFileWWW = path.join(project_path, 'www', 'merge.js');
-
+                fs.writeFileSync(newFileWWW, 'var foo=1;', 'utf-8');
                 this.after(function () {
-                    shell.rm('-rf', path.join(project_path, 'merges','ios','merge.js'));
-                    shell.rm('-rf', path.join(project_path, 'www', 'merge.js'));
+                    shell.rm('-rf', newFileWWW);
                 });
 
-                fs.writeFileSync(newFile, 'var foo=2;', 'utf-8');
-                fs.writeFileSync(newFileWWW, 'var foo=1;', 'utf-8');
                 parser.update_overrides();
                 expect(fs.existsSync(path.join(ios_project_path, 'www', 'merge.js'))).toBe(true);
-                expect(fs.readFileSync(path.join(ios_project_path, 'www', 'merge.js'), 'utf-8')).toEqual('var foo=2;');
+                expect(fs.readFileSync(path.join(ios_project_path, 'www', 'merge.js'), 'utf-8')).toEqual('alert("sup");');
             });
-
-            it('should call out to util.deleteSvnFolders', function() {
-                var spy = spyOn(util, 'deleteSvnFolders');
-                parser.update_overrides();
-                expect(spy).toHaveBeenCalled();
-            });
-
         });
 
         describe('update_project method', function () {
@@ -221,6 +205,14 @@ describe('ios project parser', function () {
                     done();
                 });
             });
+            it('should call out to util.deleteSvnFolders', function(done) {
+                var spy = spyOn(util, 'deleteSvnFolders');
+                var spyConfig = spyOn(parser, 'update_from_config').andCallThrough();
+                parser.update_project(config, function () {
+                    expect(spy).toHaveBeenCalled();
+                    done();
+                });
+            });
         });
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ec020e7f/spec/platform.spec.js
----------------------------------------------------------------------
diff --git a/spec/platform.spec.js b/spec/platform.spec.js
index c49a53c..b8dedec 100644
--- a/spec/platform.spec.js
+++ b/spec/platform.spec.js
@@ -267,10 +267,11 @@ describe('platform command', function() {
                 cr = spyOn(android_parser, 'check_requirements');
             });
             it('should fire before and after hooks through the hooker module', function() {
-                spyOn(android_parser.prototype, 'update_project');
+                var ap = spyOn(android_parser.prototype, 'update_project');
                 cordova.platform('add', 'android');
                 fake_reqs_check();
                 fake_create(path.join(tempDir, 'platforms', 'android'));
+                ap.mostRecentCall.args[1](); // fake out update_project
                 expect(s).toHaveBeenCalledWith('before_platform_add');
                 expect(s).toHaveBeenCalledWith('after_platform_add');
             });

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ec020e7f/src/metadata/android_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/android_parser.js b/src/metadata/android_parser.js
index c36491a..3dfaf22 100644
--- a/src/metadata/android_parser.js
+++ b/src/metadata/android_parser.js
@@ -131,30 +131,33 @@ module.exports.prototype = {
         var www = path.join(projectRoot, 'www');
         var platformWww = path.join(this.path, 'assets');
         // remove stock platform assets
-        shell.rm('-rf', path.join(platformWww, 'www'));
+        shell.rm('-rf', this.www_dir());
         // copy over all app www assets
         shell.cp('-rf', www, platformWww);
-        platformWww = path.join(platformWww, 'www');
 
         // write out android lib's cordova.js
         var jsPath = path.join(util.libDirectory, 'cordova-android', 'framework', 'assets', 'js', 'cordova.android.js');
-        fs.writeFileSync(path.join(platformWww, 'cordova.js'), fs.readFileSync(jsPath, 'utf-8'), 'utf-8');
+        fs.writeFileSync(path.join(this.www_dir(), 'cordova.js'), fs.readFileSync(jsPath, 'utf-8'), 'utf-8');
 
-        // delete any .svn folders copied over
-        util.deleteSvnFolders(platformWww);
     },
 
     // update the overrides folder into the www folder
     update_overrides:function() {
         var projectRoot = util.isCordova(this.path);
-        var overrides = path.join(projectRoot, 'merges','android','*');
-        shell.cp('-rf', overrides, this.www_dir());
+        var merges_path = path.join(projectRoot, 'merges', 'android');
+        if (fs.existsSync(merges_path)) {
+            var overrides = path.join(merges_path, '*');
+            shell.cp('-rf', overrides, this.www_dir());
+        }
     },
 
     update_project:function(cfg, callback) {
+        var platformWww = path.join(this.path, 'assets');
         this.update_from_config(cfg);
         this.update_www();
         this.update_overrides();
+        // delete any .svn folders copied over
+        util.deleteSvnFolders(platformWww);
         if (callback) callback();
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ec020e7f/src/metadata/blackberry_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/blackberry_parser.js b/src/metadata/blackberry_parser.js
index cacc260..ae1742c 100644
--- a/src/metadata/blackberry_parser.js
+++ b/src/metadata/blackberry_parser.js
@@ -64,6 +64,7 @@ module.exports.prototype = {
         self.update_from_config(cfg);
         self.update_www();
         self.update_overrides();
+        util.deleteSvnFolders(this.www_dir());
 
         // Do we have BB config?
         var projectRoot = util.isCordova(this.path);
@@ -91,7 +92,7 @@ module.exports.prototype = {
     update_www:function() {
         var projectRoot = util.isCordova(this.path);
         var www = path.join(projectRoot, 'www');
-        var platformWww = path.join(this.path, 'www');
+        var platformWww = this.www_dir();
 
         var finalWww = path.join(this.path, 'finalwww');
         shell.mkdir('-p', finalWww);
@@ -120,16 +121,16 @@ module.exports.prototype = {
         shell.rm('-rf', platformWww);
         shell.mv(finalWww, platformWww);
 
-        util.deleteSvnFolders(platformWww);
     },
 
     // update the overrides folder into the www folder
     update_overrides:function() {
         var projectRoot = util.isCordova(this.path);
-        var platformWww = path.join(this.path, 'www');
-        var overrides = path.join(projectRoot, 'merges','blackberry');
-        shell.cp('-rf', overrides+'/*',platformWww);
-        util.deleteSvnFolders(platformWww);
+        var merges_path = path.join(projectRoot, 'merges', 'blackberry');
+        if (fs.existsSync(merges_path)) {
+            var overrides = path.join(merges_path, '*');
+            shell.cp('-rf', overrides, this.www_dir());
+        }
     },
 
     write_project_properties:function() {

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ec020e7f/src/metadata/ios_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/ios_parser.js b/src/metadata/ios_parser.js
index 9cf4450..ee235dc 100644
--- a/src/metadata/ios_parser.js
+++ b/src/metadata/ios_parser.js
@@ -140,7 +140,7 @@ module.exports.prototype = {
     update_www:function() {
         var projectRoot = util.isCordova(this.path);
         var www = path.join(projectRoot, 'www');
-        var project_www = path.join(this.path, 'www');
+        var project_www = this.www_dir();
 
         // remove the stock www folder
         shell.rm('-rf', project_www);
@@ -151,18 +151,16 @@ module.exports.prototype = {
         // write out proper cordova.js
         shell.cp('-f', path.join(util.libDirectory, 'cordova-ios', 'CordovaLib', 'cordova.ios.js'), path.join(project_www, 'cordova.js'));
 
-        util.deleteSvnFolders(project_www);
     },
 
     // update the overrides folder into the www folder
     update_overrides:function() {
         var projectRoot = util.isCordova(this.path);
-        var project_www = path.join(this.path, 'www');
-        var overrides = path.join(projectRoot, 'merges','ios');
-        shell.cp('-rf', overrides+'/*',project_www);
-
-        util.deleteSvnFolders(project_www);
-
+        var merges_path = path.join(projectRoot, 'merges', 'ios');
+        if (fs.existsSync(merges_path)) {
+            var overrides = path.join(merges_path, '*');
+            shell.cp('-rf', overrides, this.www_dir());
+        }
     },
 
     update_project:function(cfg, callback) {
@@ -170,6 +168,7 @@ module.exports.prototype = {
         this.update_from_config(cfg, function() {
             self.update_www();
             self.update_overrides();
+            util.deleteSvnFolders(self.www_dir());
             if (callback) callback();
         });
     }

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ec020e7f/src/platform.js
----------------------------------------------------------------------
diff --git a/src/platform.js b/src/platform.js
index 604561d..966a76f 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -28,6 +28,12 @@ var config_parser     = require('./config_parser'),
     blackberry_parser = require('./metadata/blackberry_parser'),
     shell             = require('shelljs');
 
+var parsers = {
+    "android":android_parser,
+    "ios":ios_parser,
+    "blackberry":blackberry_parser
+};
+
 module.exports = function platform(command, targets, callback) {
     var projectRoot = cordova_util.isCordova(process.cwd());
 
@@ -38,8 +44,8 @@ module.exports = function platform(command, targets, callback) {
     var hooks = new hooker(projectRoot),
         end;
 
-    var createOverrides = function(target){
-        shell.mkdir('-p', path.join('merges',target));
+    var createOverrides = function(target) {
+        shell.mkdir('-p', path.join(projectRoot, 'merges', target));
     };
 
     if (arguments.length === 0) command = 'ls';
@@ -91,34 +97,12 @@ module.exports = function platform(command, targets, callback) {
                                 throw new Error('An error occured during creation of ' + target + ' sub-project. ' + create_output);
                             }
 
-                            switch(target) {
-                                case 'android':
-                                    var android = new android_parser(output);
-                                    createOverrides(target);
-
-                                    android.update_project(cfg);
-                                    hooks.fire('after_platform_add');
-                                    end();
-                                    break;
-                                case 'ios':
-                                    var ios = new ios_parser(output);
-                                    createOverrides(target);
-
-                                    ios.update_project(cfg, function() {
-                                        hooks.fire('after_platform_add');
-                                        end();
-                                    });
-                                    break;
-                                case 'blackberry':
-                                    var bb = new blackberry_parser(output);
-                                    createOverrides(target);
-
-                                    bb.update_project(cfg, function() {
-                                        hooks.fire('after_platform_add');
-                                        end();
-                                    });
-                                    break;
-                            }
+                            var parser = new parsers[target](output);
+                            parser.update_project(cfg, function() {
+                                createOverrides(target);
+                                hooks.fire('after_platform_add');
+                                end();
+                            });
                         });
                     }
                 });
@@ -129,11 +113,11 @@ module.exports = function platform(command, targets, callback) {
             targets.forEach(function(target) {
                 hooks.fire('before_platform_rm');
                 shell.rm('-rf', path.join(projectRoot, 'platforms', target));
-                shell.rm('-rf', path.join(projectRoot,'merges',target));
+                shell.rm('-rf', path.join(projectRoot, 'merges', target));
                 hooks.fire('after_platform_rm');
             });
             break;
         default:
-            throw ('Unrecognized command "' + command + '". Use either `add`, `remove`, or `list`.');
+            throw new Error('Unrecognized command "' + command + '". Use either `add`, `remove`, or `list`.');
     }
 };


[07/14] git commit: Revert "Revert "added merges to base cli documentation""

Posted by gt...@apache.org.
Revert "Revert "added merges to base cli documentation""

This reverts commit e2158347fa41ccf7ae0538ab7a1705df5d2b953f.


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/c20111f0
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/c20111f0
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/c20111f0

Branch: refs/heads/next
Commit: c20111f059770d8a8d95aa02ede1ea370c9a9a2a
Parents: 6dd5410
Author: michael.wolf <mi...@MWolf-MBP.local>
Authored: Sat Mar 2 13:13:57 2013 -0500
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Mar 4 10:47:31 2013 -0800

----------------------------------------------------------------------
 .gitignore |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/c20111f0/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 1228061..3abe651 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,3 +6,8 @@ spec/fixtures/projects/native
 spec/fixtures/projects/cordova
 lib/cordova-android/framework/bin
 lib/cordova-android/framework/gen
+.idea/*
+spec/fixtures/*
+.gitcore
+*.jar
+lib/*


[13/14] git commit: Added prototype ripple support to command line.

Posted by gt...@apache.org.
Added prototype ripple support to command line.

This will allow:

    cordova ripple ios

which will serve up the app's www folder and then wrap ripple around
it and launch a browser.


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/cf499d00
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/cf499d00
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/cf499d00

Branch: refs/heads/next
Commit: cf499d000053b3e6f6631513fd5110c0861f8f01
Parents: 7c0d009
Author: Gord Tanner <gt...@gmail.com>
Authored: Thu Mar 7 11:56:18 2013 -0500
Committer: Gord Tanner <gt...@gmail.com>
Committed: Thu Mar 7 11:56:18 2013 -0500

----------------------------------------------------------------------
 bootstrap.js  |    5 +++++
 cordova.js    |    1 +
 doc/help.txt  |    2 ++
 package.json  |    3 ++-
 src/ripple.js |   33 +++++++++++++++++++++++++++++++++
 5 files changed, 43 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cf499d00/bootstrap.js
----------------------------------------------------------------------
diff --git a/bootstrap.js b/bootstrap.js
index e45a5f9..ca4d964 100644
--- a/bootstrap.js
+++ b/bootstrap.js
@@ -111,3 +111,8 @@ platforms.forEach(function(platform) {
     });
 });
 
+// HACK: Install and configure ripple
+// Ripple will soon be in npm, this is a workaround until that happens
+shell.exec("git clone https://github.com/blackberry/Ripple-UI/ node_modules/ripple", {silent:false});
+shell.cd("node_modules/ripple");
+shell.exec("./configure && jake", {silent: false});

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cf499d00/cordova.js
----------------------------------------------------------------------
diff --git a/cordova.js b/cordova.js
index 5840854..b8f5328 100755
--- a/cordova.js
+++ b/cordova.js
@@ -36,6 +36,7 @@ module.exports = {
     plugin:    require('./src/plugin'),
     plugins:   require('./src/plugin'),
     serve:     require('./src/serve'),
+    ripple:    require('./src/ripple'),
     on:        function() {
         cordova_events.on.apply(cordova_events, arguments);
     },

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cf499d00/doc/help.txt
----------------------------------------------------------------------
diff --git a/doc/help.txt b/doc/help.txt
index 28d74a9..937b7f5 100644
--- a/doc/help.txt
+++ b/doc/help.txt
@@ -19,6 +19,8 @@ Project-Level Commands
     serve <platform> [port] ........... runs a local web server for the www/ directory of the given platform
                                         the default port is 8000
                                         note that you must edit the native code to point at the server!
+    ripple <platform> [port] .......... uses the serve command as a base and then wraps the server
+                                        with ripple to test your app in your desktop browser.
     help .............................. shows this!
 
 Example usage

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cf499d00/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index bab301c..9a983cf 100644
--- a/package.json
+++ b/package.json
@@ -31,7 +31,8 @@
     "ncallbacks":"1.0.0",
     "request":"2.11.4",
     "semver":"1.1.0",
-    "prompt":"0.2.7"
+    "prompt":"0.2.7",
+    "open": "0.0.*"
   },
   "devDependencies": {
     "jasmine-node":"1.1.x"

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/cf499d00/src/ripple.js
----------------------------------------------------------------------
diff --git a/src/ripple.js b/src/ripple.js
new file mode 100644
index 0000000..2d4ee19
--- /dev/null
+++ b/src/ripple.js
@@ -0,0 +1,33 @@
+
+/**
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+*/
+var serve = require('./serve'),
+    ripple = require('ripple'),
+    open = require('open');
+
+module.exports = function (platform, port) {
+    port = port || 8000;
+    var server = serve(platform, port);
+
+    ripple.emulate.start({
+        remote: 'http://localhost:' + port
+    });
+
+    open('http://localhost:4400?enableripple=cordova-2.0.0');
+};


[14/14] git commit: Tighter Ripple Ingeration

Posted by gt...@apache.org.
Tighter Ripple Ingeration

- will now only start up one node server
- refactored serve to extract config to boot up ripple server
- ripple will be installed via npm!!11!!!one!!


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/a17c2056
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/a17c2056
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/a17c2056

Branch: refs/heads/next
Commit: a17c205689e1d6c2a4b891c3cc080317c719562b
Parents: cf499d0
Author: Gord Tanner <gt...@gmail.com>
Authored: Fri Mar 22 17:20:27 2013 -0400
Committer: Gord Tanner <gt...@gmail.com>
Committed: Fri Mar 22 17:20:27 2013 -0400

----------------------------------------------------------------------
 bootstrap.js  |    6 -----
 package.json  |    3 +-
 src/ripple.js |   32 +++++++++++++++++++++++-----
 src/serve.js  |   57 ++++++++++++++++++++++++---------------------------
 4 files changed, 55 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/a17c2056/bootstrap.js
----------------------------------------------------------------------
diff --git a/bootstrap.js b/bootstrap.js
index ca4d964..6eca53f 100644
--- a/bootstrap.js
+++ b/bootstrap.js
@@ -110,9 +110,3 @@ platforms.forEach(function(platform) {
         }
     });
 });
-
-// HACK: Install and configure ripple
-// Ripple will soon be in npm, this is a workaround until that happens
-shell.exec("git clone https://github.com/blackberry/Ripple-UI/ node_modules/ripple", {silent:false});
-shell.cd("node_modules/ripple");
-shell.exec("./configure && jake", {silent: false});

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/a17c2056/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 9a983cf..27fdba3 100644
--- a/package.json
+++ b/package.json
@@ -32,7 +32,8 @@
     "request":"2.11.4",
     "semver":"1.1.0",
     "prompt":"0.2.7",
-    "open": "0.0.*"
+    "ripple-emulator":">=0.9.15",
+    "open": "0.0.3"
   },
   "devDependencies": {
     "jasmine-node":"1.1.x"

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/a17c2056/src/ripple.js
----------------------------------------------------------------------
diff --git a/src/ripple.js b/src/ripple.js
index 2d4ee19..ddbf297 100644
--- a/src/ripple.js
+++ b/src/ripple.js
@@ -18,16 +18,36 @@
     under the License.
 */
 var serve = require('./serve'),
-    ripple = require('ripple'),
+    ripple = require('ripple-emulator'),
     open = require('open');
 
 module.exports = function (platform, port) {
     port = port || 8000;
-    var server = serve(platform, port);
 
-    ripple.emulate.start({
-        remote: 'http://localhost:' + port
-    });
+    serve.config(platform, port, function (cfg) {
+        ripple.emulate.start({
+            path: cfg.paths,
+            port: port
+        });
+
+        var device;
 
-    open('http://localhost:4400?enableripple=cordova-2.0.0');
+        switch (platform) {
+        case "blackberry":
+            device = "Z10";
+            break;
+        case "ios":
+            device = "IPhone5";
+            break;
+        case "android":
+            device = "NexusS";
+            break;
+        default:
+            device = "XVGA";
+            break;
+        }
+
+        var uri = "http://localhost:" + port + "?enableripple=cordova-2.0.0-" + device;
+        open(uri);
+    });
 };

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/a17c2056/src/serve.js
----------------------------------------------------------------------
diff --git a/src/serve.js b/src/serve.js
index b15f907..ba23e7f 100644
--- a/src/serve.js
+++ b/src/serve.js
@@ -79,6 +79,17 @@ function launch_server(www, platform_www, port) {
 }
 
 module.exports = function serve (platform, port) {
+    var returnValue = {};
+
+    module.exports.config(platform, port, function (config) {
+        returnValue.server = launch_server(config.paths[0], config.paths[1], port);
+    });
+
+    // Hack for testing despite its async nature.
+    return returnValue;
+};
+
+module.exports.config = function (platform, port, callback) {
     var projectRoot = cordova_util.isCordova(process.cwd());
 
     if (!projectRoot) {
@@ -100,46 +111,32 @@ module.exports = function serve (platform, port) {
 
     // If we got to this point, the given platform is valid.
 
-    // Default port is 8000 if not given. This is also the default of the Python module.
-    port = port || 8000;
+    var result = {
+        paths: [],
+        // Default port is 8000 if not given. This is also the default of the Python module.
+        port: port || 8000
+    };
 
     // Top-level www directory.
-    var www = projectRoot + path.sep + 'www';
+    result.paths.push(projectRoot + path.sep + 'www');
 
-    var parser, platformPath;
+    var parser;
 
-    // Hack for testing despite its async nature.
-    var returnValue = {};
     switch (platform) {
         case 'android':
-            platformPath = path.join(projectRoot, 'platforms', 'android');
-            parser = new android_parser(platformPath);
-
-            // Update the related platform project from the config
-            parser.update_project(cfg);
-            var platform_www = parser.www_dir();
-            returnValue.server = launch_server(www, platform_www, port);
+            parser = new android_parser(path.join(projectRoot, 'platforms', platform));
             break;
         case 'blackberry-10':
-            platformPath = path.join(projectRoot, 'platforms', 'blackberry-10');
-            parser = new blackberry_parser(platformPath);
-
-            // Update the related platform project from the config
-            parser.update_project(cfg, function() {
-                // Shell it
-                returnValue.server = launch_server(www, parser.www_dir(), port);
-            });
+            parser = new blackberry_parser(path.join(projectRoot, 'platforms', platform));
             break;
         case 'ios':
-            platformPath = path.join(projectRoot, 'platforms', 'ios');
-            js = path.join(__dirname, '..', 'lib', 'ios', 'CordovaLib', 'javascript', 'cordova.ios.js');
-            parser = new ios_parser(platformPath);
-            // Update the related platform project from the config
-            parser.update_project(cfg, function() {
-                returnValue.server = launch_server(www, parser.www_dir(), port);
-            });
+            parser = new ios_parser(path.join(projectRoot, 'platforms', platform));
             break;
     }
-    return returnValue;
-};
 
+    // Update the related platform project from the config
+    parser.update_project(cfg, function() {
+        result.paths.push(parser.www_dir());
+        callback(result);
+    });
+}


[09/14] git commit: added merges to base cli documentation

Posted by gt...@apache.org.
added merges to base cli documentation

- added merges to file structure in readme.md
- added section for merges in file structure section


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/a94d2905
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/a94d2905
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/a94d2905

Branch: refs/heads/next
Commit: a94d290581a6f83e7166a14df37da40301514d18
Parents: 51f1cc3
Author: michael.wolf <mi...@MWolf-MBP.local>
Authored: Sat Mar 2 13:07:26 2013 -0500
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Mar 4 10:47:31 2013 -0800

----------------------------------------------------------------------
 README.md |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/a94d2905/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index b7dff50..25c3f31 100644
--- a/README.md
+++ b/README.md
@@ -52,6 +52,7 @@ directory structure:
 
     myApp/
     |-.cordova/
+    |- merges/
     |- platforms/
     |- plugins/
     `- www/
@@ -61,6 +62,9 @@ This directory identifies a tree as a cordova project. Simple configuration info
 
 Commands other than `create` operate against the project directory itself, rather than the current directory - a search up the current directory's parents is made to find the project directory. Thus, any command (other than `create`) can be used from any subdirectory whose parent is a cordova project directory (same as git).
 
+## merges/
+Platform specific web artifacts, such as .html, .css and .js files which is deployed on build to the appropriate native directory.  Files placed in merges will override matching files in www for a specific platform.
+
 ## platforms/
 Platforms added to your application will have the native
  application project structures laid out within this directory.
@@ -111,6 +115,9 @@ The directory structure of KewlApp now looks like this:
 
     KewlApp/
     |- .cordova/
+    |- mergess/
+       |- android/
+       `- ios/
     |- platforms/
        |- android/
        |  `- …


[04/14] git commit: shifted the update_overrides method out of build and into the parsers

Posted by gt...@apache.org.
shifted the update_overrides method out of build and into the parsers

- per Filip's feedback shfted the update_overrides() into
update_project and out of build.js
- added util.deleteSvnFolders to update_overrides()


Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/293ec627
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/293ec627
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/293ec627

Branch: refs/heads/next
Commit: 293ec627ce7b009953d54003093325dd4896cce6
Parents: b7bd89a
Author: michael.wolf <mi...@MWolf-MBP.local>
Authored: Tue Feb 12 22:24:25 2013 -0500
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Mar 4 10:46:46 2013 -0800

----------------------------------------------------------------------
 src/metadata/android_parser.js    |    2 +-
 src/metadata/blackberry_parser.js |    7 +++++--
 src/metadata/ios_parser.js        |    4 ++++
 src/platform.js                   |    9 ++++++---
 4 files changed, 16 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/293ec627/src/metadata/android_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/android_parser.js b/src/metadata/android_parser.js
index e83bb82..c36491a 100644
--- a/src/metadata/android_parser.js
+++ b/src/metadata/android_parser.js
@@ -1,4 +1,3 @@
-
 /**
     Licensed to the Apache Software Foundation (ASF) under one
     or more contributor license agreements.  See the NOTICE file
@@ -155,6 +154,7 @@ module.exports.prototype = {
     update_project:function(cfg, callback) {
         this.update_from_config(cfg);
         this.update_www();
+        this.update_overrides();
         if (callback) callback();
     }
 };

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/293ec627/src/metadata/blackberry_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/blackberry_parser.js b/src/metadata/blackberry_parser.js
index 91d0f60..cacc260 100644
--- a/src/metadata/blackberry_parser.js
+++ b/src/metadata/blackberry_parser.js
@@ -59,10 +59,12 @@ module.exports.prototype = {
         this.xml.update();
     },
     update_project:function(cfg, callback) {
-        this.update_from_config(cfg);
-        this.update_www();
         var self = this;
 
+        self.update_from_config(cfg);
+        self.update_www();
+        self.update_overrides();
+
         // Do we have BB config?
         var projectRoot = util.isCordova(this.path);
         var dotFile = path.join(projectRoot, '.cordova', 'config.json');
@@ -127,6 +129,7 @@ module.exports.prototype = {
         var platformWww = path.join(this.path, 'www');
         var overrides = path.join(projectRoot, 'merges','blackberry');
         shell.cp('-rf', overrides+'/*',platformWww);
+        util.deleteSvnFolders(platformWww);
     },
 
     write_project_properties:function() {

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/293ec627/src/metadata/ios_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/ios_parser.js b/src/metadata/ios_parser.js
index 03455ed..9cf4450 100644
--- a/src/metadata/ios_parser.js
+++ b/src/metadata/ios_parser.js
@@ -160,12 +160,16 @@ module.exports.prototype = {
         var project_www = path.join(this.path, 'www');
         var overrides = path.join(projectRoot, 'merges','ios');
         shell.cp('-rf', overrides+'/*',project_www);
+
+        util.deleteSvnFolders(project_www);
+
     },
 
     update_project:function(cfg, callback) {
         var self = this;
         this.update_from_config(cfg, function() {
             self.update_www();
+            self.update_overrides();
             if (callback) callback();
         });
     }

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/293ec627/src/platform.js
----------------------------------------------------------------------
diff --git a/src/platform.js b/src/platform.js
index 4705130..604561d 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -94,23 +94,26 @@ module.exports = function platform(command, targets, callback) {
                             switch(target) {
                                 case 'android':
                                     var android = new android_parser(output);
-                                    android.update_project(cfg);
                                     createOverrides(target);
+
+                                    android.update_project(cfg);
                                     hooks.fire('after_platform_add');
                                     end();
                                     break;
                                 case 'ios':
                                     var ios = new ios_parser(output);
+                                    createOverrides(target);
+
                                     ios.update_project(cfg, function() {
-                                        createOverrides(target);
                                         hooks.fire('after_platform_add');
                                         end();
                                     });
                                     break;
                                 case 'blackberry':
                                     var bb = new blackberry_parser(output);
+                                    createOverrides(target);
+
                                     bb.update_project(cfg, function() {
-                                        createOverrides(target);
                                         hooks.fire('after_platform_add');
                                         end();
                                     });