Remove un-used module and 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/fb14f6ea Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/fb14f6ea Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/fb14f6ea Branch: refs/heads/master Commit: fb14f6ea13615dc810169c4435d52e578f5a7694 Parents: f1e9e04 Author: Jesse MacFadyen <[email protected]> Authored: Tue Feb 28 15:08:58 2017 -0800 Committer: Steve Gill <[email protected]> Committed: Fri Mar 10 16:04:24 2017 -0800 ---------------------------------------------------------------------- spec/create.spec.js | 55 ----------------------------- src/create.js | 92 ------------------------------------------------ 2 files changed, 147 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/fb14f6ea/spec/create.spec.js ---------------------------------------------------------------------- diff --git a/spec/create.spec.js b/spec/create.spec.js deleted file mode 100644 index 64920ff..0000000 --- a/spec/create.spec.js +++ /dev/null @@ -1,55 +0,0 @@ -/** - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - -var clicreate = require("../src/create.js"), - Q = require('q'), - cordova_lib = require('cordova-lib'), - plugman = cordova_lib.plugman, - cordova = cordova_lib.cordova; - -describe("cordova cli", function () { - - beforeEach(function () { - // Event registration is currently process-global. Since all jasmine - // tests in a directory run in a single process (and in parallel), - // logging events registered as a result of the "--verbose" flag in - // CLI testing below would cause lots of logging messages printed out by other specs. - spyOn(cordova, "on"); - spyOn(plugman, "on"); - }); - - describe("Create Module", function () { - - describe("parseConfig", function() { - - it("Test#001 : should be defined", function () { - expect(clicreate.parseConfig).toEqual(jasmine.any(Function)); - }); - - }); - - describe("create", function() { - - it("Test#002 : should be defined", function () { - expect(clicreate.run).toEqual(jasmine.any(Function)); - }); - - }); - }); -}); http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/fb14f6ea/src/create.js ---------------------------------------------------------------------- diff --git a/src/create.js b/src/create.js deleted file mode 100644 index 8ad7d87..0000000 --- a/src/create.js +++ /dev/null @@ -1,92 +0,0 @@ -/* - Licensed to the Apache Software Foundation (ASF) under one - or more contributor license agreements. See the NOTICE file - distributed with this work for additional information - regarding copyright ownership. The ASF licenses this file - to you under the Apache License, Version 2.0 (the - "License"); you may not use this file except in compliance - with the License. You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, - software distributed under the License is distributed on an - "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - KIND, either express or implied. See the License for the - specific language governing permissions and limitations - under the License. -*/ - -var CordovaCliCreate = function () { - -}; - -/** - * provides logic for exposing cordova-lib create functionality to the command line - * the create argument is implied from the call to this function, all other cl arguments should be passed in unmodified - * - * @args - - * @undashed - */ -CordovaCliCreate.prototype.run = function (args, undashed) { - var cfg = {}, - customWww; - - // parseConfig will determine if there's a valid config JSON string - cfg = this.parseConfig(undashed[4]); - - // create(dir, id, name, cfg) - cordova.raw.create(undashed[1] , // dir to create the project in - undashed[2] , // App id - undashed[3] , // App name - cfg - ).done(); -}; - -/** - * parseConfig - * generic parser, if it's valid json, returns the resulting object - * if anything resolving to false is passed in, return an empty object - * invalid json results in an error message and process exit with status code 2. - * - * jsondata - a json data string - * - */ -CordovaCliCreate.prototype.parseConfig = function (jsondata) { - if (!jsondata) return {}; - - try { - cfg = JSON.parse(jsondata); - } catch (e) { - console.error('Error while parsing json data\nError: '+ e +'\nData:' + jsondata); - process.exit(2); - } -}; -CordovaCliCreate.prototype.customWww = function (args) { - - // handle custom www - if (!!(customWww = args['copy-from'] || args['link-to'])) { - - if (customWww.indexOf(':') != -1) { - throw new CordovaError( - 'Only local paths for custom www assets are supported.' - ); - - } - - if ( customWww.substr(0,1) === '~' ) { // resolve tilde in a naive way. - customWww = path.join(process.env.HOME, customWww.substr(1)); - } - - customWww = path.resolve(customWww); - var wwwCfg = { uri: customWww }; - if (args['link-to']) { - wwwCfg.link = true; - } - - cfg.lib = cfg.lib || {}; - cfg.lib.www = wwwCfg; - } -}; - -module.exports = new CordovaCliCreate(); --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
