You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by an...@apache.org on 2015/12/21 11:37:34 UTC

cordova-cli git commit: CB-8455 Added --nohooks option. This closes #230.

Repository: cordova-cli
Updated Branches:
  refs/heads/master 030c52f6d -> e5b7c1298


CB-8455 Added --nohooks option. This closes #230.


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

Branch: refs/heads/master
Commit: e5b7c129878647f346a7d987852b53490a11e52e
Parents: 030c52f
Author: Byoungro So <by...@intel.com>
Authored: Mon Dec 7 20:50:11 2015 -0800
Committer: Vladimir Kotikov <ko...@gmail.com>
Committed: Mon Dec 21 13:34:13 2015 +0300

----------------------------------------------------------------------
 doc/cordova.txt  |  2 ++
 spec/cli.spec.js | 26 +++++++++++++++++++-------
 src/cli.js       |  3 +++
 3 files changed, 24 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/e5b7c129/doc/cordova.txt
----------------------------------------------------------------------
diff --git a/doc/cordova.txt b/doc/cordova.txt
index 568b1a5..2bf8b46 100644
--- a/doc/cordova.txt
+++ b/doc/cordova.txt
@@ -35,3 +35,5 @@ Command-line Flags/Options
     -d, --verbose ...................... debug mode produces verbose log output for all activity,
                                          including output of sub-commands cordova-cli invokes
     --no-update-notifier ............... disables check for CLI updates
+    --nohooks .......................... suppress executing hooks
+                                            (taking RegExp hook patterns as parameters)

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/e5b7c129/spec/cli.spec.js
----------------------------------------------------------------------
diff --git a/spec/cli.spec.js b/spec/cli.spec.js
index 7c1ca3b..f1e1e92 100644
--- a/spec/cli.spec.js
+++ b/spec/cli.spec.js
@@ -50,7 +50,7 @@ describe("cordova cli", function () {
                 expect(console.log.mostRecentCall.args[0]).toMatch(version);
             });
 
-            it("will spit out the version with -v anywher", function () {
+            it("will spit out the version with -v anywhere", function () {
                 cli(["node", "cordova", "one", "-v", "three"]);
                 expect(console.log.mostRecentCall.args[0]).toMatch(version);
             });
@@ -64,32 +64,32 @@ describe("cordova cli", function () {
 
         it("will call command with all arguments passed through", function () {
             cli(["node", "cordova", "build", "blackberry10", "--", "-k", "abcd1234"]);
-            expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { argv : [ '-k', 'abcd1234' ] }, verbose : false, silent : false, browserify : false, searchpath : undefined });
+          expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { argv : [ '-k', 'abcd1234' ] }, verbose : false, silent : false, browserify : false, nohooks:[], searchpath : undefined });
         });
 
         it("will consume the first instance of -d", function () {
             cli(["node", "cordova", "-d", "build", "blackberry10", "--", "-k", "abcd1234", "-d"]);
-            expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { verbose : true, argv : [ '-k', 'abcd1234', '-d' ] }, verbose : true, silent : false, browserify : false, searchpath : undefined });
+            expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { verbose : true, argv : [ '-k', 'abcd1234', '-d' ] }, verbose : true, silent : false, browserify : false, nohooks:[], searchpath : undefined });
         });
 
         it("will consume the first instance of --verbose", function () {
             cli(["node", "cordova", "--verbose", "build", "blackberry10", "--", "-k", "abcd1234", "--verbose"]);
-            expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { verbose : true, argv : [ '-k', 'abcd1234', '--verbose' ] }, verbose : true, silent : false, browserify : false, searchpath : undefined });
+            expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { verbose : true, argv : [ '-k', 'abcd1234', '--verbose' ] }, verbose : true, silent : false, browserify : false, nohooks:[], searchpath : undefined });
         });
 
         it("will consume the first instance of either --verbose of -d", function () {
             cli(["node", "cordova", "--verbose", "build", "blackberry10", "--", "-k", "abcd1234", "-d"]);
-            expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { verbose : true, argv : [ '-k', 'abcd1234', '-d' ] }, verbose : true, silent : false, browserify : false, searchpath : undefined });
+            expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { verbose : true, argv : [ '-k', 'abcd1234', '-d' ] }, verbose : true, silent : false, browserify : false, nohooks:[], searchpath : undefined });
         });
 
         it("will consume the first instance of either --verbose of -d", function () {
             cli(["node", "cordova", "-d", "build", "blackberry10", "--", "-k", "abcd1234", "--verbose"]);
-            expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { verbose : true, argv : [ '-k', 'abcd1234', '--verbose' ] }, verbose : true, silent : false, browserify : false, searchpath : undefined });
+            expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { verbose : true, argv : [ '-k', 'abcd1234', '--verbose' ] }, verbose : true, silent : false, browserify : false, nohooks:[], searchpath : undefined });
         });
 
         it("will consume the first instance of --silent", function () {
             cli(["node", "cordova", "--silent", "build", "blackberry10", "--",  "-k", "abcd1234", "--silent"]);
-            expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { silent : true, argv : [ '-k', 'abcd1234', '--silent' ] }, verbose : false, silent : true, browserify : false, searchpath : undefined });
+            expect(cordova.raw.build).toHaveBeenCalledWith({ platforms : [ 'blackberry10' ], options : { silent : true, argv : [ '-k', 'abcd1234', '--silent' ] }, verbose : false, silent : true, browserify : false, nohooks:[], searchpath : undefined });
         });
 
     });
@@ -132,5 +132,17 @@ describe("cordova cli", function () {
             var opts = cordova.raw.plugin.calls[0].args[2];
             expect(opts.cli_variables.MOTO).toBe('DELTA=WAS=HERE');
         });
+
+        it("will pass hook patterns to suppress", function () {
+            cli(["node", "cordova", "plugin", "add", "facebook", "--nohooks", "before_plugin_add"]);
+            expect(cordova.raw.plugin).toHaveBeenCalledWith(
+                "add",
+                ["facebook"],
+                jasmine.any(Object)
+            );
+            var opts = cordova.raw.plugin.calls[0].args[2];
+            expect(opts.nohooks[0]).toBe("before_plugin_add");
+        });
+
     });
 });

http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/e5b7c129/src/cli.js
----------------------------------------------------------------------
diff --git a/src/cli.js b/src/cli.js
index b5b7103..abd7828 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -79,6 +79,7 @@ function cli(inputArgs) {
         , 'silent' : Boolean
         , 'experimental' : Boolean
         , 'noregistry' : Boolean
+        , 'nohooks': Array
         , 'shrinkwrap' : Boolean
         , 'copy-from' : String
         , 'link-to' : path
@@ -194,6 +195,7 @@ function cli(inputArgs) {
         verbose: args.verbose || false,
         silent: args.silent || false,
         browserify: args.browserify || false,
+        nohooks: args.nohooks || [],
         searchpath : args.searchpath
     };
 
@@ -308,6 +310,7 @@ function cli(inputArgs) {
         }
         var download_opts = { searchpath : args.searchpath
                             , noregistry : args.noregistry
+                            , nohooks : args.nohooks
                             , cli_variables : cli_vars
                             , browserify: args.browserify || false
                             , link: args.link || false


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org