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/08/12 22:55:38 UTC
git commit: [CB-3191] Support for tag in windows phone
platforms.
Updated Branches:
refs/heads/content 0dce191f7 -> 155430725
[CB-3191] Support for <content> tag in windows phone platforms.
Project: http://git-wip-us.apache.org/repos/asf/cordova-cli/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-cli/commit/15543072
Tree: http://git-wip-us.apache.org/repos/asf/cordova-cli/tree/15543072
Diff: http://git-wip-us.apache.org/repos/asf/cordova-cli/diff/15543072
Branch: refs/heads/content
Commit: 155430725a8f020dea92bbd014b919468ba4bc05
Parents: 0dce191
Author: Fil Maj <ma...@gmail.com>
Authored: Mon Aug 12 13:55:13 2013 -0700
Committer: Fil Maj <ma...@gmail.com>
Committed: Mon Aug 12 13:55:13 2013 -0700
----------------------------------------------------------------------
spec/metadata/wp7_parser.spec.js | 16 ++++++++++++----
spec/metadata/wp8_parser.spec.js | 16 ++++++++++++----
src/metadata/wp7_parser.js | 8 +++++---
src/metadata/wp8_parser.js | 6 +++++-
4 files changed, 34 insertions(+), 12 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/15543072/spec/metadata/wp7_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/wp7_parser.spec.js b/spec/metadata/wp7_parser.spec.js
index b85eac8..c7a74df 100644
--- a/spec/metadata/wp7_parser.spec.js
+++ b/spec/metadata/wp7_parser.spec.js
@@ -29,7 +29,7 @@ var platforms = require('../../platforms'),
describe('wp7 project parser', function() {
var proj = '/some/path';
- var exists, exec, custom, readdir;
+ var exists, exec, custom, readdir, cfg_parser;
beforeEach(function() {
exists = spyOn(fs, 'existsSync').andReturn(true);
exec = spyOn(shell, 'exec').andCallFake(function(cmd, opts, cb) {
@@ -37,6 +37,7 @@ describe('wp7 project parser', function() {
});
custom = spyOn(config, 'has_custom_path').andReturn(false);
readdir = spyOn(fs, 'readdirSync').andReturn(['test.csproj']);
+ cfg_parser = spyOn(util, 'config_parser');
});
describe('constructions', function() {
@@ -99,7 +100,7 @@ describe('wp7 project parser', function() {
});
describe('update_from_config method', function() {
- var et, xml, find, write_xml, root, cfg, cfg_parser, find_obj, root_obj, cfg_access_add, cfg_access_rm, cfg_pref_add, cfg_pref_rm;
+ var et, xml, find, write_xml, root, cfg, find_obj, root_obj, cfg_access_add, cfg_access_rm, cfg_pref_add, cfg_pref_rm, cfg_content;
beforeEach(function() {
find_obj = {
text:'hi',
@@ -121,6 +122,7 @@ describe('wp7 project parser', function() {
xml = spyOn(ET, 'XML');
cfg = new config_parser();
cfg.name = function() { return 'testname' };
+ cfg.content = function() { return 'index.html' };
cfg.packageName = function() { return 'testpkg' };
cfg.version = function() { return 'one point oh' };
cfg.access.get = function() { return [] };
@@ -129,18 +131,20 @@ describe('wp7 project parser', function() {
cfg_access_rm = jasmine.createSpy('config_parser access rm');
cfg_pref_rm = jasmine.createSpy('config_parser pref rm');
cfg_pref_add = jasmine.createSpy('config_parser pref add');
- cfg_parser = spyOn(util, 'config_parser').andReturn({
+ cfg_content = jasmine.createSpy('config_parser content');
+ p.config = {
access:{
remove:cfg_access_rm,
get:function(){},
add:cfg_access_add
},
+ content:cfg_content,
preference:{
remove:cfg_pref_rm,
get:function(){},
add:cfg_pref_add
}
- });
+ };
readdir.andReturn(['test.sln']);
});
@@ -156,6 +160,10 @@ describe('wp7 project parser', function() {
p.update_from_config(cfg);
expect(find_obj.attrib.Version).toEqual('one point oh');
});
+ it('should update the content element (start page)', function() {
+ p.update_from_config(cfg);
+ expect(cfg_content).toHaveBeenCalledWith('index.html');
+ });
});
describe('www_dir method', function() {
it('should return www', function() {
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/15543072/spec/metadata/wp8_parser.spec.js
----------------------------------------------------------------------
diff --git a/spec/metadata/wp8_parser.spec.js b/spec/metadata/wp8_parser.spec.js
index ff71e87..67a1c89 100644
--- a/spec/metadata/wp8_parser.spec.js
+++ b/spec/metadata/wp8_parser.spec.js
@@ -29,7 +29,7 @@ var platforms = require('../../platforms'),
describe('wp8 project parser', function() {
var proj = '/some/path';
- var exists, exec, custom, readdir;
+ var exists, exec, custom, readdir, cfg_parser;
beforeEach(function() {
exists = spyOn(fs, 'existsSync').andReturn(true);
exec = spyOn(shell, 'exec').andCallFake(function(cmd, opts, cb) {
@@ -37,6 +37,7 @@ describe('wp8 project parser', function() {
});
custom = spyOn(config, 'has_custom_path').andReturn(false);
readdir = spyOn(fs, 'readdirSync').andReturn(['test.csproj']);
+ cfg_parser = spyOn(util, 'config_parser');
});
describe('constructions', function() {
@@ -99,7 +100,7 @@ describe('wp8 project parser', function() {
});
describe('update_from_config method', function() {
- var et, xml, find, write_xml, root, cfg, cfg_parser, find_obj, root_obj, cfg_access_add, cfg_access_rm, cfg_pref_add, cfg_pref_rm;
+ var et, xml, find, write_xml, root, cfg, find_obj, root_obj, cfg_access_add, cfg_access_rm, cfg_pref_add, cfg_pref_rm, cfg_content;
beforeEach(function() {
find_obj = {
text:'hi',
@@ -121,6 +122,7 @@ describe('wp8 project parser', function() {
xml = spyOn(ET, 'XML');
cfg = new config_parser();
cfg.name = function() { return 'testname' };
+ cfg.content = function() { return 'index.html' };
cfg.packageName = function() { return 'testpkg' };
cfg.version = function() { return 'one point oh' };
cfg.access.get = function() { return [] };
@@ -129,18 +131,20 @@ describe('wp8 project parser', function() {
cfg_access_rm = jasmine.createSpy('config_parser access rm');
cfg_pref_rm = jasmine.createSpy('config_parser pref rm');
cfg_pref_add = jasmine.createSpy('config_parser pref add');
- cfg_parser = spyOn(util, 'config_parser').andReturn({
+ cfg_content = jasmine.createSpy('config_parser content');
+ p.config = {
access:{
remove:cfg_access_rm,
get:function(){},
add:cfg_access_add
},
+ content:cfg_content,
preference:{
remove:cfg_pref_rm,
get:function(){},
add:cfg_pref_add
}
- });
+ };
readdir.andReturn(['test.sln']);
});
@@ -156,6 +160,10 @@ describe('wp8 project parser', function() {
p.update_from_config(cfg);
expect(find_obj.attrib.Version).toEqual('one point oh');
});
+ it('should update the content element (start page)', function() {
+ p.update_from_config(cfg);
+ expect(cfg_content).toHaveBeenCalledWith('index.html');
+ });
});
describe('www_dir method', function() {
it('should return www', function() {
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/15543072/src/metadata/wp7_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/wp7_parser.js b/src/metadata/wp7_parser.js
index f96ed08..6c81668 100644
--- a/src/metadata/wp7_parser.js
+++ b/src/metadata/wp7_parser.js
@@ -38,6 +38,8 @@ module.exports = function wp7_parser(project) {
throw new Error('The provided path "' + project + '" is not a Windows Phone 7 project. ' + e);
}
this.manifest_path = path.join(this.wp7_proj_dir, 'Properties', 'WMAppManifest.xml');
+ this.config_path = path.join(this.wp7_proj_dir, 'config.xml');
+ this.config = new util.config_parser(this.config_path);
};
module.exports.check_requirements = function(project_root, callback) {
@@ -137,6 +139,9 @@ module.exports.prototype = {
fs.writeFileSync(path.join(this.wp7_proj_dir, 'App.xaml.cs'), appCS.replace(namespaceRegEx, 'namespace ' + pkg), 'utf-8');
}
+ // Update content (start page) element
+ this.config.content(config.content());
+
//Write out manifest
fs.writeFileSync(this.manifest_path, manifest.write({indent: 4}), 'utf-8');
},
@@ -144,9 +149,6 @@ module.exports.prototype = {
www_dir:function() {
return path.join(this.wp7_proj_dir, 'www');
},
- config_xml:function() {
- return path.join(this.wp7_proj_dir, 'config.xml');
- },
// copies the app www folder into the wp7 project's www folder and updates the csproj file.
update_www:function() {
var project_root = util.isCordova(this.wp7_proj_dir);
http://git-wip-us.apache.org/repos/asf/cordova-cli/blob/15543072/src/metadata/wp8_parser.js
----------------------------------------------------------------------
diff --git a/src/metadata/wp8_parser.js b/src/metadata/wp8_parser.js
index d41328a..00797b7 100644
--- a/src/metadata/wp8_parser.js
+++ b/src/metadata/wp8_parser.js
@@ -38,6 +38,8 @@ module.exports = function wp8_parser(project) {
throw new Error('The provided path "' + project + '" is not a Windows Phone 8 project. ' + e);
}
this.manifest_path = path.join(this.wp8_proj_dir, 'Properties', 'WMAppManifest.xml');
+ this.config_path = path.join(this.wp8_proj_dir, 'config.xml');
+ this.config = new util.config_parser(this.config_path);
};
module.exports.check_requirements = function(project_root, callback) {
@@ -138,6 +140,9 @@ module.exports.prototype = {
fs.writeFileSync(path.join(this.wp8_proj_dir, 'App.xaml.cs'), appCS.replace(namespaceRegEx, 'namespace ' + pkg), 'utf-8');
}
+ // Update content (start page) element
+ this.config.content(config.content());
+
//Write out manifest
fs.writeFileSync(this.manifest_path, manifest.write({indent: 4}), 'utf-8');
},
@@ -146,7 +151,6 @@ module.exports.prototype = {
return path.join(this.wp8_proj_dir, 'www');
},
config_xml:function() {
- return path.join(this.wp8_proj_dir, 'config.xml');
},
// copies the app www folder into the wp8 project's www folder and updates the csproj file.
update_www:function() {