cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [08/13] cordova-browser git commit: clean up some cruft, create emit errors, removed old ActiveX seeking xhr code
Date Sat, 17 Jun 2017 00:11:49 GMT
clean up some cruft, create emit errors, removed old ActiveX seeking xhr code


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

Branch: refs/heads/master
Commit: c4511806452014fd99f5cce6f5ce73614402063a
Parents: 5b83727
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Fri Jun 9 11:54:09 2017 -0700
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Fri Jun 9 11:57:50 2017 -0700

----------------------------------------------------------------------
 bin/lib/create.js              | 29 +++++++++++------------------
 bin/template/www/manifest.json |  2 +-
 cordova-js-src/confighelper.js | 11 +++--------
 spec/manifest.spec.js          |  2 +-
 4 files changed, 16 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/c4511806/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 37f9b11..bdc79d6 100644
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -29,17 +29,16 @@ var events = require('cordova-common').events;
 var check_reqs = require('./check_reqs');
 
 
+// exported method to create a project, returns a promise that resolves with null
 module.exports.createProject = function(project_path,package_name,project_name){
 /*
     // create the dest and the standard place for our api to live
     // platforms/platformName/cordova/Api.js
 */
-
     events.emit('log', 'Creating Cordova project for cordova-browser:');
     events.emit('log', '\tPath: ' + project_path);
     events.emit('log', '\tName: ' + project_name);
 
-
     var VERSION = fs.readFileSync(path.join(ROOT, 'VERSION'), 'utf-8');
 
     // Set default values for path, package and name
@@ -47,17 +46,13 @@ module.exports.createProject = function(project_path,package_name,project_name){
 
     // Check if project already exists
     if (fs.existsSync(project_path)) {
-        console.error('Project already exists! Delete and recreate');
-        process.exitCode = 2;
-        return;
+        events.emit('error','Oops, destination already exists! Delete it and try again');
     }
 
     // Check that requirements are met and proper targets are installed
     if (!check_reqs.run()) {
         // TODO: use events.emit
-        console.error('Please make sure you meet the software requirements in order to build
a browser cordova project');
-        process.exitCode = 2;
-        return;
+        events.emit('error','Please make sure you meet the software requirements in order
to build a browser cordova project');
     }
 
     //copy template/cordova directory ( recursive )
@@ -66,15 +61,13 @@ module.exports.createProject = function(project_path,package_name,project_name){
     //copy template/www directory ( recursive )
     shell.cp('-r', path.join(ROOT, 'bin/template/www'),  project_path);
 
-        //copy required node_modules
-    shell.cp('-r', path.join(ROOT, 'node_modules'), path.join(project_path,'cordova'));
+    // recreate our node_modules structure in the new project
+    shell.cp('-r', path.join(ROOT, 'node_modules'),
+                   path.join(project_path,'cordova'));
 
     //copy check_reqs file
-    shell.cp(path.join(ROOT, 'bin/lib/check_reqs.js'), path.join(project_path,'cordova/lib'));
-
-    //copy cordova js file
-    shell.cp(path.join(ROOT, 'cordova-lib', 'cordova.js'),
-                   path.join(project_path,'www'));
+    shell.cp(path.join(ROOT, 'bin/lib/check_reqs.js'),
+             path.join(project_path,'cordova/lib'));
 
     //copy cordova-js-src directory
     shell.cp('-rf', path.join(ROOT, 'cordova-js-src'),
@@ -82,11 +75,11 @@ module.exports.createProject = function(project_path,package_name,project_name){
 
     //copy cordova js file to platform_www
     shell.cp(path.join(ROOT, 'cordova-lib', 'cordova.js'),
-                   path.join(project_path,'platform_www'));
+             path.join(project_path,'platform_www'));
 
-    //copy cordova js file to platform_www
+    //copy manifest file to platform_www
     shell.cp(path.join(ROOT, 'bin/template/www', 'manifest.json'),
-                   path.join(project_path,'platform_www'));
+             path.join(project_path,'platform_www'));
 
     return Promise.resolve();
 };

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/c4511806/bin/template/www/manifest.json
----------------------------------------------------------------------
diff --git a/bin/template/www/manifest.json b/bin/template/www/manifest.json
index 2c3efd1..b7e3981 100644
--- a/bin/template/www/manifest.json
+++ b/bin/template/www/manifest.json
@@ -1,7 +1,7 @@
 {
   "name": "My App",
   "short_name":"My Ap",
-  "description": "Description of your app",
+  "description": "Description of your app from template",
   "start_url": "index.html",
   "scope":"index.html",
   "icons": [{

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/c4511806/cordova-js-src/confighelper.js
----------------------------------------------------------------------
diff --git a/cordova-js-src/confighelper.js b/cordova-js-src/confighelper.js
index b6d606e..4d99959 100644
--- a/cordova-js-src/confighelper.js
+++ b/cordova-js-src/confighelper.js
@@ -61,14 +61,9 @@ function readConfig(success, error) {
         }
     };
 
-    if ("ActiveXObject" in window) {
-        // Needed for XHR-ing via file:// protocol in IE
-        xhr = new window.ActiveXObject("MSXML2.XMLHTTP");
-        xhr.onreadystatechange = xhrStatusChangeHandler;
-    } else {
-        xhr = new XMLHttpRequest();
-        xhr.addEventListener("load", xhrStatusChangeHandler);
-    }
+    xhr = new XMLHttpRequest();
+    xhr.addEventListener("load", xhrStatusChangeHandler);
+
 
     try {
         xhr.open("get", "/config.xml", true);

http://git-wip-us.apache.org/repos/asf/cordova-browser/blob/c4511806/spec/manifest.spec.js
----------------------------------------------------------------------
diff --git a/spec/manifest.spec.js b/spec/manifest.spec.js
index fe90105..5afe204 100644
--- a/spec/manifest.spec.js
+++ b/spec/manifest.spec.js
@@ -76,7 +76,7 @@ function createAndBuild(projectname, projectid) {
 }
 
 
-fdescribe('create', function() {
+describe('create', function() {
 
     it('create project with manifest.json', function() {
         var projectname = 'testcreate';


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


Mime
View raw message