Return-Path: X-Original-To: apmail-cordova-commits-archive@www.apache.org Delivered-To: apmail-cordova-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 46D5A177EF for ; Fri, 26 Sep 2014 21:20:01 +0000 (UTC) Received: (qmail 23584 invoked by uid 500); 26 Sep 2014 21:20:01 -0000 Delivered-To: apmail-cordova-commits-archive@cordova.apache.org Received: (qmail 23503 invoked by uid 500); 26 Sep 2014 21:20:01 -0000 Mailing-List: contact commits-help@cordova.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cordova.apache.org Delivered-To: mailing list commits@cordova.apache.org Received: (qmail 23320 invoked by uid 99); 26 Sep 2014 21:20:01 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 26 Sep 2014 21:20:01 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id B04689B3F20; Fri, 26 Sep 2014 21:20:00 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sgrebnov@apache.org To: commits@cordova.apache.org Date: Fri, 26 Sep 2014 21:20:10 -0000 Message-Id: <582c7ad07e9c4515b239373509a6db45@git.apache.org> In-Reply-To: <91e5177ea90145a18a27473f7697e74e@git.apache.org> References: <91e5177ea90145a18a27473f7697e74e@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [11/13] git commit: CB-6481 Fixed tests - removed output CB-6481 Fixed tests - removed output Avoided tests output - mocked hooker fire in windows8 and wp8 tests Added pwd check missing case to isCordova Removed exception swallowing in case config.xml is not found in hooks/scriptFinder Project: http://git-wip-us.apache.org/repos/asf/cordova-lib/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-lib/commit/1b5ce69b Tree: http://git-wip-us.apache.org/repos/asf/cordova-lib/tree/1b5ce69b Diff: http://git-wip-us.apache.org/repos/asf/cordova-lib/diff/1b5ce69b Branch: refs/heads/master Commit: 1b5ce69b93833145f14772213600c0e516ccff64 Parents: a316933 Author: daserge Authored: Fri Aug 1 17:09:34 2014 +0400 Committer: daserge Committed: Thu Sep 25 19:06:15 2014 +0400 ---------------------------------------------------------------------- .idea/encodings.xml | 5 + .idea/misc.xml | 5 + .idea/modules.xml | 7 + .idea/scopes/scope_settings.xml | 5 + .idea/vcs.xml | 7 + .idea/workspace.xml | 131 +++++++++++++++++++ .../projWithHooks/.cordova/hooks/fail/fail.js | 2 +- .../metadata/windows8_parser.spec.js | 6 +- .../spec-cordova/metadata/wp8_parser.spec.js | 6 +- cordova-lib/src/cordova/util.js | 2 +- cordova-lib/src/hooks/scriptsFinder.js | 10 +- 11 files changed, 171 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1b5ce69b/.idea/encodings.xml ---------------------------------------------------------------------- diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..e206d70 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,5 @@ + + + + + http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1b5ce69b/.idea/misc.xml ---------------------------------------------------------------------- diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..1162f43 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,5 @@ + + + + + http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1b5ce69b/.idea/modules.xml ---------------------------------------------------------------------- diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..684f749 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,7 @@ + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1b5ce69b/.idea/scopes/scope_settings.xml ---------------------------------------------------------------------- diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1b5ce69b/.idea/vcs.xml ---------------------------------------------------------------------- diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..c80f219 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,7 @@ + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1b5ce69b/.idea/workspace.xml ---------------------------------------------------------------------- diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..ea84f4e --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,131 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1409739905639 + 1409739905639 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1b5ce69b/cordova-lib/spec-cordova/fixtures/projWithHooks/.cordova/hooks/fail/fail.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/fixtures/projWithHooks/.cordova/hooks/fail/fail.js b/cordova-lib/spec-cordova/fixtures/projWithHooks/.cordova/hooks/fail/fail.js index d2d790b..7e8ff52 100644 --- a/cordova-lib/spec-cordova/fixtures/projWithHooks/.cordova/hooks/fail/fail.js +++ b/cordova-lib/spec-cordova/fixtures/projWithHooks/.cordova/hooks/fail/fail.js @@ -1,2 +1,2 @@ #!/usr/bin/env node -throw Error('test error'); \ No newline at end of file +process.exit(1); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1b5ce69b/cordova-lib/spec-cordova/metadata/windows8_parser.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/metadata/windows8_parser.spec.js b/cordova-lib/spec-cordova/metadata/windows8_parser.spec.js index 2d9c3f3..b7279b0 100644 --- a/cordova-lib/spec-cordova/metadata/windows8_parser.spec.js +++ b/cordova-lib/spec-cordova/metadata/windows8_parser.spec.js @@ -28,7 +28,8 @@ var platforms = require('../../src/cordova/platforms'), fs = require('fs'), config = require('../../src/cordova/config'), ConfigParser = require('../../src/configparser/ConfigParser'), - cordova = require('../../src/cordova/cordova'); + cordova = require('../../src/cordova/cordova'), + HooksRunner = require('../../src/hooks/HooksRunner'); // Create a real config object before mocking out everything. var cfg = new ConfigParser(path.join(__dirname, '..', 'test-config.xml')); @@ -143,13 +144,14 @@ describe('windows8 project parser', function() { }); }); describe('update_project method', function() { - var config, www, overrides, svn; + var config, www, overrides, svn, fire; beforeEach(function() { config = spyOn(parser, 'update_from_config'); www = spyOn(parser, 'update_www'); shellls = spyOn(shell, 'ls').andReturn([]); svn = spyOn(util, 'deleteSvnFolders'); exists.andReturn(false); + fire = spyOn(HooksRunner.prototype, 'fire').andReturn(Q()); }); it('should call update_from_config', function() { parser.update_project(); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1b5ce69b/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js ---------------------------------------------------------------------- diff --git a/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js b/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js index dd85d26..aac5858 100644 --- a/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js +++ b/cordova-lib/spec-cordova/metadata/wp8_parser.spec.js @@ -29,7 +29,8 @@ var platforms = require('../../src/cordova/platforms'), config = require('../../src/cordova/config'), ConfigParser = require('../../src/configparser/ConfigParser'), CordovaError = require('../../src/CordovaError'), - cordova = require('../../src/cordova/cordova'); + cordova = require('../../src/cordova/cordova'), + HooksRunner = require('../../src/hooks/HooksRunner'); // Create a real config object before mocking out everything. var cfg = new ConfigParser(path.join(__dirname, '..', 'test-config.xml')); @@ -158,12 +159,13 @@ describe('wp8 project parser', function() { }); }); describe('update_project method', function() { - var config, www, overrides, svn; + var config, www, overrides, svn, fire; beforeEach(function() { config = spyOn(p, 'update_from_config'); www = spyOn(p, 'update_www'); svn = spyOn(util, 'deleteSvnFolders'); exists.andReturn(false); + fire = spyOn(HooksRunner.prototype, 'fire').andReturn(Q()); }); it('should call update_from_config', function(done) { wrapper(p.update_project(), done, function() { http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1b5ce69b/cordova-lib/src/cordova/util.js ---------------------------------------------------------------------- diff --git a/cordova-lib/src/cordova/util.js b/cordova-lib/src/cordova/util.js index 86dff6d..89b0ef3 100644 --- a/cordova-lib/src/cordova/util.js +++ b/cordova-lib/src/cordova/util.js @@ -74,7 +74,7 @@ function isCordova(dir) { // Prefer PWD over cwd so that symlinked dirs within your PWD work correctly (CB-5687). var pwd = process.env.PWD; var cwd = process.cwd(); - if (pwd && pwd != cwd) { + if (pwd && pwd != cwd && pwd != 'undefined') { return this.isCordova(pwd) || this.isCordova(cwd); } return this.isCordova(cwd); http://git-wip-us.apache.org/repos/asf/cordova-lib/blob/1b5ce69b/cordova-lib/src/hooks/scriptsFinder.js ---------------------------------------------------------------------- diff --git a/cordova-lib/src/hooks/scriptsFinder.js b/cordova-lib/src/hooks/scriptsFinder.js index 9abbb8e..3345af1 100644 --- a/cordova-lib/src/hooks/scriptsFinder.js +++ b/cordova-lib/src/hooks/scriptsFinder.js @@ -107,15 +107,7 @@ function getApplicationHookScriptsFromDir(dir) { */ function getScriptsFromConfigXml(hook, opts) { var configPath = cordovaUtil.projectConfig(opts.projectRoot); - var configXml; - - try { - configXml = new ConfigParser(configPath); - } catch(ex) { - events.emit('err', 'scriptsFinder could not load config.xml: ' + ex.message); - console.log('scriptsFinder could not load config.xml: ' + ex.message); - return []; - } + var configXml = new ConfigParser(configPath); return configXml.getHookScripts(hook, opts.cordova.platforms).map(function(scriptElement) { return {