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/14 19:31:48 UTC
[79/83] [abbrv] git commit: [CB-3793] `cordova help` produced no
output. also disabled wp7 parser specs atm
[CB-3793] `cordova help` produced no output. also disabled wp7 parser specs atm
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/c56c0b90
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/c56c0b90
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/c56c0b90
Branch: refs/heads/lazy
Commit: c56c0b90b32e1a1f83433efb54b4bd21fbffdfd9
Parents: 1546bf4
Author: Fil Maj <ma...@gmail.com>
Authored: Thu Jun 13 11:46:20 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Thu Jun 13 11:46:20 2013 -0700
----------------------------------------------------------------------
spec/create.spec.js | 11 +++++++++--
spec/help.spec.js | 14 ++++++++++++++
spec/metadata/wp7_parser.spec.js | 23 +++--------------------
src/help.js | 5 +++--
4 files changed, 29 insertions(+), 24 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/c56c0b90/spec/create.spec.js
----------------------------------------------------------------------
diff --git a/spec/create.spec.js b/spec/create.spec.js
index 4fa4e23..89ebfce 100644
--- a/spec/create.spec.js
+++ b/spec/create.spec.js
@@ -31,8 +31,15 @@ describe('create command', function () {
});
describe('failure', function() {
- it('should return a help message if incorrect number of parameters is used', function() {
- expect(cordova.create()).toMatch(/synopsis/gi);
+ it('should return a help message if incorrect number of parameters is used', function(done) {
+ this.after(function() {
+ cordova.removeAllListeners('results');
+ });
+ cordova.on('results', function(h) {
+ expect(h).toMatch(/synopsis/gi);
+ done();
+ });
+ cordova.create();
});
});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/c56c0b90/spec/help.spec.js
----------------------------------------------------------------------
diff --git a/spec/help.spec.js b/spec/help.spec.js
new file mode 100644
index 0000000..3ed4181
--- /dev/null
+++ b/spec/help.spec.js
@@ -0,0 +1,14 @@
+var cordova = require('../cordova');
+
+describe('help command', function() {
+ it('should emit a results event with help contents', function(done) {
+ this.after(function() {
+ cordova.removeAllListeners('results');
+ });
+ cordova.on('results', function(h) {
+ expect(h).toMatch(/synopsis/gi);
+ done();
+ });
+ cordova.help();
+ });
+});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/c56c0b90/spec/metadata/wp7_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/wp7_parser.spec.js b/spec/metadata/wp7_parser.spec.js
index 61111a1..f6c8aef 100644
--- a/spec/metadata/wp7_parser.spec.js
+++ b/spec/metadata/wp7_parser.spec.js
@@ -1,4 +1,3 @@
-
/**
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
@@ -17,24 +16,8 @@
specific language governing permissions and limitations
under the License.
*/
-var wp7_parser = require('../../../src/metadata/wp7_parser'),
- config_parser = require('../../../src/config_parser'),
- util = require('../../../src/util'),
- path = require('path'),
- shell = require('shelljs'),
- fs = require('fs'),
- os = require('os'),
- et = require('elementtree'),
- cordova = require('../../../cordova'),
- projects_path = path.join(__dirname, '..', '..', 'fixtures', 'projects'),
- wp7_path = path.join(projects_path, 'native', 'wp7_fixture'),
- project_path = path.join(projects_path, 'cordova'),
- wp7_project_path = path.join(project_path, 'platforms', 'wp7');
-
-var www_config = util.projectConfig(project_path);
-var original_www_config = fs.readFileSync(www_config, 'utf-8');
-
-describe('wp7 project parser', function() {
+
+xdescribe('wp7 project parser', function() {
it('should throw an exception with a path that is not a native wp7 project', function() {
expect(function() {
var project = new wp7_parser(process.cwd());
@@ -244,4 +227,4 @@ describe('wp7 project parser', function() {
});
});
});
-});
\ No newline at end of file
+});
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/c56c0b90/src/help.js
----------------------------------------------------------------------
diff --git a/src/help.js b/src/help.js
index abd0f3e..d88711f 100644
--- a/src/help.js
+++ b/src/help.js
@@ -18,11 +18,12 @@
*/
var fs = require('fs'),
colors = require('colors'),
+ events = require('./events'),
path = require('path');
module.exports = function help () {
var raw = fs.readFileSync(path.join(__dirname, '..', 'doc', 'help.txt')).toString('utf8').split("\n");
- return raw.map(function(line) {
+ events.emit('results', raw.map(function(line) {
if (line.match(' ')) {
var prompt = ' $ ',
isPromptLine = !(!(line.indexOf(prompt) != -1));
@@ -43,5 +44,5 @@ module.exports = function help () {
else {
return line.magenta;
}
- }).join("\n");
+ }).join("\n"));
};