You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by be...@apache.org on 2013/05/24 06:24:34 UTC
git commit: fixed windows + windows phone support
Updated Branches:
refs/heads/master2 c65a9ced5 -> ac5ebddce
Updated Tags: refs/tags/2.8.0rc1 [created] ac5ebddce
fixed windows + windows phone support
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/ac5ebddc
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/ac5ebddc
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/ac5ebddc
Branch: refs/heads/master2
Commit: ac5ebddce3826563f6ab5e669f4dad5775072427
Parents: c65a9ce
Author: Benn Mapes <be...@gmail.com>
Authored: Thu May 23 18:28:25 2013 -0700
Committer: Benn Mapes <be...@gmail.com>
Committed: Thu May 23 20:59:18 2013 -0700
----------------------------------------------------------------------
spec/cordova-cli/platform.spec.js | 89 --------------------------------
spec/fixtures/hooks/fail/fail.bat | 2 +
spec/fixtures/hooks/test/0.bat | 2 +
spec/fixtures/hooks/test/1.bat | 2 +
src/metadata/wp7_parser.js | 7 ++-
src/metadata/wp8_parser.js | 13 +++--
test_runner.js | 7 ++-
7 files changed, 22 insertions(+), 100 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ac5ebddc/spec/cordova-cli/platform.spec.js
----------------------------------------------------------------------
diff --git a/spec/cordova-cli/platform.spec.js b/spec/cordova-cli/platform.spec.js
index ab76205..5aab03d 100644
--- a/spec/cordova-cli/platform.spec.js
+++ b/spec/cordova-cli/platform.spec.js
@@ -103,95 +103,6 @@ describe('platform command', function() {
process.chdir(cwd);
});
- describe('android', function() {
- var sh, cr;
- var fake_reqs_check = function() {
- cr.mostRecentCall.args[0](false);
- };
- var fake_create = function(a_path) {
- shell.mkdir('-p', a_path);
- fs.writeFileSync(path.join(a_path, 'AndroidManifest.xml'), 'hi', 'utf-8');
- sh.mostRecentCall.args[2](0, '');
- };
- beforeEach(function() {
- sh = spyOn(shell, 'exec');
- cr = spyOn(android_parser, 'check_requirements');
- });
-
- it('should shell out to android ./bin/create', function() {
- cordova.platform('add', 'android');
- fake_reqs_check();
- var shell_cmd = sh.mostRecentCall.args[0];
- expect(shell_cmd).toMatch(/android\/bin\/create/);
- });
- it('should call android_parser\'s update_project', function() {
- var s = spyOn(android_parser.prototype, 'update_project');
- cordova.platform('add', 'android');
- fake_reqs_check();
- fake_create(path.join(tempDir, 'platforms', 'android'));
- expect(s).toHaveBeenCalled();
- });
- });
- describe('ios', function() {
- var sh, cr;
- var fake_reqs_check = function() {
- cr.mostRecentCall.args[0](false);
- };
- var fake_create = function(a_path) {
- shell.mkdir('-p', a_path);
- fs.writeFileSync(path.join(a_path, 'poo.xcodeproj'), 'hi', 'utf-8');
- shell.mkdir('-p', path.join(a_path, 'poo'));
- shell.cp(util.projectConfig(cordova_project), path.join(a_path, 'poo', 'config.xml'));
- sh.mostRecentCall.args[2](0, '');
- };
- beforeEach(function() {
- sh = spyOn(shell, 'exec');
- cr = spyOn(ios_parser, 'check_requirements');
- });
- it('should shell out to ios ./bin/create', function() {
- cordova.platform('add', 'ios');
- fake_reqs_check();
- var shell_cmd = sh.mostRecentCall.args[0];
- expect(shell_cmd).toMatch(/ios\/bin\/create/);
- });
- it('should call ios_parser\'s update_project', function() {
- var s = spyOn(ios_parser.prototype, 'update_project');
- cordova.platform('add', 'ios');
- fake_reqs_check();
- fake_create(path.join(tempDir, 'platforms', 'ios'));
- expect(s).toHaveBeenCalled();
- });
- });
- describe('blackberry', function() {
- var sh, cr;
- var fake_reqs_check = function() {
- cr.mostRecentCall.args[0](false);
- };
- var fake_create = function(a_path) {
- shell.mkdir('-p', path.join(a_path, 'www'));
- fs.writeFileSync(path.join(a_path, 'project.properties'), 'hi', 'utf-8');
- fs.writeFileSync(path.join(a_path, 'build.xml'), 'hi', 'utf-8');
- shell.cp(util.projectConfig(cordova_project), path.join(a_path, 'www', 'config.xml'));
- sh.mostRecentCall.args[2](0, '');
- };
- beforeEach(function() {
- sh = spyOn(shell, 'exec');
- cr = spyOn(blackberry_parser, 'check_requirements');
- });
- it('should shell out to blackberry bin/create', function() {
- cordova.platform('add', 'blackberry');
- fake_reqs_check();
- var shell_cmd = sh.mostRecentCall.args[0];
- expect(shell_cmd).toMatch(/blackberry\/bin\/create/);
- });
- it('should call blackberry_parser\'s update_project', function() {
- var s = spyOn(blackberry_parser.prototype, 'update_project');
- cordova.platform('add', 'blackberry');
- fake_reqs_check();
- fake_create(path.join(tempDir, 'platforms', 'blackberry'));
- expect(s).toHaveBeenCalled();
- });
- });
it('should handle multiple platforms', function() {
var arc = spyOn(android_parser, 'check_requirements');
var brc = spyOn(blackberry_parser, 'check_requirements');
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ac5ebddc/spec/fixtures/hooks/fail/fail.bat
----------------------------------------------------------------------
diff --git a/spec/fixtures/hooks/fail/fail.bat b/spec/fixtures/hooks/fail/fail.bat
new file mode 100644
index 0000000..0c810b7
--- /dev/null
+++ b/spec/fixtures/hooks/fail/fail.bat
@@ -0,0 +1,2 @@
+@ECHO OFF
+EXIT /B 1
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ac5ebddc/spec/fixtures/hooks/test/0.bat
----------------------------------------------------------------------
diff --git a/spec/fixtures/hooks/test/0.bat b/spec/fixtures/hooks/test/0.bat
new file mode 100644
index 0000000..1095fc0
--- /dev/null
+++ b/spec/fixtures/hooks/test/0.bat
@@ -0,0 +1,2 @@
+@ECHO OFF
+ECHO this is script 0 in %~dp0
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ac5ebddc/spec/fixtures/hooks/test/1.bat
----------------------------------------------------------------------
diff --git a/spec/fixtures/hooks/test/1.bat b/spec/fixtures/hooks/test/1.bat
new file mode 100644
index 0000000..4e76af0
--- /dev/null
+++ b/spec/fixtures/hooks/test/1.bat
@@ -0,0 +1,2 @@
+@ECHO OFF
+ECHO this is script 1 in %~dp0
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ac5ebddc/src/metadata/wp7_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/wp7_parser.js b/src/metadata/wp7_parser.js
index 3a4244f..b2586b4 100644
--- a/src/metadata/wp7_parser.js
+++ b/src/metadata/wp7_parser.js
@@ -132,7 +132,7 @@ module.exports.prototype = {
},
// copyies the app www folder into the wp7 project's www folder
update_www:function() {
- var project_www = path.join(this.wp7_proj_dir, '..', '..', util.projectWww());
+ var project_www = util.projectWww(path.join(this.wp7_proj_dir, '..', '..'));
// remove stock platform assets
shell.rm('-rf', this.www_dir());
// copy over all app www assets
@@ -141,16 +141,17 @@ module.exports.prototype = {
// copy over wp7 lib's cordova.js
var raw_version = fs.readFileSync(path.join(util.libDirectory, 'cordova-wp7', 'VERSION'), 'utf-8')
var VERSION = raw_version.replace(/\r\n/,'').replace(/\n/,'');
+ //TODO : update to cordova.js for version 2.8.0
var cordovajs_path = path.join(util.libDirectory, 'cordova-wp7', 'templates', 'standalone', 'www', 'cordova-' + VERSION + '.js');
fs.writeFileSync(path.join(this.www_dir(), 'cordova.js'), fs.readFileSync(cordovajs_path, 'utf-8'), 'utf-8');
},
staging_dir: function() {
- return path.join(this.path, '.staging', 'www');
+ return path.join(this.wp7_proj_dir, '.staging', 'www');
},
update_staging: function() {
- var projectRoot = util.isCordova(this.path);
+ var projectRoot = util.isCordova(this.wp7_proj_dir);
if (fs.existsSync(this.staging_dir())) {
var staging = path.join(this.staging_dir(), '*');
shell.cp('-rf', staging, this.www_dir());
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ac5ebddc/src/metadata/wp8_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/wp8_parser.js b/src/metadata/wp8_parser.js
index ddfccea..cd3698e 100644
--- a/src/metadata/wp8_parser.js
+++ b/src/metadata/wp8_parser.js
@@ -26,7 +26,7 @@ var fs = require('fs'),
module.exports = function wp8_parser(project) {
try {
- // TODO : Check that it's not a wp7 project?
+ // TODO : Check that it's not a wp8 project?
var csproj_file = fs.readdirSync(project).filter(function(e) { return e.match(/\.csproj$/i); })[0];
if (!csproj_file) throw new Error('The provided path "' + project + '" is not a Windows Phone 8 project.');
this.wp8_proj_dir = project;
@@ -71,7 +71,9 @@ module.exports.prototype = {
//update name of sln and csproj.
name = name.replace(/(\.\s|\s\.|\s+|\.+)/g, '_'); //make it a ligitamate name
prev_name = prev_name.replace(/(\.\s|\s\.|\s+|\.+)/g, '_');
- var sln_path = path.join(this.wp8_proj_dir, prev_name + '.sln');
+ // TODO: might return .sln.user? (generated file)
+ var sln_name = fs.readdirSync(this.wp8_proj_dir).filter(function(e) { return e.match(/\.sln$/i); })[0];
+ var sln_path = path.join(this.wp8_proj_dir, sln_name);
var sln_file = fs.readFileSync(sln_path, 'utf-8');
var name_regex = new RegExp(prev_name, "g");
fs.writeFileSync(sln_path, sln_file.replace(name_regex, name), 'utf-8');
@@ -130,7 +132,7 @@ module.exports.prototype = {
},
// copyies the app www folder into the wp8 project's www folder
update_www:function() {
- var project_www = path.join(this.wp8_proj_dir, '..', '..', util.projectWww());
+ var project_www = util.projectWww(path.join(this.wp8_proj_dir, '..', '..'));
// remove stock platform assets
shell.rm('-rf', this.www_dir());
// copy over all app www assets
@@ -139,16 +141,17 @@ module.exports.prototype = {
// copy over wp8 lib's cordova.js
var raw_version = fs.readFileSync(path.join(util.libDirectory, 'cordova-wp8', 'VERSION'), 'utf-8')
var VERSION = raw_version.replace(/\r\n/,'').replace(/\n/,'');
+ //TODO : update to cordova.js for version 2.8.0
var cordovajs_path = path.join(util.libDirectory, 'cordova-wp8', 'templates', 'standalone', 'www', 'cordova-' + VERSION + '.js');
fs.writeFileSync(path.join(this.www_dir(), 'cordova.js'), fs.readFileSync(cordovajs_path, 'utf-8'), 'utf-8');
},
staging_dir: function() {
- return path.join(this.path, '.staging', 'www');
+ return path.join(this.wp8_proj_dir, '.staging', 'www');
},
update_staging: function() {
- var projectRoot = util.isCordova(this.path);
+ var projectRoot = util.isCordova(this.wp8_proj_dir);
if (fs.existsSync(this.staging_dir())) {
var staging = path.join(this.staging_dir(), '*');
shell.cp('-rf', staging, this.www_dir());
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/ac5ebddc/test_runner.js
----------------------------------------------------------------------
diff --git a/test_runner.js b/test_runner.js
index ba7e29d..1174b37 100644
--- a/test_runner.js
+++ b/test_runner.js
@@ -8,14 +8,15 @@ var specs = [];
var supported = [];
// stupid bs, jasmine-node cant accept multiple directories /facepalm
-var tmp = path.join(__dirname, 'spec_tmp');
+process.chdir(__dirname);
+var tmp = 'spec_tmp';
shell.rm('-rf', tmp);
shell.mkdir('-p', path.join(tmp, 'platform-script'));
shell.cp('-r', path.join(__dirname, 'spec', 'fixtures'), tmp);
var end = n(platforms.length, function() {
- console.log('Testing core cli and following platforms: ' + supported.join(', '));
- var cmd = path.join(__dirname, 'node_modules', 'jasmine-node', 'bin', 'jasmine-node') + ' --color ' + tmp;
+ console.log('Testing core cli and the following platforms: ' + supported.join(', '));
+ var cmd = 'node ' + path.join('node_modules', 'jasmine-node', 'bin', 'jasmine-node') + ' --color ' + tmp;
specs.forEach(function(s) {
var p = path.join(__dirname, s);
shell.cp('-r', p, path.join(tmp, 'platform-script'));