incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject git commit: gitignore and test updates
Date Fri, 27 Jul 2012 00:08:01 GMT
Updated Branches:
  refs/heads/cordova-client ec3e6d895 -> 6568ebd3d


gitignore and test updates


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

Branch: refs/heads/cordova-client
Commit: 6568ebd3d731630a45ef5705a471565ee04ca282
Parents: ec3e6d8
Author: Fil Maj <maj.fil@gmail.com>
Authored: Thu Jul 26 17:11:18 2012 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Thu Jul 26 17:11:18 2012 -0700

----------------------------------------------------------------------
 .gitignore            |    3 +++
 README.md             |    3 +++
 spec/build.spec.js    |    4 ++++
 spec/create.spec.js   |    6 ------
 spec/helper.js        |   23 +++++++++++++++++++----
 spec/platform.spec.js |    6 +++---
 src/platform.js       |    2 +-
 7 files changed, 33 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/6568ebd3/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index fd29596..934f5f5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,5 @@
 # OS X
 .DS_Store
+lib
+node_modules
+temp

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/6568ebd3/README.md
----------------------------------------------------------------------
diff --git a/README.md b/README.md
index 667c4cd..c0c7324 100644
--- a/README.md
+++ b/README.md
@@ -140,6 +140,9 @@ project.
 `./lib`, be prepared to see some failing tests as then this project will
 start cloning any necessary Cordova libraries (which may take a while).
 
+Also note that the the `spec/helper.js` file contains all of the
+mocks/stubs that we override for testing purposes.
+
 ## TO-DO
 
 - fix pluginstall for ios 2.0

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/6568ebd3/spec/build.spec.js
----------------------------------------------------------------------
diff --git a/spec/build.spec.js b/spec/build.spec.js
index e69de29..c6e20de 100644
--- a/spec/build.spec.js
+++ b/spec/build.spec.js
@@ -0,0 +1,4 @@
+describe('build command', function() {
+    describe('(android builds)', function() {
+    });
+});

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/6568ebd3/spec/create.spec.js
----------------------------------------------------------------------
diff --git a/spec/create.spec.js b/spec/create.spec.js
index cbe8951..777debe 100644
--- a/spec/create.spec.js
+++ b/spec/create.spec.js
@@ -38,8 +38,6 @@ describe('create command', function () {
         expect(fs.lstatSync(path.join(tempDir, '.cordova')).isFile()).toBe(true);
 
         expect(fs.readFileSync(path.join(tempDir, 'www', 'config.xml')).toString('utf8')).toMatch(/<name>balls<\/name>/);
-
-        expect(JSON.parse(fs.readFileSync(path.join(tempDir, '.cordova')).toString('utf8')).name).toEqual("balls");
     });
     it('should create a cordova project in the specified dir with specified name and id if
provided', function() {
         cordova.create(tempDir, "birdy.nam.nam", "numnum");
@@ -49,9 +47,5 @@ describe('create command', function () {
         var config = fs.readFileSync(path.join(tempDir, 'www', 'config.xml')).toString('utf8');
         expect(config).toMatch(/<name>numnum<\/name>/);
         expect(config).toMatch(/id="birdy\.nam\.nam"/);
-
-        var metadata = JSON.parse(fs.readFileSync(path.join(tempDir, '.cordova')).toString('utf8'));
-        expect(metadata.name).toEqual("numnum");
-        expect(metadata.id).toEqual("birdy.nam.nam");
     });
 });

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/6568ebd3/spec/helper.js
----------------------------------------------------------------------
diff --git a/spec/helper.js b/spec/helper.js
index 794eb5d..82170af 100644
--- a/spec/helper.js
+++ b/spec/helper.js
@@ -1,10 +1,25 @@
 // Override exec for certain commands, to speed execution of tests.
-var _exec = require('child_process').exec;
+var _exec = require('child_process').exec,
+    fs = require('fs'),
+    wrench = require('wrench'),
+    mkdirp = wrench.mkdirSyncRecursive,
+    cpr = wrench.copyDirSyncRecursive,
+    path = require('path'),
+    templates = path.join(__dirname, '..', 'templates'),
+    www = path.join(templates, 'www');
 
 require('child_process').exec = function(cmd, cb){
-    var space = cmd.indexOf(' ');
-    // Just invoke callback for create calls
-    if (Array.prototype.slice.call(cmd, space-6, space).join('') == 'create') {
+    var create_android = new RegExp('android' + path.sep + 'bin' + path.sep + 'create');
+    if (create_android.test(cmd)) {
+        // It's a create-android-project call. Fake as much of an
+        // android project as possible.
+        var dir = cmd.substr(cmd.indexOf('"') + 1);
+        dir = dir.substr(0, dir.length -1);
+        var android = path.join(dir, 'platforms', 'android');
+        mkdirp(android);
+        var assets = path.join(android, 'assets', 'www');
+        mkdirp(assets);
+        cpr(www, assets);
         cb();
     } else {
         _exec(cmd, cb);

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/6568ebd3/spec/platform.spec.js
----------------------------------------------------------------------
diff --git a/spec/platform.spec.js b/spec/platform.spec.js
index 2963a70..797e007 100644
--- a/spec/platform.spec.js
+++ b/spec/platform.spec.js
@@ -66,7 +66,7 @@ describe('platform command', function() {
             runs(function() {
                 cordova.platform('add', 'android', cb);
             });
-            waitsFor(function() { return cb.wasCalled; }, "create callback", 500);
+            waitsFor(function() { return cb.wasCalled; }, "create callback");
         });
     });
 
@@ -90,7 +90,7 @@ describe('platform command', function() {
             runs(function() {
                 cordova.platform('add', 'android', cb);
             });
-            waitsFor(function() { return cb.wasCalled; }, "create callback", 500);
+            waitsFor(function() { return cb.wasCalled; }, "create callback");
         });
     });
 
@@ -115,7 +115,7 @@ describe('platform command', function() {
             runs(function() {
                 cordova.platform('add', 'android', cb);
             });
-            waitsFor(function() { return cb.wasCalled; }, "create callback", 500);
+            waitsFor(function() { return cb.wasCalled; }, "create callback");
         });
     });
 });

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/6568ebd3/src/platform.js
----------------------------------------------------------------------
diff --git a/src/platform.js b/src/platform.js
index 6e09f42..407f582 100644
--- a/src/platform.js
+++ b/src/platform.js
@@ -29,7 +29,7 @@ function create(target, dir, cfg, callback) {
         exec(cmd, function(err, stderr, stdout) {
             if (err) {
                 cfg.remove_platform(target);
-                throw 'An error occured during creation of ' + target + ' sub-project. '
+ err;
+                throw 'An error occured during creation of ' + target + ' sub-project. '
+ err + ' ' + stderr;
             } else if (callback) callback();
         });
     }


Mime
View raw message