You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2014/06/13 23:36:04 UTC
git commit: CB-6943 Path can include the : if it is absolute,
only test for http. Added tests
Repository: cordova-cli
Updated Branches:
refs/heads/master d9b4ff7da -> f6e73a616
CB-6943 Path can include the : if it is absolute, only test for http. Added tests
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/f6e73a61
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/f6e73a61
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/f6e73a61
Branch: refs/heads/master
Commit: f6e73a61683ed2160eaa1da97f6cfacbc6aea0ac
Parents: d9b4ff7
Author: Jesse MacFadyen <pu...@gmail.com>
Authored: Fri Jun 13 14:35:02 2014 -0700
Committer: Jesse MacFadyen <pu...@gmail.com>
Committed: Fri Jun 13 14:36:05 2014 -0700
----------------------------------------------------------------------
spec/cli.spec.js | 30 ++++++++++++++++++++++++++++++
src/cli.js | 3 ++-
2 files changed, 32 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f6e73a61/spec/cli.spec.js
----------------------------------------------------------------------
diff --git a/spec/cli.spec.js b/spec/cli.spec.js
index 9b6e8de..f928630 100644
--- a/spec/cli.spec.js
+++ b/spec/cli.spec.js
@@ -91,6 +91,36 @@ describe("cordova cli", function () {
cli(["node", "cordova", "--silent", "build", "blackberry10", "--", "-k", "abcd1234", "--silent"]);
expect(cordova.raw.build).toHaveBeenCalledWith({verbose: false, silent: true, platforms: ["blackberry10"], options: ["-k", "abcd1234", "--silent"]});
});
+
+ });
+
+ describe("create args", function () {
+ beforeEach(function () {
+ spyOn(cordova.raw, "create").andReturn(Q());
+ spyOn(cordova_lib, "CordovaError");
+ });
+
+ it("will allow copy-from with ':' char", function () {
+ cli(["node", "cordova", "create", "a", "b" , "c", "--copy-from", "c:\\personalWWW"]);
+ expect(cordova.raw.create).toHaveBeenCalledWith("a","b","c",{lib:{www:{uri:"c:\\personalWWW"}}});
+ });
+
+ it("will NOT allow copy-from starting with 'http'", function () {
+ var threwAnException = false;
+ try {
+ cli(["node", "cordova", "create", "a", "b" , "c", "--copy-from", "http://www.somesite.com"]);
+ }
+ catch(e) {
+ threwAnException = true;
+ }
+ expect(cordova_lib.CordovaError).toHaveBeenCalledWith('Only local paths for custom www assets are supported.');
+ expect(threwAnException).toBe(true);
+ });
+
+ it("will allow link-to with ':' char", function () {
+ cli(["node", "cordova", "create", "a", "b" , "c", "--link-to", "c:\\personalWWW"]);
+ expect(cordova.raw.create).toHaveBeenCalledWith("a","b","c",{lib:{www:{uri:"c:\\personalWWW", link:true}}});
+ });
});
describe("plugin", function () {
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/f6e73a61/src/cli.js
----------------------------------------------------------------------
diff --git a/src/cli.js b/src/cli.js
index a4b6241..de74d50 100644
--- a/src/cli.js
+++ b/src/cli.js
@@ -30,6 +30,7 @@ var nopt, _
module.exports = cli
function cli(inputArgs) {
+
try {
nopt = require('nopt');
_ = require('underscore');
@@ -193,7 +194,7 @@ function cli(inputArgs) {
}
var customWww = args['copy-from'] || args['link-to'];
if (customWww) {
- if (customWww.indexOf(':') != -1) {
+ if (customWww.indexOf('http') === 0) {
throw new CordovaError(
'Only local paths for custom www assets are supported.'
);