cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [2/4] git commit: Fixes #61: hook folders that do not exist blow things up. Now ignore hook folders that no longer exist.
Date Thu, 01 Nov 2012 22:25:01 GMT
Fixes #61: hook folders that do not exist blow things up. Now ignore hook folders that no longer
exist.


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/de96a577
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/tree/de96a577
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/diff/de96a577

Branch: refs/heads/cordova-client
Commit: de96a57782862263d89f5ba509f02de125fe99b7
Parents: 5f8f2a3
Author: Fil Maj <maj.fil@gmail.com>
Authored: Thu Nov 1 15:19:52 2012 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Thu Nov 1 15:19:52 2012 -0700

----------------------------------------------------------------------
 spec/hooker.spec.js |    4 ++--
 src/hooker.js       |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/de96a577/spec/hooker.spec.js
----------------------------------------------------------------------
diff --git a/spec/hooker.spec.js b/spec/hooker.spec.js
index 8ba1a58..b6bea95 100644
--- a/spec/hooker.spec.js
+++ b/spec/hooker.spec.js
@@ -42,10 +42,10 @@ describe('hooker', function() {
         });
 
         describe('failure', function() {
-            it('should throw if the hook is unrecognized', function() {
+            it('should not throw if the hook is unrecognized', function() {
                 expect(function() {
                     h.fire('CLEAN YOUR SHORTS GODDAMNIT LIKE A BIG BOY!');
-                }).toThrow();
+                }).not.toThrow();
             });
             it('should throw if any script exits with non-zero code', function() {
                 var script = path.join(tempDir, '.cordova', 'hooks', 'before_build', 'fail.sh');

http://git-wip-us.apache.org/repos/asf/incubator-cordova-labs/blob/de96a577/src/hooker.js
----------------------------------------------------------------------
diff --git a/src/hooker.js b/src/hooker.js
index e01d9e2..d7b2e0b 100644
--- a/src/hooker.js
+++ b/src/hooker.js
@@ -13,7 +13,7 @@ module.exports = function hooker(root) {
 module.exports.prototype = {
     fire:function fire(hook) {
         var dir = path.join(this.root, '.cordova', 'hooks', hook);
-        if (!(fs.existsSync(dir))) throw 'Unrecognized hook "' + hook + '".';
+        if (!(fs.existsSync(dir))) return true; // hooks directory got axed post-create;
ignore.
 
         // Fire JS hook/event
         events.emit(hook);


Mime
View raw message