You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2013/06/12 19:34:36 UTC
git commit: fixed create with new lazy loading. added back in
config.xml template until CB-3771 is solved.
Updated Branches:
refs/heads/lazy 74075fa11 -> 56012d00b
fixed create with new lazy loading. added back in config.xml template until CB-3771 is solved.
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/56012d00
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/56012d00
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/56012d00
Branch: refs/heads/lazy
Commit: 56012d00b2c79615be4c21c7ea0b60efbd17e22e
Parents: 74075fa
Author: Fil Maj <ma...@gmail.com>
Authored: Wed Jun 12 10:34:33 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Wed Jun 12 10:34:33 2013 -0700
----------------------------------------------------------------------
package.json | 2 +-
spec/cordova-cli/create.spec.js | 3 ---
src/create.js | 7 +++++--
src/hooker.js | 6 ++++--
src/lazy_load.js | 3 +--
templates/config.xml | 17 +++++++++++++++++
6 files changed, 28 insertions(+), 10 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/56012d00/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 1757a8a..7c9080b 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "cordova",
- "version": "2.8.15",
+ "version": "2.8.16",
"preferGlobal": "true",
"description": "Cordova command line interface tool",
"main": "cordova",
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/56012d00/spec/cordova-cli/create.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova-cli/create.spec.js b/spec/cordova-cli/create.spec.js
index 3d5d0e0..c3cad3e 100644
--- a/spec/cordova-cli/create.spec.js
+++ b/spec/cordova-cli/create.spec.js
@@ -7,8 +7,6 @@ var cordova = require('../../cordova'),
lazy_load = require('../../src/lazy_load'),
tempDir = path.join(__dirname, '..', '..', 'temp');
-config_parser = require('../../src/config_parser');
-
describe('create command', function () {
var mkdir, cp, config_spy, load_cordova, load_custom, exists, config_read, parser;
beforeEach(function() {
@@ -24,7 +22,6 @@ describe('create command', function () {
load_custom = spyOn(lazy_load, 'custom').andCallFake(function(url, id, platform, version, cb) {
cb();
});
- parser = spyOnConstructor(global, 'config_parser', ['packageName', 'name']);
});
it('should do something', function(done) {
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/56012d00/src/create.js
----------------------------------------------------------------------
diff --git a/src/create.js b/src/create.js
index 663fe9a..b7f2e5d 100644
--- a/src/create.js
+++ b/src/create.js
@@ -108,15 +108,18 @@ module.exports = function create (dir, id, name, callback) {
// Check if www assets to use was overridden.
var www_dir = path.join(dir, 'www');
var finalize = function(www_lib) {
- while (!fs.existsSync(path.join(www_lib, 'config.xml'))) {
+ while (!fs.existsSync(path.join(www_lib, 'index.html'))) {
www_lib = path.join(www_lib, 'www');
if (!fs.existsSync(www_lib)) {
- var err = new Error('downloaded www assets in ' + www_lib + ' does not contain config.xml, or www subdir with config.xml');
+ var err = new Error('downloaded www assets in ' + www_lib + ' does not contain index.html, or www subdir with index.html');
if (callback) return callback(err);
else throw err;
}
}
shell.cp('-rf', path.join(www_lib, '*'), www_dir);
+ // Copy over template config.xml (TODO: CB-3771 will remove the need for this)
+ var template_config_xml = path.join(__dirname, '..', 'templates', 'config.xml');
+ shell.cp(template_config_xml, www_dir);
// Write out id and name to config.xml
var configPath = util.projectConfig(dir);
var config = new config_parser(configPath);
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/56012d00/src/hooker.js
----------------------------------------------------------------------
diff --git a/src/hooker.js b/src/hooker.js
index 247385f..cdd44d9 100644
--- a/src/hooker.js
+++ b/src/hooker.js
@@ -29,12 +29,14 @@ module.exports = function hooker(root) {
}
module.exports.fire = function global_fire(hook, opts, callback) {
- if (arguments.length == 2) {
+ if (arguments.length == 2 && typeof opts == 'function') {
callback = opts;
opts = {};
}
var handlers = events.listeners(hook);
- execute_handlers_serially(handlers, opts, callback);
+ execute_handlers_serially(handlers, opts, function() {
+ if (callback) callback();
+ });
};
module.exports.prototype = {
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/56012d00/src/lazy_load.js
----------------------------------------------------------------------
diff --git a/src/lazy_load.js b/src/lazy_load.js
index f7bf15c..4919ab8 100644
--- a/src/lazy_load.js
+++ b/src/lazy_load.js
@@ -48,13 +48,12 @@ module.exports = {
},
custom:function(url, id, platform, version, callback) {
var download_dir = path.join(util.libDirectory, platform, id, version);
- shell.mkdir('-p', download_dir);
if (fs.existsSync(download_dir)) {
events.emit('log', 'Platform library for "' + platform + '" already exists. No need to download. Continuing.');
if (callback) callback();
return;
}
-
+ shell.mkdir('-p', download_dir);
hooker.fire('before_library_download', {
platform:platform,
url:url,
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/56012d00/templates/config.xml
----------------------------------------------------------------------
diff --git a/templates/config.xml b/templates/config.xml
new file mode 100644
index 0000000..bf15b68
--- /dev/null
+++ b/templates/config.xml
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<widget xmlns = "http://www.w3.org/ns/widgets"
+ xmlns:cdv = "http://cordova.apache.org/ns/1.0"
+ id = "io.cordova.hellocordova"
+ version = "0.0.1">
+ <name>Hello Cordova</name>
+
+ <description>
+ A sample Apache Cordova application that responds to the deviceready event.
+ </description>
+
+ <author href="http://cordova.io" email="callback-dev@incubator.apache.org">
+ Apache Cordova Team
+ </author>
+
+ <access origin="*" />
+</widget>