You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by sg...@apache.org on 2014/09/26 23:20:10 UTC

[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 <da...@yandex.ru>
Authored: Fri Aug 1 17:09:34 2014 +0400
Committer: daserge <da...@yandex.ru>
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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
+</project>
+

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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectRootManager" version="2" />
+</project>
+

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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ProjectModuleManager">
+    <modules />
+  </component>
+</project>
+

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 @@
+<component name="DependencyValidationManager">
+  <state>
+    <option name="SKIP_IMPORT_STATEMENTS" value="false" />
+  </state>
+</component>
\ 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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="VcsDirectoryMappings">
+    <mapping directory="$PROJECT_DIR$" vcs="Git" />
+  </component>
+</project>
+

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 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project version="4">
+  <component name="ChangeListManager">
+    <list default="true" id="3463b0e6-70cf-4c4e-9c11-14dcdc7db6a1" name="Default" comment="" />
+    <ignored path="cordova-lib.iws" />
+    <ignored path=".idea/workspace.xml" />
+    <option name="TRACKING_ENABLED" value="true" />
+    <option name="SHOW_DIALOG" value="false" />
+    <option name="HIGHLIGHT_CONFLICTS" value="true" />
+    <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
+    <option name="LAST_RESOLUTION" value="IGNORE" />
+  </component>
+  <component name="ChangesViewManager" flattened_view="true" show_ignored="false" />
+  <component name="CreatePatchCommitExecutor">
+    <option name="PATCH_PATH" value="" />
+  </component>
+  <component name="DaemonCodeAnalyzer">
+    <disable_hints />
+  </component>
+  <component name="ExecutionTargetManager" SELECTED_TARGET="default_target" />
+  <component name="FavoritesManager">
+    <favorites_list name="cordova-lib" />
+  </component>
+  <component name="Git.Settings">
+    <option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$" />
+  </component>
+  <component name="ProjectFrameBounds">
+    <option name="x" value="-8" />
+    <option name="y" value="-8" />
+    <option name="width" value="1936" />
+    <option name="height" value="1056" />
+  </component>
+  <component name="ProjectLevelVcsManager" settingsEditedManually="false">
+    <OptionsSetting value="true" id="Add" />
+    <OptionsSetting value="true" id="Remove" />
+    <OptionsSetting value="true" id="Checkout" />
+    <OptionsSetting value="true" id="Update" />
+    <OptionsSetting value="true" id="Status" />
+    <OptionsSetting value="true" id="Edit" />
+    <ConfirmationsSetting value="0" id="Add" />
+    <ConfirmationsSetting value="0" id="Remove" />
+  </component>
+  <component name="ProjectReloadState">
+    <option name="STATE" value="0" />
+  </component>
+  <component name="ProjectView">
+    <navigator currentView="ProjectPane" proportions="" version="1">
+      <flattenPackages />
+      <showMembers />
+      <showModules />
+      <showLibraryContents />
+      <hideEmptyPackages />
+      <abbreviatePackageNames />
+      <autoscrollToSource />
+      <autoscrollFromSource />
+      <sortByType />
+    </navigator>
+    <panes>
+      <pane id="Scope" />
+      <pane id="ProjectPane">
+        <subPane>
+          <PATH>
+            <PATH_ELEMENT>
+              <option name="myItemId" value="cordova-lib" />
+              <option name="myItemType" value="com.intellij.ide.projectView.impl.nodes.ProjectViewProjectNode" />
+            </PATH_ELEMENT>
+          </PATH>
+        </subPane>
+      </pane>
+    </panes>
+  </component>
+  <component name="PropertiesComponent">
+    <property name="last_opened_file_path" value="$PROJECT_DIR$/cordova-lib" />
+    <property name="WebServerToolWindowFactoryState" value="false" />
+  </component>
+  <component name="RunManager">
+    <list size="0" />
+  </component>
+  <component name="ShelveChangesManager" show_recycled="false" />
+  <component name="TaskManager">
+    <task active="true" id="Default" summary="Default task">
+      <changelist id="3463b0e6-70cf-4c4e-9c11-14dcdc7db6a1" name="Default" comment="" />
+      <created>1409739905639</created>
+      <updated>1409739905639</updated>
+    </task>
+    <servers />
+  </component>
+  <component name="ToolWindowManager">
+    <frame x="-8" y="-8" width="1936" height="1056" extended-state="6" />
+    <editor active="false" />
+    <layout>
+      <window_info id="Changes" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+      <window_info id="Terminal" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+      <window_info id="TODO" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="6" side_tool="false" content_ui="tabs" />
+      <window_info id="Structure" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Project" active="true" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="true" weight="0.24960506" sideWeight="0.5" order="0" side_tool="false" content_ui="combo" />
+      <window_info id="Debug" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="3" side_tool="false" content_ui="tabs" />
+      <window_info id="Favorites" active="false" anchor="left" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
+      <window_info id="Event Log" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="true" content_ui="tabs" />
+      <window_info id="Run" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="2" side_tool="false" content_ui="tabs" />
+      <window_info id="Version Control" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="-1" side_tool="false" content_ui="tabs" />
+      <window_info id="Cvs" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="4" side_tool="false" content_ui="tabs" />
+      <window_info id="Message" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Ant Build" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Find" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.33" sideWeight="0.5" order="1" side_tool="false" content_ui="tabs" />
+      <window_info id="Commander" active="false" anchor="right" auto_hide="false" internal_type="SLIDING" type="SLIDING" visible="false" weight="0.4" sideWeight="0.5" order="0" side_tool="false" content_ui="tabs" />
+      <window_info id="Hierarchy" active="false" anchor="right" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.25" sideWeight="0.5" order="2" side_tool="false" content_ui="combo" />
+      <window_info id="Inspection" active="false" anchor="bottom" auto_hide="false" internal_type="DOCKED" type="DOCKED" visible="false" weight="0.4" sideWeight="0.5" order="5" side_tool="false" content_ui="tabs" />
+    </layout>
+  </component>
+  <component name="Vcs.Log.UiProperties">
+    <option name="RECENTLY_FILTERED_USER_GROUPS">
+      <collection />
+    </option>
+    <option name="RECENTLY_FILTERED_BRANCH_GROUPS">
+      <collection />
+    </option>
+  </component>
+  <component name="VcsContentAnnotationSettings">
+    <option name="myLimit" value="2678400000" />
+  </component>
+  <component name="VcsManagerConfiguration">
+    <option name="myTodoPanelSettings">
+      <TodoPanelSettings />
+    </option>
+  </component>
+  <component name="XDebuggerManager">
+    <breakpoint-manager />
+  </component>
+</project>
+

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 {