You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by au...@apache.org on 2017/07/14 23:45:18 UTC
[1/5] ios commit: CB-12895 : removed jshint and added eslint
Repository: cordova-ios
Updated Branches:
refs/heads/master 26beb94e2 -> 83435d56d
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/prepare.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/prepare.spec.js b/tests/spec/unit/prepare.spec.js
index fadf638..8bd8db2 100644
--- a/tests/spec/unit/prepare.spec.js
+++ b/tests/spec/unit/prepare.spec.js
@@ -45,22 +45,21 @@ var ConfigParser = require('cordova-common').ConfigParser;
var cfg = new ConfigParser(path.join(FIXTURES, 'test-config.xml'));
var cfg2 = new ConfigParser(path.join(FIXTURES, 'test-config-2.xml'));
-
-function wrapper(p, done, post) {
- p.then(post, function(err) {
+function wrapper (p, done, post) {
+ p.then(post, function (err) {
expect(err.stack).toBeUndefined();
}).fin(done);
}
-function wrapperError(p, done, post) {
- p.then(post, function(err) {
+function wrapperError (p, done, post) {
+ p.then(post, function (err) {
expect(err.stack).toBeDefined();
}).fin(done);
}
-describe('prepare', function() {
+describe('prepare', function () {
var p;
- beforeEach(function() {
+ beforeEach(function () {
shell.mkdir('-p', iosPlatform);
shell.cp('-rf', iosProjectFixture + '/*', iosPlatform);
p = new Api('ios', iosPlatform, new EventEmitter());
@@ -70,8 +69,8 @@ describe('prepare', function() {
shell.rm('-rf', path.join(__dirname, 'some'));
});
- describe('launch storyboard feature (CB-9762)', function() {
- function makeSplashScreenEntry(src, width, height) {
+ describe('launch storyboard feature (CB-9762)', function () {
+ function makeSplashScreenEntry (src, width, height) {
return {
src: src,
width: width,
@@ -109,41 +108,41 @@ describe('prepare', function() {
makeSplashScreenEntry('res/splash/ios/Default@3x~iphone~comany.png')
];
- describe('#mapLaunchStoryboardContents', function() {
+ describe('#mapLaunchStoryboardContents', function () {
var mapLaunchStoryboardContents = prepare.__get__('mapLaunchStoryboardContents');
- it('should return an array with no mapped storyboard images', function() {
+ it('should return an array with no mapped storyboard images', function () {
var result = mapLaunchStoryboardContents(noLaunchStoryboardImages, '');
expect(result).toBeDefined();
expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-map/empty-map'));
});
- it('should return an array with one mapped storyboard image', function() {
+ it('should return an array with one mapped storyboard image', function () {
var result = mapLaunchStoryboardContents(singleLaunchStoryboardImage, '');
expect(result).toBeDefined();
expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-map/single-2xanyany-map'));
});
- it('should return an array with one mapped storyboard image, even with legacy images', function() {
+ it('should return an array with one mapped storyboard image, even with legacy images', function () {
var result = mapLaunchStoryboardContents(singleLaunchStoryboardImageWithLegacyLaunchImage, '');
expect(result).toBeDefined();
expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-map/single-2xanyany-map'));
});
- it('should return an array with several mapped storyboard images', function() {
+ it('should return an array with several mapped storyboard images', function () {
var result = mapLaunchStoryboardContents(typicalLaunchStoryboardImages, '');
expect(result).toBeDefined();
expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-map/typical-universal-map'));
});
- it('should return an array with several mapped storyboard images across device classes', function() {
+ it('should return an array with several mapped storyboard images across device classes', function () {
var result = mapLaunchStoryboardContents(multiDeviceLaunchStoryboardImages, '');
expect(result).toBeDefined();
expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-map/varied-device-map'));
});
});
- describe('#mapLaunchStoryboardResources', function() {
+ describe('#mapLaunchStoryboardResources', function () {
var mapLaunchStoryboardResources = prepare.__get__('mapLaunchStoryboardResources');
it('should return an empty object with no mapped storyboard images', function () {
@@ -152,53 +151,53 @@ describe('prepare', function() {
expect(result).toEqual({});
});
- it('should return an object with one mapped storyboard image', function() {
+ it('should return an object with one mapped storyboard image', function () {
var result = mapLaunchStoryboardResources(singleLaunchStoryboardImage, '');
expect(result).toBeDefined();
expect(result).toEqual({
- 'Default@2x~universal~anyany.png' : 'res/splash/ios/Default@2x~universal~anyany.png'
+ 'Default@2x~universal~anyany.png': 'res/splash/ios/Default@2x~universal~anyany.png'
});
});
- it('should return an object with one mapped storyboard image, even with legacy images', function() {
+ it('should return an object with one mapped storyboard image, even with legacy images', function () {
var result = mapLaunchStoryboardResources(singleLaunchStoryboardImageWithLegacyLaunchImage, '');
expect(result).toBeDefined();
expect(result).toEqual({
- 'Default@2x~universal~anyany.png' : 'res/splash/ios/Default@2x~universal~anyany.png'
+ 'Default@2x~universal~anyany.png': 'res/splash/ios/Default@2x~universal~anyany.png'
});
});
- it('should return an object with several mapped storyboard images', function() {
+ it('should return an object with several mapped storyboard images', function () {
var result = mapLaunchStoryboardResources(typicalLaunchStoryboardImages, '');
expect(result).toBeDefined();
expect(result).toEqual({
- 'Default@2x~universal~anyany.png' : 'res/splash/ios/Default@2x~universal~anyany.png',
- 'Default@2x~universal~comany.png' : 'res/splash/ios/Default@2x~universal~comany.png',
- 'Default@2x~universal~comcom.png' : 'res/splash/ios/Default@2x~universal~comcom.png',
- 'Default@3x~universal~anyany.png' : 'res/splash/ios/Default@3x~universal~anyany.png',
- 'Default@3x~universal~anycom.png' : 'res/splash/ios/Default@3x~universal~anycom.png',
- 'Default@3x~universal~comany.png' : 'res/splash/ios/Default@3x~universal~comany.png'
+ 'Default@2x~universal~anyany.png': 'res/splash/ios/Default@2x~universal~anyany.png',
+ 'Default@2x~universal~comany.png': 'res/splash/ios/Default@2x~universal~comany.png',
+ 'Default@2x~universal~comcom.png': 'res/splash/ios/Default@2x~universal~comcom.png',
+ 'Default@3x~universal~anyany.png': 'res/splash/ios/Default@3x~universal~anyany.png',
+ 'Default@3x~universal~anycom.png': 'res/splash/ios/Default@3x~universal~anycom.png',
+ 'Default@3x~universal~comany.png': 'res/splash/ios/Default@3x~universal~comany.png'
});
});
- it('should return an object with several mapped storyboard images across device classes', function() {
+ it('should return an object with several mapped storyboard images across device classes', function () {
var result = mapLaunchStoryboardResources(multiDeviceLaunchStoryboardImages, '');
expect(result).toBeDefined();
expect(result).toEqual({
- 'Default@2x~universal~anyany.png' : 'res/splash/ios/Default@2x~universal~anyany.png',
- 'Default@2x~universal~comany.png' : 'res/splash/ios/Default@2x~universal~comany.png',
- 'Default@2x~universal~comcom.png' : 'res/splash/ios/Default@2x~universal~comcom.png',
- 'Default@2x~ipad~anyany.png' : 'res/splash/ios/Default@2x~ipad~anyany.png',
- 'Default@2x~ipad~comany.png' : 'res/splash/ios/Default@2x~ipad~comany.png',
- 'Default@2x~ipad~comcom.png' : 'res/splash/ios/Default@2x~ipad~comcom.png',
- 'Default@3x~iphone~anyany.png' : 'res/splash/ios/Default@3x~iphone~anyany.png',
- 'Default@3x~iphone~anycom.png' : 'res/splash/ios/Default@3x~iphone~anycom.png',
- 'Default@3x~iphone~comany.png' : 'res/splash/ios/Default@3x~iphone~comany.png'
+ 'Default@2x~universal~anyany.png': 'res/splash/ios/Default@2x~universal~anyany.png',
+ 'Default@2x~universal~comany.png': 'res/splash/ios/Default@2x~universal~comany.png',
+ 'Default@2x~universal~comcom.png': 'res/splash/ios/Default@2x~universal~comcom.png',
+ 'Default@2x~ipad~anyany.png': 'res/splash/ios/Default@2x~ipad~anyany.png',
+ 'Default@2x~ipad~comany.png': 'res/splash/ios/Default@2x~ipad~comany.png',
+ 'Default@2x~ipad~comcom.png': 'res/splash/ios/Default@2x~ipad~comcom.png',
+ 'Default@3x~iphone~anyany.png': 'res/splash/ios/Default@3x~iphone~anyany.png',
+ 'Default@3x~iphone~anycom.png': 'res/splash/ios/Default@3x~iphone~anycom.png',
+ 'Default@3x~iphone~comany.png': 'res/splash/ios/Default@3x~iphone~comany.png'
});
});
});
- describe('#getLaunchStoryboardContentsJSON', function() {
+ describe('#getLaunchStoryboardContentsJSON', function () {
var getLaunchStoryboardContentsJSON = prepare.__get__('getLaunchStoryboardContentsJSON');
it('should return contents.json with no mapped storyboard images', function () {
@@ -207,36 +206,36 @@ describe('prepare', function() {
expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-json/empty'));
});
- it('should return contents.json with one mapped storyboard image', function() {
+ it('should return contents.json with one mapped storyboard image', function () {
var result = getLaunchStoryboardContentsJSON(singleLaunchStoryboardImage, '');
expect(result).toBeDefined();
expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-json/single-2xanyany'));
});
- it('should return contents.json with one mapped storyboard image, even with legacy images', function() {
+ it('should return contents.json with one mapped storyboard image, even with legacy images', function () {
var result = getLaunchStoryboardContentsJSON(singleLaunchStoryboardImageWithLegacyLaunchImage, '');
expect(result).toBeDefined();
expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-json/single-2xanyany'));
});
- it('should return contents.json with several mapped storyboard images', function() {
+ it('should return contents.json with several mapped storyboard images', function () {
var result = getLaunchStoryboardContentsJSON(typicalLaunchStoryboardImages, '');
expect(result).toBeDefined();
expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-json/typical-universal'));
});
- it('should return contents.json with several mapped storyboard images across device classes', function() {
+ it('should return contents.json with several mapped storyboard images across device classes', function () {
var result = getLaunchStoryboardContentsJSON(multiDeviceLaunchStoryboardImages, '');
expect(result).toBeDefined();
expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-json/varied-device'));
});
});
- describe('#getLaunchStoryboardImagesDir', function() {
+ describe('#getLaunchStoryboardImagesDir', function () {
var getLaunchStoryboardImagesDir = prepare.__get__('getLaunchStoryboardImagesDir');
var projectRoot = iosProject;
- it('should find the Images.xcassets file in a project with an asset catalog', function() {
+ it('should find the Images.xcassets file in a project with an asset catalog', function () {
var platformProjDir = path.join('platforms', 'ios', 'SampleApp');
var assetCatalogPath = path.join(iosProject, platformProjDir, 'Images.xcassets');
var expectedPath = path.join(platformProjDir, 'Images.xcassets', 'LaunchStoryboard.imageset/');
@@ -248,7 +247,7 @@ describe('prepare', function() {
expect(returnPath).toEqual(expectedPath);
});
- it('should NOT find the Images.xcassets file in a project with no asset catalog', function() {
+ it('should NOT find the Images.xcassets file in a project with no asset catalog', function () {
var platformProjDir = path.join('platforms', 'ios', 'SamplerApp');
var assetCatalogPath = path.join(iosProject, platformProjDir, 'Images.xcassets');
@@ -260,55 +259,55 @@ describe('prepare', function() {
});
});
- describe ('#platformHasLaunchStoryboardImages', function() {
+ describe('#platformHasLaunchStoryboardImages', function () {
var platformHasLaunchStoryboardImages = prepare.__get__('platformHasLaunchStoryboardImages');
- var cfgs = ['none', 'legacy-only', 'modern-only', 'modern-and-legacy'].reduce(function (p,c) {
+ var cfgs = ['none', 'legacy-only', 'modern-only', 'modern-and-legacy'].reduce(function (p, c) {
p[c] = new ConfigParser(path.join(FIXTURES, 'launch-storyboard-support', 'configs', c + '.xml'));
return p;
}, {});
- it('should be false with no launch images', function() {
+ it('should be false with no launch images', function () {
expect(platformHasLaunchStoryboardImages(cfgs.none)).toEqual(false);
});
- it('should be false with only legacy images', function() {
+ it('should be false with only legacy images', function () {
expect(platformHasLaunchStoryboardImages(cfgs['legacy-only'])).toEqual(false);
});
- it('should be true with typical launch storyboard images', function() {
+ it('should be true with typical launch storyboard images', function () {
expect(platformHasLaunchStoryboardImages(cfgs['modern-only'])).toEqual(true);
});
- it('should be true with typical and legacy launch storyboard images', function() {
+ it('should be true with typical and legacy launch storyboard images', function () {
expect(platformHasLaunchStoryboardImages(cfgs['modern-and-legacy'])).toEqual(true);
});
});
- describe ('#platformHasLegacyLaunchImages', function() {
+ describe('#platformHasLegacyLaunchImages', function () {
var platformHasLegacyLaunchImages = prepare.__get__('platformHasLegacyLaunchImages');
- var cfgs = ['none', 'legacy-only', 'modern-only', 'modern-and-legacy'].reduce(function (p,c) {
+ var cfgs = ['none', 'legacy-only', 'modern-only', 'modern-and-legacy'].reduce(function (p, c) {
p[c] = new ConfigParser(path.join(FIXTURES, 'launch-storyboard-support', 'configs', c + '.xml'));
return p;
}, {});
- it('should be false with no launch images', function() {
+ it('should be false with no launch images', function () {
expect(platformHasLegacyLaunchImages(cfgs.none)).toEqual(false);
});
- it('should be true with only legacy images', function() {
+ it('should be true with only legacy images', function () {
expect(platformHasLegacyLaunchImages(cfgs['legacy-only'])).toEqual(true);
});
- it('should be false with typical launch storyboard images', function() {
+ it('should be false with typical launch storyboard images', function () {
expect(platformHasLegacyLaunchImages(cfgs['modern-only'])).toEqual(false);
});
- it('should be true with typical and legacy launch storyboard images', function() {
+ it('should be true with typical and legacy launch storyboard images', function () {
expect(platformHasLegacyLaunchImages(cfgs['modern-and-legacy'])).toEqual(true);
});
});
- describe('#updateProjectPlistForLaunchStoryboard', function() {
+ describe('#updateProjectPlistForLaunchStoryboard', function () {
var updateProjectPlistForLaunchStoryboard = prepare.__get__('updateProjectPlistForLaunchStoryboard');
var plistFile = path.join(iosPlatform, 'SampleApp', 'SampleApp-Info.plist');
var cfgs;
it('setup', function () {
- cfgs = ['none', 'legacy-only', 'modern-only', 'modern-and-legacy'].reduce(function (p,c) {
+ cfgs = ['none', 'legacy-only', 'modern-only', 'modern-and-legacy'].reduce(function (p, c) {
p[c] = {
config: new ConfigParser(path.join(FIXTURES, 'launch-storyboard-support', 'configs', c + '.xml')),
plist: plist.parse(fs.readFileSync(plistFile, 'utf8'))
@@ -317,39 +316,39 @@ describe('prepare', function() {
}, {});
});
- it('should not change the info plist when no launch images are supplied', function() {
+ it('should not change the info plist when no launch images are supplied', function () {
var plist = cfgs.none.plist;
updateProjectPlistForLaunchStoryboard(cfgs.none.config, plist);
expect(plist.UILaunchStoryboardName).toBeUndefined();
});
- it('should not change the info plist when only legacy launch images are supplied', function() {
+ it('should not change the info plist when only legacy launch images are supplied', function () {
var plist = cfgs['legacy-only'].plist;
updateProjectPlistForLaunchStoryboard(cfgs['legacy-only'].config, plist);
expect(plist.UILaunchStoryboardName).toBeUndefined();
});
- it('should change the info plist when only modern launch images are supplied', function() {
+ it('should change the info plist when only modern launch images are supplied', function () {
var plist = cfgs['modern-only'].plist;
updateProjectPlistForLaunchStoryboard(cfgs['modern-only'].config, plist);
expect(plist.UILaunchStoryboardName).toEqual('CDVLaunchScreen');
});
- it('should change the info plist when both legacy and modern launch images are supplied', function() {
+ it('should change the info plist when both legacy and modern launch images are supplied', function () {
var plist = cfgs['modern-and-legacy'].plist;
updateProjectPlistForLaunchStoryboard(cfgs['modern-and-legacy'].config, plist);
expect(plist.UILaunchStoryboardName).toEqual('CDVLaunchScreen');
});
- it('should remove the setting when no launch images are supplied but storyboard setting configured', function() {
+ it('should remove the setting when no launch images are supplied but storyboard setting configured', function () {
var plist = cfgs.none.plist;
plist.UILaunchStoryboardName = 'CDVLaunchScreen';
updateProjectPlistForLaunchStoryboard(cfgs.none.config, plist);
expect(plist.UILaunchStoryboardName).toBeUndefined();
});
- it('should remove the setting when only legacy images are supplied but storyboard setting configured', function() {
+ it('should remove the setting when only legacy images are supplied but storyboard setting configured', function () {
var plist = cfgs['legacy-only'].plist;
plist.UILaunchStoryboardName = 'CDVLaunchScreen';
updateProjectPlistForLaunchStoryboard(cfgs['legacy-only'].config, plist);
expect(plist.UILaunchStoryboardName).toBeUndefined();
});
- it('should maintain the launch storyboard setting over multiple calls when modern images supplied', function() {
+ it('should maintain the launch storyboard setting over multiple calls when modern images supplied', function () {
var plist = cfgs['modern-only'].plist;
delete plist.UILaunchStoryboardName;
updateProjectPlistForLaunchStoryboard(cfgs['modern-and-legacy'].config, plist);
@@ -357,7 +356,7 @@ describe('prepare', function() {
updateProjectPlistForLaunchStoryboard(cfgs['modern-and-legacy'].config, plist);
expect(plist.UILaunchStoryboardName).toEqual('CDVLaunchScreen');
});
- it('should not attempt to override launch storyboard setting if not set to our storyboard', function() {
+ it('should not attempt to override launch storyboard setting if not set to our storyboard', function () {
var plist = cfgs['modern-and-legacy'].plist;
plist.UILaunchStoryboardName = 'AnotherStoryboard';
updateProjectPlistForLaunchStoryboard(cfgs['modern-and-legacy'].config, plist);
@@ -366,12 +365,12 @@ describe('prepare', function() {
});
- describe ('#updateLaunchStoryboardImages', function() {
+ describe('#updateLaunchStoryboardImages', function () {
var getLaunchStoryboardImagesDir = prepare.__get__('getLaunchStoryboardImagesDir');
var updateLaunchStoryboardImages = prepare.__get__('updateLaunchStoryboardImages');
var logFileOp = prepare.__get__('logFileOp');
- it('should clean storyboard launch images and update contents.json', function() {
+ it('should clean storyboard launch images and update contents.json', function () {
// spy!
var updatePaths = spyOn(FileUpdater, 'updatePaths');
@@ -395,12 +394,12 @@ describe('prepare', function() {
// verify that updatePaths was called as we expect
var expectedResourceMap = {
- 'Default@2x~universal~comcom.png' : 'res/screen/ios/Default@2x~universal~comcom.png',
- 'Default@2x~universal~comany.png' : 'res/screen/ios/Default@2x~universal~comany.png',
- 'Default@2x~universal~anyany.png' : 'res/screen/ios/Default@2x~universal~anyany.png',
- 'Default@3x~universal~comany.png' : 'res/screen/ios/Default@3x~universal~comany.png',
- 'Default@3x~universal~anycom.png' : 'res/screen/ios/Default@3x~universal~anycom.png',
- 'Default@3x~universal~anyany.png' : 'res/screen/ios/Default@3x~universal~anyany.png' };
+ 'Default@2x~universal~comcom.png': 'res/screen/ios/Default@2x~universal~comcom.png',
+ 'Default@2x~universal~comany.png': 'res/screen/ios/Default@2x~universal~comany.png',
+ 'Default@2x~universal~anyany.png': 'res/screen/ios/Default@2x~universal~anyany.png',
+ 'Default@3x~universal~comany.png': 'res/screen/ios/Default@3x~universal~comany.png',
+ 'Default@3x~universal~anycom.png': 'res/screen/ios/Default@3x~universal~anycom.png',
+ 'Default@3x~universal~anyany.png': 'res/screen/ios/Default@3x~universal~anyany.png' };
// update keys with path to storyboardImagesDir
for (var k in expectedResourceMap) {
if (expectedResourceMap.hasOwnProperty(k)) {
@@ -408,24 +407,24 @@ describe('prepare', function() {
delete expectedResourceMap[k];
}
}
- expect(updatePaths).toHaveBeenCalledWith( expectedResourceMap, {
- rootDir: project.root
- }, logFileOp
+ expect(updatePaths).toHaveBeenCalledWith(expectedResourceMap, {
+ rootDir: project.root
+ }, logFileOp
);
// verify that that Contents.json is as we expect
var result = JSON.parse(fs.readFileSync(path.join(project.root, storyboardImagesDir, 'Contents.json')));
- expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-json/typical-universal'));
+ expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-json/typical-universal'));
});
});
- describe ('#cleanLaunchStoryboardImages', function() {
+ describe('#cleanLaunchStoryboardImages', function () {
var getLaunchStoryboardImagesDir = prepare.__get__('getLaunchStoryboardImagesDir');
var updateLaunchStoryboardImages = prepare.__get__('updateLaunchStoryboardImages');
var cleanLaunchStoryboardImages = prepare.__get__('cleanLaunchStoryboardImages');
var logFileOp = prepare.__get__('logFileOp');
- it('should move launch images and update contents.json', function() {
+ it('should move launch images and update contents.json', function () {
var projectRoot = iosProject;
var platformProjDir = path.join('platforms', 'ios', 'SampleApp');
@@ -445,12 +444,12 @@ describe('prepare', function() {
// verify that updatePaths was called as we expect
var expectedResourceMap = {
- 'Default@2x~universal~comcom.png' : null,
- 'Default@2x~universal~comany.png' : null,
- 'Default@2x~universal~anyany.png' : null,
- 'Default@3x~universal~comany.png' : null,
- 'Default@3x~universal~anycom.png' : null,
- 'Default@3x~universal~anyany.png' : null };
+ 'Default@2x~universal~comcom.png': null,
+ 'Default@2x~universal~comany.png': null,
+ 'Default@2x~universal~anyany.png': null,
+ 'Default@3x~universal~comany.png': null,
+ 'Default@3x~universal~anycom.png': null,
+ 'Default@3x~universal~anyany.png': null };
// update keys with path to storyboardImagesDir
for (var k in expectedResourceMap) {
if (expectedResourceMap.hasOwnProperty(k)) {
@@ -458,25 +457,25 @@ describe('prepare', function() {
delete expectedResourceMap[k];
}
}
- expect(updatePaths).toHaveBeenCalledWith( expectedResourceMap, {
- rootDir: project.root,
- all: true
- }, logFileOp
+ expect(updatePaths).toHaveBeenCalledWith(expectedResourceMap, {
+ rootDir: project.root,
+ all: true
+ }, logFileOp
);
// verify that that Contents.json is as we expect
var result = JSON.parse(fs.readFileSync(path.join(project.root, storyboardImagesDir, 'Contents.json')));
- expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-json/empty'));
+ expect(result).toEqual(require('./fixtures/launch-storyboard-support/contents-json/empty'));
});
});
- describe ('#checkIfBuildSettingsNeedUpdatedForLaunchStoryboard', function() {
+ describe('#checkIfBuildSettingsNeedUpdatedForLaunchStoryboard', function () {
var checkIfBuildSettingsNeedUpdatedForLaunchStoryboard = prepare.__get__('checkIfBuildSettingsNeedUpdatedForLaunchStoryboard');
var updateProjectPlistForLaunchStoryboard = prepare.__get__('updateProjectPlistForLaunchStoryboard');
var plistFile = path.join(iosPlatform, 'SampleApp', 'SampleApp-Info.plist');
- var cfgs;
- it ('setup', function() {
- cfgs = ['none', 'legacy-only', 'modern-only', 'modern-and-legacy'].reduce(function (p,c) {
+ var cfgs;
+ it('setup', function () {
+ cfgs = ['none', 'legacy-only', 'modern-only', 'modern-and-legacy'].reduce(function (p, c) {
p[c] = {
config: new ConfigParser(path.join(FIXTURES, 'launch-storyboard-support', 'configs', c + '.xml')),
plist: plist.parse(fs.readFileSync(plistFile, 'utf8'))
@@ -512,13 +511,13 @@ describe('prepare', function() {
});
- describe ('#updateBuildSettingsForLaunchStoryboard', function() {
+ describe('#updateBuildSettingsForLaunchStoryboard', function () {
var updateBuildSettingsForLaunchStoryboard = prepare.__get__('updateBuildSettingsForLaunchStoryboard');
var updateProjectPlistForLaunchStoryboard = prepare.__get__('updateProjectPlistForLaunchStoryboard');
var plistFile = path.join(iosPlatform, 'SampleApp', 'SampleApp-Info.plist');
var cfgs;
it('setup', function () {
- cfgs = ['legacy-only', 'modern-only'].reduce(function (p,c) {
+ cfgs = ['legacy-only', 'modern-only'].reduce(function (p, c) {
p[c] = {
config: new ConfigParser(path.join(FIXTURES, 'launch-storyboard-support', 'configs', c + '.xml')),
plist: plist.parse(fs.readFileSync(plistFile, 'utf8'))
@@ -529,7 +528,7 @@ describe('prepare', function() {
it('should update build property with only legacy images', function () {
var cfg = cfgs['legacy-only'];
- var proj = new xcode.project(p.locations.pbxproj);
+ var proj = new xcode.project(p.locations.pbxproj); /* eslint new-cap : 0 */
proj.parseSync();
updateProjectPlistForLaunchStoryboard(cfg.config, cfg.plist);
updateBuildSettingsForLaunchStoryboard(proj, cfg.config, cfg.plist);
@@ -537,28 +536,29 @@ describe('prepare', function() {
});
it('should remove build property with only storyboard images', function () {
var cfg = cfgs['modern-only'];
- var proj = new xcode.project(p.locations.pbxproj);
+ var proj = new xcode.project(p.locations.pbxproj); /* eslint new-cap : 0 */
proj.parseSync();
// set a value for our asset catalog to make sure it really goes away
- proj.updateBuildProperty('ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME','LaunchImage');
+ proj.updateBuildProperty('ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME', 'LaunchImage');
updateProjectPlistForLaunchStoryboard(cfg.config, cfg.plist);
updateBuildSettingsForLaunchStoryboard(proj, cfg.config, cfg.plist);
expect(proj.getBuildProperty('ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME')).toBeUndefined();
});
});
-
});
- describe('updateProject method', function() {
+ describe('updateProject method', function () {
+ /* eslint-disable no-unused-vars */
var mv;
var update_name;
+ /* eslint-enable no-unused-vars */
var xcOrig = xcode.project;
var writeFileSyncSpy;
var updateProject = prepare.__get__('updateProject');
- beforeEach(function() {
+ beforeEach(function () {
mv = spyOn(shell, 'mv');
writeFileSyncSpy = spyOn(fs, 'writeFileSync');
@@ -566,40 +566,40 @@ describe('prepare', function() {
spyOn(plist, 'build').and.returnValue('');
spyOn(xcode, 'project').and.callFake(function (pbxproj) {
- var xc = new xcOrig(pbxproj);
+ var xc = new xcOrig(pbxproj); /* eslint new-cap : 0 */
update_name = spyOn(xc, 'updateProductName').and.callThrough();
return xc;
});
- cfg.name = function() { return 'SampleApp'; }; // this is to match p's original project name (based on .xcodeproj)
- cfg.packageName = function() { return 'testpkg'; };
- cfg.version = function() { return 'one point oh'; };
+ cfg.name = function () { return 'SampleApp'; }; // this is to match p's original project name (based on .xcodeproj)
+ cfg.packageName = function () { return 'testpkg'; };
+ cfg.version = function () { return 'one point oh'; };
spyOn(cfg, 'getPreference');
});
- it('Test#001 : should not update the app name in pbxproj', function(done) {
+ it('Test#001 : should not update the app name in pbxproj', function (done) {
var cfg2OriginalName = cfg2.name;
// originalName here will be `SampleApp` (based on the xcodeproj basename) from p
- cfg2.name = function() { return 'NotSampleApp'; }; // new config has name change
+ cfg2.name = function () { return 'NotSampleApp'; }; // new config has name change
wrapperError(updateProject(cfg2, p.locations), done); // since the name has changed it *should* error
// originalName here will be `SampleApp` (based on the xcodeproj basename) from p
- cfg2.name = function() { return 'SampleApp'; }; // new config does *not* have a name change
+ cfg2.name = function () { return 'SampleApp'; }; // new config does *not* have a name change
wrapper(updateProject(cfg2, p.locations), done); // since the name has not changed it *should not* error
// restore cfg2 original name
cfg2.name = cfg2OriginalName;
});
- it('should write target-device preference', function(done) {
+ it('should write target-device preference', function (done) {
var cfg2OriginalName = cfg2.name;
- cfg2.name = function() { return 'SampleApp'; }; // new config does *not* have a name change
+ cfg2.name = function () { return 'SampleApp'; }; // new config does *not* have a name change
writeFileSyncSpy.and.callThrough();
- wrapper(updateProject(cfg2, p.locations), done, function() {
+ wrapper(updateProject(cfg2, p.locations), done, function () {
var xcode = require('xcode');
- var proj = new xcode.project(p.locations.pbxproj);
+ var proj = new xcode.project(p.locations.pbxproj); /* eslint new-cap : 0 */
proj.parseSync();
var prop = proj.getBuildProperty('TARGETED_DEVICE_FAMILY');
expect(prop).toEqual('"1"'); // 1 is handset
@@ -608,16 +608,16 @@ describe('prepare', function() {
cfg2.name = cfg2OriginalName;
});
});
- it('should write deployment-target preference', function(done) {
+ it('should write deployment-target preference', function (done) {
var cfg2OriginalName = cfg2.name;
- cfg2.name = function() { return 'SampleApp'; }; // new config does *not* have a name change
+ cfg2.name = function () { return 'SampleApp'; }; // new config does *not* have a name change
writeFileSyncSpy.and.callThrough();
- wrapper(updateProject(cfg2, p.locations), done, function() {
+ wrapper(updateProject(cfg2, p.locations), done, function () {
var xcode = require('xcode');
- var proj = new xcode.project(p.locations.pbxproj);
+ var proj = new xcode.project(p.locations.pbxproj); /* eslint new-cap : 0 */
proj.parseSync();
- var prop = proj.getBuildProperty('IPHONEOS_DEPLOYMENT_TARGET');
+ var prop = proj.getBuildProperty('IPHONEOS_DEPLOYMENT_TARGET');
expect(prop).toEqual('8.0');
// restore cfg2 original name
@@ -625,97 +625,97 @@ describe('prepare', function() {
});
});
- it('Test#002 : should write out the app id to info plist as CFBundleIdentifier', function(done) {
+ it('Test#002 : should write out the app id to info plist as CFBundleIdentifier', function (done) {
var orig = cfg.getAttribute;
- cfg.getAttribute = function(name) {
- if (name == 'ios-CFBundleIdentifier') {
+ cfg.getAttribute = function (name) {
+ if (name === 'ios-CFBundleIdentifier') {
return null;
}
return orig.call(this, name);
};
- wrapper(updateProject(cfg, p.locations), done, function() {
+ wrapper(updateProject(cfg, p.locations), done, function () {
expect(plist.build.mostRecentCall.args[0].CFBundleIdentifier).toEqual('testpkg');
});
});
- it('Test#003 : should write out the app id to info plist as CFBundleIdentifier with ios-CFBundleIdentifier', function(done) {
+ it('Test#003 : should write out the app id to info plist as CFBundleIdentifier with ios-CFBundleIdentifier', function (done) {
var orig = cfg.getAttribute;
- cfg.getAttribute = function(name) {
- if (name == 'ios-CFBundleIdentifier') {
+ cfg.getAttribute = function (name) {
+ if (name === 'ios-CFBundleIdentifier') {
return 'testpkg_ios';
}
return orig.call(this, name);
};
- wrapper(updateProject(cfg, p.locations), done, function() {
+ wrapper(updateProject(cfg, p.locations), done, function () {
expect(plist.build.mostRecentCall.args[0].CFBundleIdentifier).toEqual('testpkg_ios');
});
});
- it('Test#004 : should write out the app version to info plist as CFBundleVersion', function(done) {
- wrapper(updateProject(cfg, p.locations), done, function() {
+ it('Test#004 : should write out the app version to info plist as CFBundleVersion', function (done) {
+ wrapper(updateProject(cfg, p.locations), done, function () {
expect(plist.build.mostRecentCall.args[0].CFBundleShortVersionString).toEqual('one point oh');
});
});
- it('Test#005 : should write out the orientation preference value', function(done) {
+ it('Test#005 : should write out the orientation preference value', function (done) {
cfg.getPreference.and.callThrough();
- wrapper(updateProject(cfg, p.locations), done, function() {
+ wrapper(updateProject(cfg, p.locations), done, function () {
expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ]);
expect(plist.build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ]);
expect(plist.build.mostRecentCall.args[0].UIInterfaceOrientation).toEqual([ 'UIInterfaceOrientationPortrait' ]);
});
});
- it('Test#006 : should handle no orientation', function(done) {
+ it('Test#006 : should handle no orientation', function (done) {
cfg.getPreference.and.returnValue('');
- wrapper(updateProject(cfg, p.locations), done, function() {
+ wrapper(updateProject(cfg, p.locations), done, function () {
expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toBeUndefined();
expect(plist.build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toBeUndefined();
expect(plist.build.mostRecentCall.args[0].UIInterfaceOrientation).toBeUndefined();
});
});
- it('Test#007 : should handle default orientation', function(done) {
+ it('Test#007 : should handle default orientation', function (done) {
cfg.getPreference.and.returnValue('default');
- wrapper(updateProject(cfg, p.locations), done, function() {
+ wrapper(updateProject(cfg, p.locations), done, function () {
expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]);
expect(plist.build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]);
expect(plist.build.mostRecentCall.args[0].UIInterfaceOrientation).toBeUndefined();
});
});
- it('Test#008 : should handle portrait orientation', function(done) {
+ it('Test#008 : should handle portrait orientation', function (done) {
cfg.getPreference.and.returnValue('portrait');
- wrapper(updateProject(cfg, p.locations), done, function() {
+ wrapper(updateProject(cfg, p.locations), done, function () {
expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ]);
expect(plist.build.mostRecentCall.args[0].UIInterfaceOrientation).toEqual([ 'UIInterfaceOrientationPortrait' ]);
});
});
- it('Test#009 : should handle landscape orientation', function(done) {
+ it('Test#009 : should handle landscape orientation', function (done) {
cfg.getPreference.and.returnValue('landscape');
- wrapper(updateProject(cfg, p.locations), done, function() {
+ wrapper(updateProject(cfg, p.locations), done, function () {
expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]);
expect(plist.build.mostRecentCall.args[0].UIInterfaceOrientation).toEqual([ 'UIInterfaceOrientationLandscapeLeft' ]);
});
});
- it('Test#010 : should handle all orientation on ios', function(done) {
+ it('Test#010 : should handle all orientation on ios', function (done) {
cfg.getPreference.and.returnValue('all');
- wrapper(updateProject(cfg, p.locations), done, function() {
+ wrapper(updateProject(cfg, p.locations), done, function () {
expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]);
expect(plist.build.mostRecentCall.args[0].UIInterfaceOrientation).toEqual([ 'UIInterfaceOrientationPortrait' ]);
});
});
- it('Test#011 : should handle custom orientation', function(done) {
+ it('Test#011 : should handle custom orientation', function (done) {
cfg.getPreference.and.returnValue('some-custom-orientation');
- wrapper(updateProject(cfg, p.locations), done, function() {
+ wrapper(updateProject(cfg, p.locations), done, function () {
expect(plist.build.mostRecentCall.args[0].UISupportedInterfaceOrientations).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]);
expect(plist.build.mostRecentCall.args[0]['UISupportedInterfaceOrientations~ipad']).toEqual([ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ]);
expect(plist.build.mostRecentCall.args[0].UIInterfaceOrientation).toBeUndefined();
});
});
- ///// App Transport Security Tests /////////////////////////////
- // NOTE: if an ATS value is equal to "null", it means that it was not written,
+ /// // App Transport Security Tests /////////////////////////////
+ // NOTE: if an ATS value is equal to "null", it means that it was not written,
// thus it will use the default (check the default for the key).
- // This is to prevent the Info.plist to be too verbose.
- it('Test#012 : <access> - should handle wildcard', function(done) {
- wrapper(updateProject(cfg, p.locations), done, function() {
+ // This is to prevent the Info.plist to be too verbose.
+ it('Test#012 : <access> - should handle wildcard', function (done) {
+ wrapper(updateProject(cfg, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
expect(ats.NSAllowsArbitraryLoads).toEqual(true);
expect(ats.NSAllowsArbitraryLoadsInWebContent).toEqual(null);
@@ -724,7 +724,7 @@ describe('prepare', function() {
});
});
- it('<access> - should handle wildcard, with NSAllowsArbitraryLoadsInWebContent', function(done) {
+ it('<access> - should handle wildcard, with NSAllowsArbitraryLoadsInWebContent', function (done) {
var readFile = spyOn(fs, 'readFileSync');
var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"><name>SampleApp</name>' +
@@ -734,7 +734,7 @@ describe('prepare', function() {
var my_config = new ConfigParser('fake/path');
- wrapper(updateProject(my_config, p.locations), done, function() {
+ wrapper(updateProject(my_config, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
expect(ats.NSAllowsArbitraryLoads).toEqual(true);
expect(ats.NSAllowsArbitraryLoadsInWebContent).toEqual(true);
@@ -743,7 +743,7 @@ describe('prepare', function() {
});
});
- it('<access> - should handle wildcard, with NSAllowsArbitraryLoadsInMedia', function(done) {
+ it('<access> - should handle wildcard, with NSAllowsArbitraryLoadsInMedia', function (done) {
var readFile = spyOn(fs, 'readFileSync');
var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"><name>SampleApp</name>' +
@@ -753,7 +753,7 @@ describe('prepare', function() {
var my_config = new ConfigParser('fake/path');
- wrapper(updateProject(my_config, p.locations), done, function() {
+ wrapper(updateProject(my_config, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
expect(ats.NSAllowsArbitraryLoads).toEqual(true);
expect(ats.NSAllowsArbitraryLoadsInWebContent).toEqual(null);
@@ -762,7 +762,7 @@ describe('prepare', function() {
});
});
- it('<access> - should handle wildcard, with NSAllowsLocalNetworking', function(done) {
+ it('<access> - should handle wildcard, with NSAllowsLocalNetworking', function (done) {
var readFile = spyOn(fs, 'readFileSync');
var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"><name>SampleApp</name>' +
@@ -772,7 +772,7 @@ describe('prepare', function() {
var my_config = new ConfigParser('fake/path');
- wrapper(updateProject(my_config, p.locations), done, function() {
+ wrapper(updateProject(my_config, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
expect(ats.NSAllowsArbitraryLoads).toEqual(true);
expect(ats.NSAllowsArbitraryLoadsInWebContent).toEqual(null);
@@ -781,7 +781,7 @@ describe('prepare', function() {
});
});
- it('<access> - should handle wildcard, with NSAllowsArbitraryLoadsInWebContent, NSAllowsArbitraryLoadsInMedia, NSAllowsLocalNetworking', function(done) {
+ it('<access> - should handle wildcard, with NSAllowsArbitraryLoadsInWebContent, NSAllowsArbitraryLoadsInMedia, NSAllowsLocalNetworking', function (done) {
var readFile = spyOn(fs, 'readFileSync');
var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"><name>SampleApp</name>' +
@@ -791,7 +791,7 @@ describe('prepare', function() {
var my_config = new ConfigParser('fake/path');
- wrapper(updateProject(my_config, p.locations), done, function() {
+ wrapper(updateProject(my_config, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
expect(ats.NSAllowsArbitraryLoads).toEqual(true);
expect(ats.NSAllowsArbitraryLoadsInWebContent).toEqual(true);
@@ -799,7 +799,7 @@ describe('prepare', function() {
expect(ats.NSAllowsLocalNetworking).toEqual(true);
});
});
- it('<access> - sanity check - no wildcard but has NSAllowsArbitraryLoadsInWebContent, NSAllowsArbitraryLoadsInMedia, NSAllowsLocalNetworking', function(done) {
+ it('<access> - sanity check - no wildcard but has NSAllowsArbitraryLoadsInWebContent, NSAllowsArbitraryLoadsInMedia, NSAllowsLocalNetworking', function (done) {
var readFile = spyOn(fs, 'readFileSync');
var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"><name>SampleApp</name>' +
@@ -809,7 +809,7 @@ describe('prepare', function() {
var my_config = new ConfigParser('fake/path');
- wrapper(updateProject(my_config, p.locations), done, function() {
+ wrapper(updateProject(my_config, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
expect(ats.NSAllowsArbitraryLoads).toEqual(null);
expect(ats.NSAllowsArbitraryLoadsInWebContent).toEqual(null);
@@ -817,9 +817,9 @@ describe('prepare', function() {
expect(ats.NSAllowsLocalNetworking).toEqual(null);
});
});
-
- it('Test#13 : <access> - https, subdomain wildcard', function(done) {
- wrapper(updateProject(cfg, p.locations), done, function() {
+
+ it('Test#13 : <access> - https, subdomain wildcard', function (done) {
+ wrapper(updateProject(cfg, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
var exceptionDomains = ats.NSExceptionDomains;
var d;
@@ -857,7 +857,7 @@ describe('prepare', function() {
expect(d.NSExceptionMinimumTLSVersion).toEqual(null);
expect(d.NSExceptionRequiresForwardSecrecy).toEqual(false);
expect(d.NSRequiresCertificateTransparency).toEqual(true);
-
+
d = exceptionDomains['server03.com'];
expect(d).toBeTruthy();
expect(d.NSIncludesSubdomains).toEqual(true);
@@ -892,8 +892,8 @@ describe('prepare', function() {
});
});
- it('Test#014 : <access> - http, no wildcard', function(done) {
- wrapper(updateProject(cfg, p.locations), done, function() {
+ it('Test#014 : <access> - http, no wildcard', function (done) {
+ wrapper(updateProject(cfg, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
var exceptionDomains = ats.NSExceptionDomains;
var d;
@@ -966,8 +966,8 @@ describe('prepare', function() {
});
});
- it('Test#015 : <access> - https, no wildcard', function(done) {
- wrapper(updateProject(cfg, p.locations), done, function() {
+ it('Test#015 : <access> - https, no wildcard', function (done) {
+ wrapper(updateProject(cfg, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
var exceptionDomains = ats.NSExceptionDomains;
var d;
@@ -1039,15 +1039,15 @@ describe('prepare', function() {
expect(d.NSRequiresCertificateTransparency).toEqual(true);
});
});
- //////////////////////////////////////////////////
- it('Test#016 : <access>, <allow-navigation> - http and https, no clobber', function(done) {
+ /// ///////////////////////////////////////////////
+ it('Test#016 : <access>, <allow-navigation> - http and https, no clobber', function (done) {
var cfg2OriginalName = cfg2.name;
// original name here is 'SampleApp' based on p
// we are not testing a name change here, but testing a new config being used (name change test is above)
// so we set it to the name expected
- cfg2.name = function() { return 'SampleApp'; }; // new config does *not* have a name change
+ cfg2.name = function () { return 'SampleApp'; }; // new config does *not* have a name change
- wrapper(updateProject(cfg2, p.locations), done, function() {
+ wrapper(updateProject(cfg2, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
var exceptionDomains = ats.NSExceptionDomains;
var d;
@@ -1066,9 +1066,9 @@ describe('prepare', function() {
cfg2.name = cfg2OriginalName;
});
});
- //////////////////////////////////////////////////
+ /// ///////////////////////////////////////////////
- it('<allow-navigation> - should handle wildcard', function(done) {
+ it('<allow-navigation> - should handle wildcard', function (done) {
var readFile = spyOn(fs, 'readFileSync');
var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"><name>SampleApp</name>' +
@@ -1078,7 +1078,7 @@ describe('prepare', function() {
var my_config = new ConfigParser('fake/path');
- wrapper(updateProject(my_config, p.locations), done, function() {
+ wrapper(updateProject(my_config, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
expect(ats.NSAllowsArbitraryLoads).toEqual(true);
expect(ats.NSAllowsArbitraryLoadsInWebContent).toEqual(null);
@@ -1087,7 +1087,7 @@ describe('prepare', function() {
});
});
- it('<allow-navigation> - sanity check - no wildcard but has NSAllowsArbitraryLoadsInWebContent, NSAllowsArbitraryLoadsInMedia, NSAllowsLocalNetworking', function(done) {
+ it('<allow-navigation> - sanity check - no wildcard but has NSAllowsArbitraryLoadsInWebContent, NSAllowsArbitraryLoadsInMedia, NSAllowsLocalNetworking', function (done) {
var readFile = spyOn(fs, 'readFileSync');
var configXml = '<?xml version="1.0" encoding="UTF-8"?><widget id="io.cordova.hellocordova" ios-CFBundleIdentifier="io.cordova.hellocordova.ios" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"><name>SampleApp</name>' +
@@ -1097,7 +1097,7 @@ describe('prepare', function() {
var my_config = new ConfigParser('fake/path');
- wrapper(updateProject(my_config, p.locations), done, function() {
+ wrapper(updateProject(my_config, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
expect(ats.NSAllowsArbitraryLoads).toEqual(null);
expect(ats.NSAllowsArbitraryLoadsInWebContent).toEqual(null);
@@ -1105,9 +1105,9 @@ describe('prepare', function() {
expect(ats.NSAllowsLocalNetworking).toEqual(null);
});
});
-
- it('<allow-navigation> - https, subdomain wildcard', function(done) {
- wrapper(updateProject(cfg, p.locations), done, function() {
+
+ it('<allow-navigation> - https, subdomain wildcard', function (done) {
+ wrapper(updateProject(cfg, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
var exceptionDomains = ats.NSExceptionDomains;
var d;
@@ -1127,7 +1127,7 @@ describe('prepare', function() {
expect(d.NSIncludesSubdomains).toEqual(true);
expect(d.NSExceptionAllowsInsecureHTTPLoads).toEqual(null);
expect(d.NSExceptionMinimumTLSVersion).toEqual(null);
- expect(d.NSExceptionRequiresForwardSecrecy).toEqual(false);
+ expect(d.NSExceptionRequiresForwardSecrecy).toEqual(false);
expect(d.NSRequiresCertificateTransparency).toEqual(null);
d = exceptionDomains['server22-1.com'];
@@ -1145,7 +1145,7 @@ describe('prepare', function() {
expect(d.NSExceptionMinimumTLSVersion).toEqual(null);
expect(d.NSExceptionRequiresForwardSecrecy).toEqual(false);
expect(d.NSRequiresCertificateTransparency).toEqual(true);
-
+
d = exceptionDomains['server23.com'];
expect(d).toBeTruthy();
expect(d.NSIncludesSubdomains).toEqual(true);
@@ -1180,8 +1180,8 @@ describe('prepare', function() {
});
});
- it('<allow-navigation> - http, no wildcard', function(done) {
- wrapper(updateProject(cfg, p.locations), done, function() {
+ it('<allow-navigation> - http, no wildcard', function (done) {
+ wrapper(updateProject(cfg, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
var exceptionDomains = ats.NSExceptionDomains;
var d;
@@ -1255,8 +1255,8 @@ describe('prepare', function() {
});
});
- it('<allow-navigation> - https, no wildcard', function(done) {
- wrapper(updateProject(cfg, p.locations), done, function() {
+ it('<allow-navigation> - https, no wildcard', function (done) {
+ wrapper(updateProject(cfg, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
var exceptionDomains = ats.NSExceptionDomains;
var d;
@@ -1329,8 +1329,8 @@ describe('prepare', function() {
});
});
- it('Test#017 : <allow-navigation> - wildcard scheme, wildcard subdomain', function(done) {
- wrapper(updateProject(cfg, p.locations), done, function() {
+ it('Test#017 : <allow-navigation> - wildcard scheme, wildcard subdomain', function (done) {
+ wrapper(updateProject(cfg, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
var exceptionDomains = ats.NSExceptionDomains;
var d;
@@ -1400,11 +1400,11 @@ describe('prepare', function() {
expect(d.NSExceptionMinimumTLSVersion).toEqual('TLSv1.1');
expect(d.NSExceptionRequiresForwardSecrecy).toEqual(false);
expect(d.NSRequiresCertificateTransparency).toEqual(true);
-
+
});
});
- it('Test#018 : <allow-navigation> - wildcard scheme, no subdomain', function(done) {
- wrapper(updateProject(cfg, p.locations), done, function() {
+ it('Test#018 : <allow-navigation> - wildcard scheme, no subdomain', function (done) {
+ wrapper(updateProject(cfg, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
var exceptionDomains = ats.NSExceptionDomains;
var d;
@@ -1474,11 +1474,11 @@ describe('prepare', function() {
expect(d.NSExceptionMinimumTLSVersion).toEqual('TLSv1.1');
expect(d.NSExceptionRequiresForwardSecrecy).toEqual(false);
expect(d.NSRequiresCertificateTransparency).toEqual(true);
-
+
});
});
- it('Test#019 : <allow-navigation> - should ignore wildcards like data:*, https:*, https://*', function(done) {
- wrapper(updateProject(cfg, p.locations), done, function() {
+ it('Test#019 : <allow-navigation> - should ignore wildcards like data:*, https:*, https://*', function (done) {
+ wrapper(updateProject(cfg, p.locations), done, function () {
var ats = plist.build.mostRecentCall.args[0].NSAppTransportSecurity;
var exceptionDomains = ats.NSExceptionDomains;
expect(exceptionDomains['']).toBeUndefined();
@@ -1486,15 +1486,15 @@ describe('prepare', function() {
expect(exceptionDomains['undefined']).toBeUndefined();
});
});
- it('Test#020 : <name> - should write out the display name to info plist as CFBundleDisplayName', function(done) {
- cfg.shortName = function() { return 'MyApp'; };
- wrapper(updateProject(cfg, p.locations), done, function() {
+ it('Test#020 : <name> - should write out the display name to info plist as CFBundleDisplayName', function (done) {
+ cfg.shortName = function () { return 'MyApp'; };
+ wrapper(updateProject(cfg, p.locations), done, function () {
expect(plist.build.mostRecentCall.args[0].CFBundleDisplayName).toEqual('MyApp');
});
});
});
- describe('<resource-file> tests', function() {
+ describe('<resource-file> tests', function () {
// image-8888.png target attribute is missing in config.xml as a test
const images = [
{
@@ -1515,19 +1515,19 @@ describe('prepare', function() {
const cleanFileResources = prepare.__get__('cleanFileResources');
const cfgResourceFiles = new ConfigParser(path.join(FIXTURES, 'resource-file-support', 'config.xml'));
- function findImageFileRef(pbxproj, imageFileName) {
+ function findImageFileRef (pbxproj, imageFileName) {
const buildfiles = pbxproj.pbxBuildFileSection();
- return Object.keys(buildfiles).filter(function(uuid) {
+ return Object.keys(buildfiles).filter(function (uuid) {
var filename = buildfiles[uuid].fileRef_comment;
return (filename === imageFileName);
});
}
- function findResourcesBuildPhaseRef(pbxproj, ref) {
+ function findResourcesBuildPhaseRef (pbxproj, ref) {
const resBuildPhase = pbxproj.buildPhaseObject('PBXResourcesBuildPhase', 'Resources');
let resBuildPhaseFileRefs = [];
if (resBuildPhase) {
- resBuildPhaseFileRefs = resBuildPhase.files.filter(function(item){
+ resBuildPhaseFileRefs = resBuildPhase.files.filter(function (item) {
return item.value === ref;
});
}
@@ -1535,7 +1535,7 @@ describe('prepare', function() {
return resBuildPhaseFileRefs;
}
- it('<resource-file> prepare - copy', function() {
+ it('<resource-file> prepare - copy', function () {
const cordovaProject = {
root: projectRoot,
projectConfig: cfgResourceFiles,
@@ -1562,7 +1562,7 @@ describe('prepare', function() {
}
});
- it('<resource-file> clean - remove', function() {
+ it('<resource-file> clean - remove', function () {
cleanFileResources(projectRoot, cfgResourceFiles, p.locations);
const project = projectFile.parse(p.locations);
@@ -1578,10 +1578,10 @@ describe('prepare', function() {
let resBuildPhaseFileRefs = findResourcesBuildPhaseRef(project.xcode, imagefileRefs[0]);
expect(resBuildPhaseFileRefs.length).toEqual(0);
}
- });
+ });
});
- describe('updateWww method', function() {
+ describe('updateWww method', function () {
var updateWww = prepare.__get__('updateWww');
var logFileOp = prepare.__get__('logFileOp');
@@ -1594,24 +1594,24 @@ describe('prepare', function() {
locations: { www: path.join(iosProject, 'www') }
};
- it('Test#021 : should update project-level www and with platform agnostic www and merges', function() {
+ it('Test#021 : should update project-level www and with platform agnostic www and merges', function () {
var merges_path = path.join(project.root, 'merges', 'ios');
shell.mkdir('-p', merges_path);
updateWww(project, p.locations);
expect(FileUpdater.mergeAndUpdateDir).toHaveBeenCalledWith(
- [ 'www', path.join('platforms', 'ios', 'platform_www'), path.join('merges','ios') ],
+ [ 'www', path.join('platforms', 'ios', 'platform_www'), path.join('merges', 'ios') ],
path.join('platforms', 'ios', 'www'),
- { rootDir : iosProject },
+ { rootDir: iosProject },
logFileOp);
});
- it('Test#022 : should skip merges if merges directory does not exist', function() {
+ it('Test#022 : should skip merges if merges directory does not exist', function () {
var merges_path = path.join(project.root, 'merges', 'ios');
shell.rm('-rf', merges_path);
updateWww(project, p.locations);
expect(FileUpdater.mergeAndUpdateDir).toHaveBeenCalledWith(
[ 'www', path.join('platforms', 'ios', 'platform_www') ],
path.join('platforms', 'ios', 'www'),
- { rootDir : iosProject },
+ { rootDir: iosProject },
logFileOp);
});
});
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/preparePlatform.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/preparePlatform.spec.js b/tests/spec/unit/preparePlatform.spec.js
index 3c4b150..4d33767 100644
--- a/tests/spec/unit/preparePlatform.spec.js
+++ b/tests/spec/unit/preparePlatform.spec.js
@@ -17,15 +17,12 @@
under the License.
*/
-/* jshint jasmine: true */
-
var path = require('path');
var fs = require('fs');
var shell = require('shelljs');
var EventEmitter = require('events').EventEmitter;
var ConfigParser = require('cordova-common').ConfigParser;
var PluginInfo = require('cordova-common').PluginInfo;
-var ConfigParser = require('cordova-common').ConfigParser;
var Api = require('../../../bin/templates/scripts/cordova/Api');
var FIXTURES = path.join(__dirname, 'fixtures');
@@ -38,9 +35,9 @@ var dummyPlugin = path.join(FIXTURES, DUMMY_PLUGIN);
shell.config.silent = true;
-describe('prepare after plugin add', function() {
+describe('prepare after plugin add', function () {
var api;
- beforeEach(function() {
+ beforeEach(function () {
shell.mkdir('-p', iosPlatform);
shell.cp('-rf', iosProjectFixture + '/*', iosPlatform);
api = new Api('ios', iosPlatform, new EventEmitter());
@@ -48,7 +45,7 @@ describe('prepare after plugin add', function() {
jasmine.addMatchers({
'toBeInstalledIn': function () {
return {
- compare: function(actual, expected) {
+ compare: function (actual, expected) {
var result = {};
var content;
try {
@@ -59,10 +56,10 @@ describe('prepare after plugin add', function() {
result.pass = false;
}
- if(result.pass) {
- result.message = 'Expected '+ actual + ' to be installed in '+ expected+'.';
+ if (result.pass) {
+ result.message = 'Expected ' + actual + ' to be installed in ' + expected + '.';
} else {
- result.message = 'Expected '+ actual + ' to not be installed in '+ expected+'.';
+ result.message = 'Expected ' + actual + ' to not be installed in ' + expected + '.';
}
return result;
}
@@ -71,11 +68,11 @@ describe('prepare after plugin add', function() {
});
});
- afterEach(function() {
+ afterEach(function () {
shell.rm('-rf', iosPlatform);
});
- it('Test 001 : should not overwrite plugin metadata added by "addPlugin"', function(done) {
+ it('Test 001 : should not overwrite plugin metadata added by "addPlugin"', function (done) {
var project = {
root: iosProject,
projectConfig: new ConfigParser(path.join(iosProject, 'config.xml')),
@@ -86,27 +83,27 @@ describe('prepare after plugin add', function() {
};
var fail = jasmine.createSpy('fail')
- .and.callFake(function (err) {
- console.error(err);
- });
+ .and.callFake(function (err) {
+ console.error(err);
+ });
api.prepare(project, {})
- .then(function() {
- expect(fs.existsSync(path.join(iosPlatform, 'ios.json'))).toBe(true);
- expect(DUMMY_PLUGIN).not.toBeInstalledIn(iosProject);
- return api.addPlugin(new PluginInfo(dummyPlugin), {});
- })
- .then(function() {
- expect(DUMMY_PLUGIN).toBeInstalledIn(iosPlatform);
- return api.prepare(project, {});
- })
- .then(function() {
- expect(DUMMY_PLUGIN).toBeInstalledIn(iosPlatform);
- })
- .catch(fail)
- .finally(function() {
- expect(fail).not.toHaveBeenCalled();
- done();
- });
+ .then(function () {
+ expect(fs.existsSync(path.join(iosPlatform, 'ios.json'))).toBe(true);
+ expect(DUMMY_PLUGIN).not.toBeInstalledIn(iosProject);
+ return api.addPlugin(new PluginInfo(dummyPlugin), {});
+ })
+ .then(function () {
+ expect(DUMMY_PLUGIN).toBeInstalledIn(iosPlatform);
+ return api.prepare(project, {});
+ })
+ .then(function () {
+ expect(DUMMY_PLUGIN).toBeInstalledIn(iosPlatform);
+ })
+ .catch(fail)
+ .finally(function () {
+ expect(fail).not.toHaveBeenCalled();
+ done();
+ });
});
});
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/projectFile.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/projectFile.spec.js b/tests/spec/unit/projectFile.spec.js
index 3ba6546..2b0f351 100644
--- a/tests/spec/unit/projectFile.spec.js
+++ b/tests/spec/unit/projectFile.spec.js
@@ -30,44 +30,44 @@ var locations = {
pbxproj: path.join(iosProject, 'SampleApp.xcodeproj/project.pbxproj')
};
-describe('projectFile', function() {
- beforeEach(function() {
+describe('projectFile', function () {
+ beforeEach(function () {
shell.cp('-rf', iosProjectFixture, iosProject);
});
- afterEach(function() {
+ afterEach(function () {
shell.rm('-rf', iosProject);
});
describe('parse method', function () {
- it('Test#001 : should throw if project is not an xcode project', function() {
+ it('Test#001 : should throw if project is not an xcode project', function () {
shell.rm('-rf', path.join(iosProject, 'SampleApp', 'SampleApp.xcodeproj'));
- expect(function() { projectFile.parse(); }).toThrow();
+ expect(function () { projectFile.parse(); }).toThrow();
});
- it('Test#002 : should throw if project does not contain an appropriate config.xml file', function() {
+ it('Test#002 : should throw if project does not contain an appropriate config.xml file', function () {
shell.rm(path.join(iosProject, 'SampleApp', 'config.xml'));
- expect(function() { projectFile.parse(locations); })
+ expect(function () { projectFile.parse(locations); })
.toThrow(new Error('Could not find *-Info.plist file, or config.xml file.'));
});
- it('Test#003 : should throw if project does not contain an appropriate -Info.plist file', function() {
+ it('Test#003 : should throw if project does not contain an appropriate -Info.plist file', function () {
shell.rm(path.join(iosProject, 'SampleApp', 'SampleApp-Info.plist'));
expect(function () { projectFile.parse(locations); })
.toThrow(new Error('Could not find *-Info.plist file, or config.xml file.'));
});
- it('Test#004 : should return right directory when multiple .plist files are present', function() {
- //Create a folder named A with config.xml and .plist files in it
+ it('Test#004 : should return right directory when multiple .plist files are present', function () {
+ // Create a folder named A with config.xml and .plist files in it
var pathToFolderA = path.join(iosProject, 'A');
shell.mkdir(pathToFolderA);
shell.cp('-rf', path.join(iosProject, 'SampleApp/*'), pathToFolderA);
var parsedProjectFile = projectFile.parse(locations);
- var pluginsDir = parsedProjectFile.plugins_dir,
- resourcesDir = parsedProjectFile.resources_dir,
- xcodePath = parsedProjectFile.xcode_path;
+ var pluginsDir = parsedProjectFile.plugins_dir;
+ var resourcesDir = parsedProjectFile.resources_dir;
+ var xcodePath = parsedProjectFile.xcode_path;
- var pluginsDirParent = path.dirname(pluginsDir),
- resourcesDirParent = path.dirname(resourcesDir),
- sampleAppDir = path.join(iosProject, 'SampleApp');
+ var pluginsDirParent = path.dirname(pluginsDir);
+ var resourcesDirParent = path.dirname(resourcesDir);
+ var sampleAppDir = path.join(iosProject, 'SampleApp');
expect(pluginsDirParent).toEqual(sampleAppDir);
expect(resourcesDirParent).toEqual(sampleAppDir);
@@ -76,7 +76,7 @@ describe('projectFile', function() {
});
describe('other methods', function () {
- it('Test#005 : getPackageName method should return the CFBundleIdentifier from the project\'s Info.plist file', function() {
+ it('Test#005 : getPackageName method should return the CFBundleIdentifier from the project\'s Info.plist file', function () {
expect(projectFile.parse(locations).getPackageName()).toEqual('com.example.friendstring');
});
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[2/5] ios commit: CB-12895 : removed jshint and added eslint
Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/empty.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/empty.js b/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/empty.js
index 6b7663a..627bc39 100644
--- a/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/empty.js
+++ b/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/empty.js
@@ -1,135 +1,135 @@
module.exports = {
- "images": [{
- "idiom": "universal",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
+ 'images': [{
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
}, {
- "idiom": "universal",
- "scale": "1x",
- "width-class": "compact"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width-class': 'compact'
}, {
- "idiom": "universal",
- "scale": "1x",
- "height-class": "compact"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'height-class': 'compact'
}, {
- "idiom": "universal",
- "scale": "1x"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact"
+ 'idiom': 'universal',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
}, {
- "idiom": "universal",
- "scale": "2x",
- "width-class": "compact"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width-class': 'compact'
}, {
- "idiom": "universal",
- "scale": "2x",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "2x"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "width-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "3x"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "width-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "width-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "2x"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "width-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x"
- }, {
- "idiom": "iphone",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "2x",
- "width-class": "compact"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "2x",
- "height-class": "compact"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'height-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "2x"
+ 'idiom': 'iphone',
+ 'scale': '2x'
}, {
- "idiom": "iphone",
- "scale": "3x",
- "width-class": "compact",
- "height-class": "compact"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "3x",
- "width-class": "compact"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "3x",
- "height-class": "compact"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'height-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "3x"
+ 'idiom': 'iphone',
+ 'scale': '3x'
}],
- "info": {
- "author": "Xcode",
- "version": 1
+ 'info': {
+ 'author': 'Xcode',
+ 'version': 1
}
-};
\ No newline at end of file
+};
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/single-2xanyany.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/single-2xanyany.js b/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/single-2xanyany.js
index c58f6c4..9485e81 100644
--- a/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/single-2xanyany.js
+++ b/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/single-2xanyany.js
@@ -1,136 +1,136 @@
module.exports = {
- "images": [{
- "idiom": "universal",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "1x",
- "width-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "1x",
- "height-class": "compact"
+ 'images': [{
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'height-class': 'compact'
}, {
- "idiom": "universal",
- "scale": "1x"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "width-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "filename": "Default@2x~universal~anyany.png"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "width-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "3x"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "width-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "width-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "2x"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "width-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x"
- }, {
- "idiom": "iphone",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact"
+ 'idiom': 'universal',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'filename': 'Default@2x~universal~anyany.png'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "2x",
- "width-class": "compact"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "2x",
- "height-class": "compact"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'height-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "2x"
+ 'idiom': 'iphone',
+ 'scale': '2x'
}, {
- "idiom": "iphone",
- "scale": "3x",
- "width-class": "compact",
- "height-class": "compact"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "3x",
- "width-class": "compact"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "3x",
- "height-class": "compact"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'height-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "3x"
+ 'idiom': 'iphone',
+ 'scale': '3x'
}],
- "info": {
- "author": "Xcode",
- "version": 1
+ 'info': {
+ 'author': 'Xcode',
+ 'version': 1
}
-};
\ No newline at end of file
+};
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/typical-universal.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/typical-universal.js b/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/typical-universal.js
index 0e8e986..3a9b96b 100644
--- a/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/typical-universal.js
+++ b/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/typical-universal.js
@@ -1,141 +1,141 @@
module.exports = {
- "images": [{
- "idiom": "universal",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "1x",
- "width-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "1x",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "1x"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact",
- "filename": "Default@2x~universal~comcom.png"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "width-class": "compact",
- "filename": "Default@2x~universal~comany.png"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "filename": "Default@2x~universal~anyany.png"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "width-class": "compact",
- "filename": "Default@3x~universal~comany.png"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "height-class": "compact",
- "filename": "Default@3x~universal~anycom.png"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "filename": "Default@3x~universal~anyany.png"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "width-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "width-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "2x"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "width-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x"
- }, {
- "idiom": "iphone",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "2x",
- "width-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "2x",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "2x"
- }, {
- "idiom": "iphone",
- "scale": "3x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "3x",
- "width-class": "compact"
+ 'images': [{
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact',
+ 'filename': 'Default@2x~universal~comcom.png'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'filename': 'Default@2x~universal~comany.png'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'filename': 'Default@2x~universal~anyany.png'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width-class': 'compact',
+ 'filename': 'Default@3x~universal~comany.png'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'height-class': 'compact',
+ 'filename': 'Default@3x~universal~anycom.png'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'filename': 'Default@3x~universal~anyany.png'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '2x'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "3x",
- "height-class": "compact"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'height-class': 'compact'
}, {
- "idiom": "iphone",
- "scale": "3x"
+ 'idiom': 'iphone',
+ 'scale': '3x'
}],
- "info": {
- "author": "Xcode",
- "version": 1
+ 'info': {
+ 'author': 'Xcode',
+ 'version': 1
}
};
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/varied-device.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/varied-device.js b/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/varied-device.js
index 548ea04..6f1e27a 100644
--- a/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/varied-device.js
+++ b/tests/spec/unit/fixtures/launch-storyboard-support/contents-json/varied-device.js
@@ -1,144 +1,144 @@
module.exports = {
- "images": [{
- "idiom": "universal",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "1x",
- "width-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "1x",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "1x"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact",
- "filename": "Default@2x~universal~comcom.png"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "width-class": "compact",
- "filename": "Default@2x~universal~comany.png"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "2x",
- "filename": "Default@2x~universal~anyany.png"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "width-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "3x",
- "height-class": "compact"
- }, {
- "idiom": "universal",
- "scale": "3x"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "width-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "1x"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact",
- "filename": "Default@2x~ipad~comcom.png"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "width-class": "compact",
- "filename": "Default@2x~ipad~comany.png"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "height-class": "compact"
- }, {
- "idiom": "ipad",
- "scale": "2x",
- "filename": "Default@2x~ipad~anyany.png"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "width-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "1x"
- }, {
- "idiom": "iphone",
- "scale": "2x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "2x",
- "width-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "2x",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "2x"
- }, {
- "idiom": "iphone",
- "scale": "3x",
- "width-class": "compact",
- "height-class": "compact"
- }, {
- "idiom": "iphone",
- "scale": "3x",
- "width-class": "compact",
- "filename": "Default@3x~iphone~comany.png"
- }, {
- "idiom": "iphone",
- "scale": "3x",
- "height-class": "compact",
- "filename": "Default@3x~iphone~anycom.png"
- }, {
- "idiom": "iphone",
- "scale": "3x",
- "filename": "Default@3x~iphone~anyany.png"
+ 'images': [{
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact',
+ 'filename': 'Default@2x~universal~comcom.png'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'filename': 'Default@2x~universal~comany.png'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'filename': 'Default@2x~universal~anyany.png'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'universal',
+ 'scale': '3x'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact',
+ 'filename': 'Default@2x~ipad~comcom.png'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'filename': 'Default@2x~ipad~comany.png'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'filename': 'Default@2x~ipad~anyany.png'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '1x'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '2x'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width-class': 'compact',
+ 'height-class': 'compact'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width-class': 'compact',
+ 'filename': 'Default@3x~iphone~comany.png'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'height-class': 'compact',
+ 'filename': 'Default@3x~iphone~anycom.png'
+ }, {
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'filename': 'Default@3x~iphone~anyany.png'
}],
- "info": {
- "author": "Xcode",
- "version": 1
+ 'info': {
+ 'author': 'Xcode',
+ 'version': 1
}
};
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/empty-map.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/empty-map.js b/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/empty-map.js
index 36d8a81..a81c5b6 100644
--- a/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/empty-map.js
+++ b/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/empty-map.js
@@ -1,194 +1,194 @@
module.exports = [
- {
- "idiom": "universal",
- "scale": "1x",
- "width": "com",
- "height": "com"
- },
- {
- "idiom": "universal",
- "scale": "1x",
- "width": "com",
- "height": "any"
- },
- {
- "idiom": "universal",
- "scale": "1x",
- "width": "any",
- "height": "com"
- },
- {
- "idiom": "universal",
- "scale": "1x",
- "width": "any",
- "height": "any"
- },
- {
- "idiom": "universal",
- "scale": "2x",
- "width": "com",
- "height": "com"
- },
- {
- "idiom": "universal",
- "scale": "2x",
- "width": "com",
- "height": "any"
- },
- {
- "idiom": "universal",
- "scale": "2x",
- "width": "any",
- "height": "com"
- },
- {
- "idiom": "universal",
- "scale": "2x",
- "width": "any",
- "height": "any"
- },
- {
- "idiom": "universal",
- "scale": "3x",
- "width": "com",
- "height": "com"
- },
- {
- "idiom": "universal",
- "scale": "3x",
- "width": "com",
- "height": "any"
- },
- {
- "idiom": "universal",
- "scale": "3x",
- "width": "any",
- "height": "com"
- },
- {
- "idiom": "universal",
- "scale": "3x",
- "width": "any",
- "height": "any"
- },
- {
- "idiom": "ipad",
- "scale": "1x",
- "width": "com",
- "height": "com"
- },
- {
- "idiom": "ipad",
- "scale": "1x",
- "width": "com",
- "height": "any"
- },
- {
- "idiom": "ipad",
- "scale": "1x",
- "width": "any",
- "height": "com"
- },
- {
- "idiom": "ipad",
- "scale": "1x",
- "width": "any",
- "height": "any"
- },
- {
- "idiom": "ipad",
- "scale": "2x",
- "width": "com",
- "height": "com"
- },
- {
- "idiom": "ipad",
- "scale": "2x",
- "width": "com",
- "height": "any"
- },
- {
- "idiom": "ipad",
- "scale": "2x",
- "width": "any",
- "height": "com"
- },
- {
- "idiom": "ipad",
- "scale": "2x",
- "width": "any",
- "height": "any"
- },
- {
- "idiom": "iphone",
- "scale": "1x",
- "width": "com",
- "height": "com"
- },
- {
- "idiom": "iphone",
- "scale": "1x",
- "width": "com",
- "height": "any"
- },
- {
- "idiom": "iphone",
- "scale": "1x",
- "width": "any",
- "height": "com"
- },
- {
- "idiom": "iphone",
- "scale": "1x",
- "width": "any",
- "height": "any"
- },
- {
- "idiom": "iphone",
- "scale": "2x",
- "width": "com",
- "height": "com"
- },
- {
- "idiom": "iphone",
- "scale": "2x",
- "width": "com",
- "height": "any"
- },
- {
- "idiom": "iphone",
- "scale": "2x",
- "width": "any",
- "height": "com"
- },
- {
- "idiom": "iphone",
- "scale": "2x",
- "width": "any",
- "height": "any"
- },
- {
- "idiom": "iphone",
- "scale": "3x",
- "width": "com",
- "height": "com"
- },
- {
- "idiom": "iphone",
- "scale": "3x",
- "width": "com",
- "height": "any"
- },
- {
- "idiom": "iphone",
- "scale": "3x",
- "width": "any",
- "height": "com"
- },
- {
- "idiom": "iphone",
- "scale": "3x",
- "width": "any",
- "height": "any"
- }
+ {
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'any'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'com'
+ },
+ {
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'any'
+ }
];
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/single-2xanyany-map.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/single-2xanyany-map.js b/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/single-2xanyany-map.js
index 5d8ec3d..54d98b5 100644
--- a/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/single-2xanyany-map.js
+++ b/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/single-2xanyany-map.js
@@ -1,197 +1,197 @@
module.exports = [
{
- "idiom": "universal",
- "scale": "1x",
- "width": "com",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "1x",
- "width": "com",
- "height": "any"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "universal",
- "scale": "1x",
- "width": "any",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "1x",
- "width": "any",
- "height": "any"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "com",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "com",
- "height": "any"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "any",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "any",
- "height": "any",
- "filename": "Default@2x~universal~anyany.png",
- "src": "res/splash/ios/Default@2x~universal~anyany.png",
- "target": "Default@2x~universal~anyany.png"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any',
+ 'filename': 'Default@2x~universal~anyany.png',
+ 'src': 'res/splash/ios/Default@2x~universal~anyany.png',
+ 'target': 'Default@2x~universal~anyany.png'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "com",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "com",
- "height": "any"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "any",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "any",
- "height": "any"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "com",
- "height": "com"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "com",
- "height": "any"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "any",
- "height": "com"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "any",
- "height": "any"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "com",
- "height": "com"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "com",
- "height": "any"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "any",
- "height": "com"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "any",
- "height": "any"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "com",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "com",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "any",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "any",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "com",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "com",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "any",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "any",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "com",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "com",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "any",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "any",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'any'
}
];
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/typical-universal-map.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/typical-universal-map.js b/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/typical-universal-map.js
index eef09ef..e571a09 100644
--- a/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/typical-universal-map.js
+++ b/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/typical-universal-map.js
@@ -1,212 +1,212 @@
module.exports = [
{
- "idiom": "universal",
- "scale": "1x",
- "width": "com",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "1x",
- "width": "com",
- "height": "any"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "universal",
- "scale": "1x",
- "width": "any",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "1x",
- "width": "any",
- "height": "any"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "com",
- "height": "com",
- "filename": "Default@2x~universal~comcom.png",
- "src": "res/splash/ios/Default@2x~universal~comcom.png",
- "target": "Default@2x~universal~comcom.png"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com',
+ 'filename': 'Default@2x~universal~comcom.png',
+ 'src': 'res/splash/ios/Default@2x~universal~comcom.png',
+ 'target': 'Default@2x~universal~comcom.png'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "com",
- "height": "any",
- "filename": "Default@2x~universal~comany.png",
- "src": "res/splash/ios/Default@2x~universal~comany.png",
- "target": "Default@2x~universal~comany.png"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any',
+ 'filename': 'Default@2x~universal~comany.png',
+ 'src': 'res/splash/ios/Default@2x~universal~comany.png',
+ 'target': 'Default@2x~universal~comany.png'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "any",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "any",
- "height": "any",
- "filename": "Default@2x~universal~anyany.png",
- "src": "res/splash/ios/Default@2x~universal~anyany.png",
- "target": "Default@2x~universal~anyany.png"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any',
+ 'filename': 'Default@2x~universal~anyany.png',
+ 'src': 'res/splash/ios/Default@2x~universal~anyany.png',
+ 'target': 'Default@2x~universal~anyany.png'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "com",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "com",
- "height": "any",
- "filename": "Default@3x~universal~comany.png",
- "src": "res/splash/ios/Default@3x~universal~comany.png",
- "target": "Default@3x~universal~comany.png"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'any',
+ 'filename': 'Default@3x~universal~comany.png',
+ 'src': 'res/splash/ios/Default@3x~universal~comany.png',
+ 'target': 'Default@3x~universal~comany.png'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "any",
- "height": "com",
- "filename": "Default@3x~universal~anycom.png",
- "src": "res/splash/ios/Default@3x~universal~anycom.png",
- "target": "Default@3x~universal~anycom.png"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'com',
+ 'filename': 'Default@3x~universal~anycom.png',
+ 'src': 'res/splash/ios/Default@3x~universal~anycom.png',
+ 'target': 'Default@3x~universal~anycom.png'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "any",
- "height": "any",
- "filename": "Default@3x~universal~anyany.png",
- "src": "res/splash/ios/Default@3x~universal~anyany.png",
- "target": "Default@3x~universal~anyany.png"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'any',
+ 'filename': 'Default@3x~universal~anyany.png',
+ 'src': 'res/splash/ios/Default@3x~universal~anyany.png',
+ 'target': 'Default@3x~universal~anyany.png'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "com",
- "height": "com"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "com",
- "height": "any"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "any",
- "height": "com"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "any",
- "height": "any"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "com",
- "height": "com"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "com",
- "height": "any"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "any",
- "height": "com"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "any",
- "height": "any"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "com",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "com",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "any",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "any",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "com",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "com",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "any",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "any",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "com",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "com",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "any",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "any",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'any'
}
];
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/varied-device-map.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/varied-device-map.js b/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/varied-device-map.js
index e6d39ed..b9480fc 100644
--- a/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/varied-device-map.js
+++ b/tests/spec/unit/fixtures/launch-storyboard-support/contents-map/varied-device-map.js
@@ -1,221 +1,221 @@
module.exports = [
{
- "idiom": "universal",
- "scale": "1x",
- "width": "com",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "1x",
- "width": "com",
- "height": "any"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "universal",
- "scale": "1x",
- "width": "any",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "1x",
- "width": "any",
- "height": "any"
+ 'idiom': 'universal',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "com",
- "height": "com",
- "filename": "Default@2x~universal~comcom.png",
- "src": "res/splash/ios/Default@2x~universal~comcom.png",
- "target": "Default@2x~universal~comcom.png"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com',
+ 'filename': 'Default@2x~universal~comcom.png',
+ 'src': 'res/splash/ios/Default@2x~universal~comcom.png',
+ 'target': 'Default@2x~universal~comcom.png'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "com",
- "height": "any",
- "filename": "Default@2x~universal~comany.png",
- "src": "res/splash/ios/Default@2x~universal~comany.png",
- "target": "Default@2x~universal~comany.png"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any',
+ 'filename': 'Default@2x~universal~comany.png',
+ 'src': 'res/splash/ios/Default@2x~universal~comany.png',
+ 'target': 'Default@2x~universal~comany.png'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "any",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "2x",
- "width": "any",
- "height": "any",
- "filename": "Default@2x~universal~anyany.png",
- "src": "res/splash/ios/Default@2x~universal~anyany.png",
- "target": "Default@2x~universal~anyany.png"
+ 'idiom': 'universal',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any',
+ 'filename': 'Default@2x~universal~anyany.png',
+ 'src': 'res/splash/ios/Default@2x~universal~anyany.png',
+ 'target': 'Default@2x~universal~anyany.png'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "com",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "com",
- "height": "any"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "any",
- "height": "com"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "universal",
- "scale": "3x",
- "width": "any",
- "height": "any"
+ 'idiom': 'universal',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "com",
- "height": "com"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "com",
- "height": "any"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "any",
- "height": "com"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "ipad",
- "scale": "1x",
- "width": "any",
- "height": "any"
+ 'idiom': 'ipad',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "com",
- "height": "com",
- "filename": "Default@2x~ipad~comcom.png",
- "src": "res/splash/ios/Default@2x~ipad~comcom.png",
- "target": "Default@2x~ipad~comcom.png"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com',
+ 'filename': 'Default@2x~ipad~comcom.png',
+ 'src': 'res/splash/ios/Default@2x~ipad~comcom.png',
+ 'target': 'Default@2x~ipad~comcom.png'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "com",
- "height": "any",
- "filename": "Default@2x~ipad~comany.png",
- "src": "res/splash/ios/Default@2x~ipad~comany.png",
- "target": "Default@2x~ipad~comany.png"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any',
+ 'filename': 'Default@2x~ipad~comany.png',
+ 'src': 'res/splash/ios/Default@2x~ipad~comany.png',
+ 'target': 'Default@2x~ipad~comany.png'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "any",
- "height": "com"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "ipad",
- "scale": "2x",
- "width": "any",
- "height": "any",
- "filename": "Default@2x~ipad~anyany.png",
- "src": "res/splash/ios/Default@2x~ipad~anyany.png",
- "target": "Default@2x~ipad~anyany.png"
+ 'idiom': 'ipad',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any',
+ 'filename': 'Default@2x~ipad~anyany.png',
+ 'src': 'res/splash/ios/Default@2x~ipad~anyany.png',
+ 'target': 'Default@2x~ipad~anyany.png'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "com",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "com",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "any",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "1x",
- "width": "any",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '1x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "com",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "com",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'com',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "any",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "2x",
- "width": "any",
- "height": "any"
+ 'idiom': 'iphone',
+ 'scale': '2x',
+ 'width': 'any',
+ 'height': 'any'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "com",
- "height": "com"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'com'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "com",
- "height": "any",
- "filename": "Default@3x~iphone~comany.png",
- "src": "res/splash/ios/Default@3x~iphone~comany.png",
- "target": "Default@3x~iphone~comany.png"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'com',
+ 'height': 'any',
+ 'filename': 'Default@3x~iphone~comany.png',
+ 'src': 'res/splash/ios/Default@3x~iphone~comany.png',
+ 'target': 'Default@3x~iphone~comany.png'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "any",
- "height": "com",
- "filename": "Default@3x~iphone~anycom.png",
- "src": "res/splash/ios/Default@3x~iphone~anycom.png",
- "target": "Default@3x~iphone~anycom.png"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'com',
+ 'filename': 'Default@3x~iphone~anycom.png',
+ 'src': 'res/splash/ios/Default@3x~iphone~anycom.png',
+ 'target': 'Default@3x~iphone~anycom.png'
},
{
- "idiom": "iphone",
- "scale": "3x",
- "width": "any",
- "height": "any",
- "filename": "Default@3x~iphone~anyany.png",
- "src": "res/splash/ios/Default@3x~iphone~anyany.png",
- "target": "Default@3x~iphone~anyany.png"
+ 'idiom': 'iphone',
+ 'scale': '3x',
+ 'width': 'any',
+ 'height': 'any',
+ 'filename': 'Default@3x~iphone~anyany.png',
+ 'src': 'res/splash/ios/Default@3x~iphone~anyany.png',
+ 'target': 'Default@3x~iphone~anyany.png'
}
];
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/fixtures/org.test.plugins.dummyplugin/www/dummyplugin.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/fixtures/org.test.plugins.dummyplugin/www/dummyplugin.js b/tests/spec/unit/fixtures/org.test.plugins.dummyplugin/www/dummyplugin.js
index 631d6da..deba887 100644
--- a/tests/spec/unit/fixtures/org.test.plugins.dummyplugin/www/dummyplugin.js
+++ b/tests/spec/unit/fixtures/org.test.plugins.dummyplugin/www/dummyplugin.js
@@ -1 +1,2 @@
-./org.test.plugins.dummyplugin/www/dummyplugin.js
+/* eslint-disable */
+org.test.plugins.dummyplugin/www/dummyplugin.js
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/lib/list-devices.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/lib/list-devices.spec.js b/tests/spec/unit/lib/list-devices.spec.js
index 0a5b293..9b50a6b 100644
--- a/tests/spec/unit/lib/list-devices.spec.js
+++ b/tests/spec/unit/lib/list-devices.spec.js
@@ -35,14 +35,14 @@ describe('cordova/lib/list-devices', function () {
it('should trim and split standard output and return as array', function (done) {
Q.all.and.returnValue(Q.resolve([[' this is\nmy sweet\nstdout\n ']]));
list_devices.run()
- .then(function (results) {
- expect(results).toContain('this is');
- expect(results).toContain('my sweet');
- expect(results).toContain('stdout');
- }).fail(function (err) {
- fail('list-devices fail handler unexpectedly invoked');
- console.error(err);
- }).done(done);
+ .then(function (results) {
+ expect(results).toContain('this is');
+ expect(results).toContain('my sweet');
+ expect(results).toContain('stdout');
+ }).fail(function (err) {
+ fail('list-devices fail handler unexpectedly invoked');
+ console.error(err);
+ }).done(done);
});
});
});
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/lib/run.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/lib/run.spec.js b/tests/spec/unit/lib/run.spec.js
index 4566e15..1d7aed3 100644
--- a/tests/spec/unit/lib/run.spec.js
+++ b/tests/spec/unit/lib/run.spec.js
@@ -46,13 +46,13 @@ if (process.platform === 'darwin') {
});
it('should delegate to to both listEmulators and listDevices methods if neither `options.device` nor `options.emulator` are specified', function (done) {
run.run({list: true})
- .then(function () {
- expect(run.listDevices).toHaveBeenCalled();
- expect(run.listEmulators).toHaveBeenCalled();
- }).fail(function (err) {
- fail('run fail handler unexpectedly invoked');
- console.error(err);
- }).done(done);
+ .then(function () {
+ expect(run.listDevices).toHaveBeenCalled();
+ expect(run.listEmulators).toHaveBeenCalled();
+ }).fail(function (err) {
+ fail('run fail handler unexpectedly invoked');
+ console.error(err);
+ }).done(done);
});
});
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[3/5] ios commit: CB-12895 : removed jshint and added eslint
Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/Api.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/Api.spec.js b/tests/spec/unit/Api.spec.js
index a08b32e..14e178e 100644
--- a/tests/spec/unit/Api.spec.js
+++ b/tests/spec/unit/Api.spec.js
@@ -43,13 +43,13 @@ var iosProjectFixture = path.join(FIXTURES, 'ios-config-xml');
describe('Platform Api', function () {
- describe('constructor', function() {
- it('Test 001 : should throw if provided directory does not contain an xcodeproj file', function() {
- expect(function() { new Api('ios', path.join(FIXTURES, '..')); }).toThrow();
+ describe('constructor', function () {
+ it('Test 001 : should throw if provided directory does not contain an xcodeproj file', function () {
+ expect(function () { new Api('ios', path.join(FIXTURES, '..')); }).toThrow(); /* eslint no-new : 0 */
});
- it('Test 002 : should create an instance with path, pbxproj, xcodeproj, originalName and cordovaproj properties', function() {
- expect(function() {
- var p = new Api('ios',iosProjectFixture);
+ it('Test 002 : should create an instance with path, pbxproj, xcodeproj, originalName and cordovaproj properties', function () {
+ expect(function () {
+ var p = new Api('ios', iosProjectFixture);
expect(p.locations.root).toEqual(iosProjectFixture);
expect(p.locations.pbxproj).toEqual(path.join(iosProjectFixture, 'SampleApp.xcodeproj', 'project.pbxproj'));
expect(p.locations.xcodeProjDir).toEqual(path.join(iosProjectFixture, 'SampleApp.xcodeproj'));
@@ -57,70 +57,70 @@ describe('Platform Api', function () {
expect(p.locations.configXml).toEqual(path.join(iosProjectFixture, 'SampleApp', 'config.xml'));
}).not.toThrow();
});
- it('Test 003 : test cocoapods check_reqs, on darwin (macOS)', function(done) {
+ it('Test 003 : test cocoapods check_reqs, on darwin (macOS)', function (done) {
// the purpose of this test is not to actually test whether CocoaPods is installed
// it is to test check_reqs can run and be covered (we mock the actual checking, simple check)
check_reqs.check_os()
- .then(function(message) {
- // supported os
- function fail() {
- done.fail('check_reqs fail (' + message + ')');
- }
- function success() {
- done();
- }
- var toolsChecker = {
- success: function() {
- return Q.resolve('CocoaPods found');
- },
- fail: function() {
- return Q.reject('CocoaPods NOT found');
+ .then(function (message) {
+ // supported os
+ function fail () {
+ done.fail('check_reqs fail (' + message + ')');
}
- };
+ function success () {
+ done();
+ }
+ var toolsChecker = {
+ success: function () {
+ return Q.resolve('CocoaPods found');
+ },
+ fail: function () {
+ return Q.reject('CocoaPods NOT found');
+ }
+ };
- // success expected
- check_reqs.check_cocoapods(toolsChecker.success)
- .then(success, fail)
- .catch(fail);
+ // success expected
+ check_reqs.check_cocoapods(toolsChecker.success)
+ .then(success, fail)
+ .catch(fail);
- // fail expected
- check_reqs.check_cocoapods(toolsChecker.fail)
- .then(fail, success)
- .catch(success);
-
- }, function(){
- // unsupported os, do nothing
- done();
- });
+ // fail expected
+ check_reqs.check_cocoapods(toolsChecker.fail)
+ .then(fail, success)
+ .catch(success);
+
+ }, function () {
+ // unsupported os, do nothing
+ done();
+ });
});
- it('Test 004 : test cocoapods check_reqs, expected success on non-darwin (macOS)', function(done) {
+ it('Test 004 : test cocoapods check_reqs, expected success on non-darwin (macOS)', function (done) {
// the purpose of this test is not to actually test whether CocoaPods is installed
// it is to test check_reqs can run and be covered (we mock the actual checking, simple check)
check_reqs.check_os()
- .then(function(){
- // supported os, do nothing
- done();
- }, function(message) {
- // unsupported os, check_reqs should be ignored
- function fail() {
- done.fail('check_reqs fail (' + message + ')');
- }
- function success(toolOptions) {
- expect(toolOptions.ignore).toBeDefined();
- expect(toolOptions.ignoreMessage).toBeDefined();
+ .then(function () {
+ // supported os, do nothing
done();
- }
- var toolsChecker = function () {
- done.fail(); // this function should not ever be called if non-darwin
- return Q.reject('CocoaPods NOT found');
- };
+ }, function (message) {
+ // unsupported os, check_reqs should be ignored
+ function fail () {
+ done.fail('check_reqs fail (' + message + ')');
+ }
+ function success (toolOptions) {
+ expect(toolOptions.ignore).toBeDefined();
+ expect(toolOptions.ignoreMessage).toBeDefined();
+ done();
+ }
+ var toolsChecker = function () {
+ done.fail(); // this function should not ever be called if non-darwin
+ return Q.reject('CocoaPods NOT found');
+ };
- // success expected
- check_reqs.check_cocoapods(toolsChecker)
- .then(success, fail)
- .catch(fail);
- });
+ // success expected
+ check_reqs.check_cocoapods(toolsChecker)
+ .then(success, fail)
+ .catch(fail);
+ });
});
});
@@ -198,45 +198,45 @@ describe('Platform Api', function () {
});
spyOn(events, 'emit');
api.addPlugin(my_plugin)
- .then(function () {
- expect(events.emit).toHaveBeenCalledWith('warn', jasmine.stringMatching(/which conflicts with another plugin/g));
- }).fail(function (err) {
- fail('unexpected addPlugin fail handler invoked');
- console.error(err);
- }).done(done);
+ .then(function () {
+ expect(events.emit).toHaveBeenCalledWith('warn', jasmine.stringMatching(/which conflicts with another plugin/g));
+ }).fail(function (err) {
+ fail('unexpected addPlugin fail handler invoked');
+ console.error(err);
+ }).done(done);
});
it('should increment Pods JSON file if pod name/src already exists in file', function (done) {
podsjson_mock.get.and.returnValue({
spec: my_pod_json.spec
});
api.addPlugin(my_plugin)
- .then(function () {
- expect(podsjson_mock.increment).toHaveBeenCalledWith('podsource!');
- }).fail(function (err) {
- fail('unexpected addPlugin fail handler invoked');
- console.error(err);
- }).done(done);
+ .then(function () {
+ expect(podsjson_mock.increment).toHaveBeenCalledWith('podsource!');
+ }).fail(function (err) {
+ fail('unexpected addPlugin fail handler invoked');
+ console.error(err);
+ }).done(done);
});
it('on a new framework/pod name/src/key, it should add a new json to podsjson and add a new spec to podfile', function (done) {
api.addPlugin(my_plugin)
- .then(function () {
- expect(podsjson_mock.setJson).toHaveBeenCalledWith(my_pod_json.src, jasmine.any(Object));
- expect(podfile_mock.addSpec).toHaveBeenCalledWith(my_pod_json.src, my_pod_json.spec);
- }).fail(function (err) {
- fail('unexpected addPlugin fail handler invoked');
- console.error(err);
- }).done(done);
+ .then(function () {
+ expect(podsjson_mock.setJson).toHaveBeenCalledWith(my_pod_json.src, jasmine.any(Object));
+ expect(podfile_mock.addSpec).toHaveBeenCalledWith(my_pod_json.src, my_pod_json.spec);
+ }).fail(function (err) {
+ fail('unexpected addPlugin fail handler invoked');
+ console.error(err);
+ }).done(done);
});
it('should write out podfile and install if podfile was changed', function (done) {
podfile_mock.isDirty.and.returnValue(true);
api.addPlugin(my_plugin)
- .then(function () {
- expect(podfile_mock.write).toHaveBeenCalled();
- expect(podfile_mock.install).toHaveBeenCalled();
- }).fail(function (err) {
- fail('unexpected addPlugin fail handler invoked');
- console.error(err);
- }).done(done);
+ .then(function () {
+ expect(podfile_mock.write).toHaveBeenCalled();
+ expect(podfile_mock.install).toHaveBeenCalled();
+ }).fail(function (err) {
+ fail('unexpected addPlugin fail handler invoked');
+ console.error(err);
+ }).done(done);
});
it('if two frameworks with the same name are added, should honour the spec of the first-installed plugin', function (done) {
spyOn(events, 'emit');
@@ -244,15 +244,15 @@ describe('Platform Api', function () {
spec: 'something different from ' + my_pod_json.spec
});
api.addPlugin(my_plugin)
- .then(function () {
- // Increment will non-destructively set the spec to keep it as it was...
- expect(podsjson_mock.increment).toHaveBeenCalledWith(my_pod_json.src);
- // ...whereas setJson would overwrite it completely.
- expect(podsjson_mock.setJson).not.toHaveBeenCalled();
- }).fail(function (err) {
- fail('unexpected addPlugin fail handler invoked');
- console.error(err);
- }).done(done);
+ .then(function () {
+ // Increment will non-destructively set the spec to keep it as it was...
+ expect(podsjson_mock.increment).toHaveBeenCalledWith(my_pod_json.src);
+ // ...whereas setJson would overwrite it completely.
+ expect(podsjson_mock.setJson).not.toHaveBeenCalled();
+ }).fail(function (err) {
+ fail('unexpected addPlugin fail handler invoked');
+ console.error(err);
+ }).done(done);
});
});
});
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/Plugman/common.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/Plugman/common.spec.js b/tests/spec/unit/Plugman/common.spec.js
index 7a0c344..5608c51 100644
--- a/tests/spec/unit/Plugman/common.spec.js
+++ b/tests/spec/unit/Plugman/common.spec.js
@@ -37,25 +37,25 @@ var copyFile = common.__get__('copyFile');
var copyNewFile = common.__get__('copyNewFile');
var removeFileAndParents = common.__get__('removeFileAndParents');
-describe('common handler routines', function() {
+describe('common handler routines', function () {
- describe('copyFile', function() {
- it('Test 001 : should throw if source path not found', function(){
+ describe('copyFile', function () {
+ it('Test 001 : should throw if source path not found', function () {
shell.rm('-rf', test_dir);
- expect(function(){copyFile(test_dir, src, project_dir, dest);}).
- toThrow(new Error('"' + src + '" not found!'));
+ expect(function () { copyFile(test_dir, src, project_dir, dest); })
+ .toThrow(new Error('"' + src + '" not found!'));
});
- it('Test 002 : should throw if src not in plugin directory', function(){
+ it('Test 002 : should throw if src not in plugin directory', function () {
shell.mkdir('-p', project_dir);
fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
var outside_file = '../non_plugin_file';
- expect(function(){copyFile(test_dir, outside_file, project_dir, dest);}).
- toThrow(new Error('File "' + path.resolve(test_dir, outside_file) + '" is located outside the plugin directory "' + test_dir + '"'));
+ expect(function () { copyFile(test_dir, outside_file, project_dir, dest); })
+ .toThrow(new Error('File "' + path.resolve(test_dir, outside_file) + '" is located outside the plugin directory "' + test_dir + '"'));
shell.rm('-rf', test_dir);
});
- it('Test 003 : should allow symlink src, if inside plugin', function(){
+ it('Test 003 : should allow symlink src, if inside plugin', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
@@ -68,7 +68,7 @@ describe('common handler routines', function() {
shell.rm('-rf', project_dir);
});
- it('Test 004 : should throw if symlink is linked to a file outside the plugin', function(){
+ it('Test 004 : should throw if symlink is linked to a file outside the plugin', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(non_plugin_file, 'contents', 'utf-8');
@@ -77,20 +77,20 @@ describe('common handler routines', function() {
return;
}
- expect(function(){copyFile(test_dir, symlink_file, project_dir, dest);}).
- toThrow(new Error('File "' + path.resolve(test_dir, symlink_file) + '" is located outside the plugin directory "' + test_dir + '"'));
+ expect(function () { copyFile(test_dir, symlink_file, project_dir, dest); })
+ .toThrow(new Error('File "' + path.resolve(test_dir, symlink_file) + '" is located outside the plugin directory "' + test_dir + '"'));
shell.rm('-rf', project_dir);
});
- it('Test 005 : should throw if dest is outside the project directory', function(){
+ it('Test 005 : should throw if dest is outside the project directory', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
- expect(function(){copyFile(test_dir, srcFile, project_dir, non_plugin_file);}).
- toThrow(new Error('Destination "' + path.resolve(project_dir, non_plugin_file) + '" for source file "' + path.resolve(test_dir, srcFile) + '" is located outside the project'));
+ expect(function () { copyFile(test_dir, srcFile, project_dir, non_plugin_file); })
+ .toThrow(new Error('Destination "' + path.resolve(project_dir, non_plugin_file) + '" for source file "' + path.resolve(test_dir, srcFile) + '" is located outside the project'));
shell.rm('-rf', project_dir);
});
- it('Test 006 : should call mkdir -p on target path', function(){
+ it('Test 006 : should call mkdir -p on target path', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
@@ -104,7 +104,7 @@ describe('common handler routines', function() {
shell.rm('-rf', project_dir);
});
- it('Test 007 : should call cp source/dest paths', function(){
+ it('Test 007 : should call cp source/dest paths', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
@@ -122,17 +122,17 @@ describe('common handler routines', function() {
});
describe('copyNewFile', function () {
- it('Test 008 : should throw if target path exists', function(){
+ it('Test 008 : should throw if target path exists', function () {
shell.mkdir('-p', dest);
- expect(function(){copyNewFile(test_dir, src, project_dir, dest);}).
- toThrow(new Error('"' + dest + '" already exists!'));
+ expect(function () { copyNewFile(test_dir, src, project_dir, dest); })
+ .toThrow(new Error('"' + dest + '" already exists!'));
shell.rm('-rf', dest);
});
});
- describe('deleteJava', function() {
- it('Test 009 : should call fs.unlinkSync on the provided paths', function(){
+ describe('deleteJava', function () {
+ it('Test 009 : should call fs.unlinkSync on the provided paths', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
@@ -144,19 +144,19 @@ describe('common handler routines', function() {
shell.rm('-rf', srcDirTree);
});
- it('Test 010 : should delete empty directories after removing source code in path hierarchy', function(){
+ it('Test 010 : should delete empty directories after removing source code in path hierarchy', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
removeFileAndParents(project_dir, srcFile);
expect(fs.existsSync(srcFile)).not.toBe(true);
expect(fs.existsSync(srcDirTree)).not.toBe(true);
- expect(fs.existsSync(path.join(src,'one'))).not.toBe(true);
+ expect(fs.existsSync(path.join(src, 'one'))).not.toBe(true);
shell.rm('-rf', srcDirTree);
});
- it('Test 011 : should delete the top-level src directory if all plugins added were removed', function(){
+ it('Test 011 : should delete the top-level src directory if all plugins added were removed', function () {
shell.mkdir('-p', srcDirTree);
fs.writeFileSync(srcFile, 'contents', 'utf-8');
@@ -168,7 +168,7 @@ describe('common handler routines', function() {
});
});
-function ignoreEPERMonWin32(symlink_src, symlink_dest) {
+function ignoreEPERMonWin32 (symlink_src, symlink_dest) {
try {
fs.symlinkSync(symlink_src, symlink_dest);
} catch (e) {
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/Plugman/pluginHandler.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/Plugman/pluginHandler.spec.js b/tests/spec/unit/Plugman/pluginHandler.spec.js
index ee4fabe..00d2911 100644
--- a/tests/spec/unit/Plugman/pluginHandler.spec.js
+++ b/tests/spec/unit/Plugman/pluginHandler.spec.js
@@ -38,36 +38,35 @@ var weblessplugin = path.join(FIXTURES, 'org.test.plugins.weblessplugin');
var dummyPluginInfo = new PluginInfo(dummyplugin);
var dummy_id = dummyPluginInfo.id;
-var valid_source = dummyPluginInfo.getSourceFiles('ios'),
- valid_headers = dummyPluginInfo.getHeaderFiles('ios'),
- valid_resources = dummyPluginInfo.getResourceFiles('ios'),
- valid_custom_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function(f) { return f.custom; }),
- valid_embeddable_custom_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function(f) { return f.custom && f.embed; }),
- valid_weak_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function(f) { return !(f.custom) && f.weak; });
-
+var valid_source = dummyPluginInfo.getSourceFiles('ios');
+var valid_headers = dummyPluginInfo.getHeaderFiles('ios');
+var valid_resources = dummyPluginInfo.getResourceFiles('ios');
+var valid_custom_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function (f) { return f.custom; });
+var valid_embeddable_custom_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function (f) { return f.custom && f.embed; });
+var valid_weak_frameworks = dummyPluginInfo.getFrameworks('ios').filter(function (f) { return !(f.custom) && f.weak; });
var faultyPluginInfo = new PluginInfo(faultyplugin);
var invalid_source = faultyPluginInfo.getSourceFiles('ios');
var invalid_headers = faultyPluginInfo.getHeaderFiles('ios');
var invalid_resources = faultyPluginInfo.getResourceFiles('ios');
-var invalid_custom_frameworks = faultyPluginInfo.getFrameworks('ios').filter(function(f) { return f.custom; });
+var invalid_custom_frameworks = faultyPluginInfo.getFrameworks('ios').filter(function (f) { return f.custom; });
var weblessPluginInfo = new PluginInfo(weblessplugin);
-function copyArray(arr) {
+function copyArray (arr) {
return Array.prototype.slice.call(arr, 0);
}
-function slashJoin() {
+function slashJoin () {
// In some places we need to use forward slash instead of path.join().
// See CB-7311.
return Array.prototype.join.call(arguments, '/');
}
-describe('ios plugin handler', function() {
+describe('ios plugin handler', function () {
var dummyProject;
- beforeEach(function() {
+ beforeEach(function () {
shell.cp('-rf', iosProject, temp);
projectFile.purgeProjectFileCache(temp);
@@ -77,151 +76,151 @@ describe('ios plugin handler', function() {
});
});
- afterEach(function() {
+ afterEach(function () {
shell.rm('-rf', temp);
});
- describe('installation', function() {
+ describe('installation', function () {
- describe('of <source-file> elements', function() {
+ describe('of <source-file> elements', function () {
var install = pluginHandlers.getInstaller('source-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'addSourceFile');
});
- it('Test 001 : should throw if source-file src cannot be found', function() {
+ it('Test 001 : should throw if source-file src cannot be found', function () {
var source = copyArray(invalid_source);
- expect(function() {
+ expect(function () {
install(source[1], faultyPluginInfo, dummyProject);
}).toThrow();
});
- it('Test 002 : should throw if source-file target already exists', function() {
+ it('Test 002 : should throw if source-file target already exists', function () {
var source = copyArray(valid_source);
var target = path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.m');
shell.mkdir('-p', path.dirname(target));
fs.writeFileSync(target, 'some bs', 'utf-8');
- expect(function() {
+ expect(function () {
install(source[0], dummyPluginInfo, dummyProject);
}).toThrow();
});
- it('Test 003 : should call into xcodeproj\'s addSourceFile appropriately when element has no target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 003 : should call into xcodeproj\'s addSourceFile appropriately when element has no target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir === undefined; });
install(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addSourceFile)
.toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.m'), {});
});
- it('Test 004 : should call into xcodeproj\'s addSourceFile appropriately when element has a target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 004 : should call into xcodeproj\'s addSourceFile appropriately when element has a target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir !== undefined; });
install(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addSourceFile)
.toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'), {});
});
- it('Test 005 : should cp the file to the right target location when element has no target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 005 : should cp the file to the right target location when element has no target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir === undefined; });
var spy = spyOn(shell, 'cp');
install(source[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.m'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.m'));
});
- it('Test 006 : should cp the file to the right target location when element has a target-dir', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 006 : should cp the file to the right target location when element has a target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir !== undefined; });
var spy = spyOn(shell, 'cp');
install(source[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'TargetDirTest.m'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
});
- it('Test 007 : should call into xcodeproj\'s addFramework appropriately when element has framework=true set', function() {
- var source = copyArray(valid_source).filter(function(s) { return s.framework; });
+ it('Test 007 : should call into xcodeproj\'s addFramework appropriately when element has framework=true set', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.framework; });
spyOn(dummyProject.xcode, 'addFramework');
install(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addFramework)
- .toHaveBeenCalledWith(path.join('SampleApp', 'Plugins', dummy_id, 'SourceWithFramework.m'), {weak:false});
+ .toHaveBeenCalledWith(path.join('SampleApp', 'Plugins', dummy_id, 'SourceWithFramework.m'), {weak: false});
});
});
- describe('of <header-file> elements', function() {
+ describe('of <header-file> elements', function () {
var install = pluginHandlers.getInstaller('header-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'addHeaderFile');
});
- it('Test 008 : should throw if header-file src cannot be found', function() {
+ it('Test 008 : should throw if header-file src cannot be found', function () {
var headers = copyArray(invalid_headers);
- expect(function() {
+ expect(function () {
install(headers[1], faultyPluginInfo, dummyProject);
}).toThrow();
});
- it('Test 009 : should throw if header-file target already exists', function() {
+ it('Test 009 : should throw if header-file target already exists', function () {
var headers = copyArray(valid_headers);
var target = path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.h');
shell.mkdir('-p', path.dirname(target));
fs.writeFileSync(target, 'some bs', 'utf-8');
- expect(function() {
+ expect(function () {
install(headers[0], dummyPluginInfo, dummyProject);
}).toThrow();
});
- it('Test 010 : should call into xcodeproj\'s addHeaderFile appropriately when element has no target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 010 : should call into xcodeproj\'s addHeaderFile appropriately when element has no target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir === undefined; });
install(headers[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addHeaderFile)
.toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.h'));
});
- it('Test 011 : should call into xcodeproj\'s addHeaderFile appropriately when element a target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 011 : should call into xcodeproj\'s addHeaderFile appropriately when element a target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir !== undefined; });
install(headers[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addHeaderFile)
.toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
});
- it('Test 012 : should cp the file to the right target location when element has no target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 012 : should cp the file to the right target location when element has no target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir === undefined; });
var spy = spyOn(shell, 'cp');
install(headers[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'DummyPluginCommand.h'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'DummyPluginCommand.h'));
});
- it('Test 013 : should cp the file to the right target location when element has a target-dir', function() {
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 013 : should cp the file to the right target location when element has a target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir !== undefined; });
var spy = spyOn(shell, 'cp');
install(headers[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'TargetDirTest.h'), path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
});
});
- describe('of <resource-file> elements', function() {
+ describe('of <resource-file> elements', function () {
var install = pluginHandlers.getInstaller('resource-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'addResourceFile');
});
- it('Test 014 : should throw if resource-file src cannot be found', function() {
+ it('Test 014 : should throw if resource-file src cannot be found', function () {
var resources = copyArray(invalid_resources);
- expect(function() {
+ expect(function () {
install(resources[0], faultyPluginInfo, dummyProject);
- }).toThrow(new Error ('Cannot find resource file "' + path.resolve(faultyplugin, 'src/ios/IDontExist.bundle') + '" for plugin ' + faultyPluginInfo.id + ' in iOS platform'));
+ }).toThrow(new Error('Cannot find resource file "' + path.resolve(faultyplugin, 'src/ios/IDontExist.bundle') + '" for plugin ' + faultyPluginInfo.id + ' in iOS platform'));
});
- it('Test 015 : should throw if resource-file target already exists', function() {
+ it('Test 015 : should throw if resource-file target already exists', function () {
var resources = copyArray(valid_resources);
var target = path.join(temp, 'SampleApp', 'Resources', 'DummyPlugin.bundle');
shell.mkdir('-p', path.dirname(target));
fs.writeFileSync(target, 'some bs', 'utf-8');
- expect(function() {
+ expect(function () {
install(resources[0], dummyPluginInfo, dummyProject);
}).toThrow(new Error('File already exists at destination "' + target + '" for resource file specified by plugin ' + dummyPluginInfo.id + ' in iOS platform'));
});
- it('Test 016 : should call into xcodeproj\'s addResourceFile', function() {
+ it('Test 016 : should call into xcodeproj\'s addResourceFile', function () {
var resources = copyArray(valid_resources);
install(resources[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addResourceFile)
.toHaveBeenCalledWith(path.join('Resources', 'DummyPlugin.bundle'));
});
- it('Test 017 : should cp the file to the right target location', function() {
+ it('Test 017 : should cp the file to the right target location', function () {
var resources = copyArray(valid_resources);
var spy = spyOn(shell, 'cp');
install(resources[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-f', path.join(dummyplugin, 'src', 'ios', 'DummyPlugin.bundle'), path.join(temp, 'SampleApp', 'Resources', 'DummyPlugin.bundle'));
});
- it('Test 018 : should link files to the right target location', function() {
+ it('Test 018 : should link files to the right target location', function () {
var resources = copyArray(valid_resources);
var spy = spyOn(fs, 'linkSync');
install(resources[0], dummyPluginInfo, dummyProject, { link: true });
@@ -231,14 +230,14 @@ describe('ios plugin handler', function() {
});
});
- describe('of <framework> elements', function() {
+ describe('of <framework> elements', function () {
var install = pluginHandlers.getInstaller('framework');
beforeEach(function () {
spyOn(dummyProject.xcode, 'addFramework');
});
- it('Test 019 : should call into xcodeproj\'s addFramework', function() {
+ it('Test 019 : should call into xcodeproj\'s addFramework', function () {
var frameworks = copyArray(valid_custom_frameworks);
install(frameworks[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.addFramework)
@@ -260,29 +259,29 @@ describe('ios plugin handler', function() {
// * framework that shouldn't be added/removed
describe('with custom="true" attribute', function () {
- it('Test 020 : should throw if framework src cannot be found', function() {
+ it('Test 020 : should throw if framework src cannot be found', function () {
var frameworks = copyArray(invalid_custom_frameworks);
- expect(function() {
+ expect(function () {
install(frameworks[0], faultyPluginInfo, dummyProject);
- }).toThrow(new Error ('Cannot find framework "' + path.resolve(faultyplugin, 'src/ios/NonExistantCustomFramework.framework') + '" for plugin ' + faultyPluginInfo.id + ' in iOS platform'));
+ }).toThrow(new Error('Cannot find framework "' + path.resolve(faultyplugin, 'src/ios/NonExistantCustomFramework.framework') + '" for plugin ' + faultyPluginInfo.id + ' in iOS platform'));
});
- it('Test 021 : should throw if framework target already exists', function() {
+ it('Test 021 : should throw if framework target already exists', function () {
var frameworks = copyArray(valid_custom_frameworks);
var target = path.join(temp, 'SampleApp/Plugins/org.test.plugins.dummyplugin/Custom.framework');
shell.mkdir('-p', target);
- expect(function() {
+ expect(function () {
install(frameworks[0], dummyPluginInfo, dummyProject);
- }).toThrow(new Error ('Framework "' + target + '" for plugin ' + dummyPluginInfo.id + ' already exists in iOS platform'));
+ }).toThrow(new Error('Framework "' + target + '" for plugin ' + dummyPluginInfo.id + ' already exists in iOS platform'));
});
- it('Test 022 : should cp the file to the right target location', function() {
+ it('Test 022 : should cp the file to the right target location', function () {
var frameworks = copyArray(valid_custom_frameworks);
var spy = spyOn(shell, 'cp');
install(frameworks[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-Rf', path.join(dummyplugin, 'src', 'ios', 'Custom.framework', '*'),
- path.join(temp, 'SampleApp/Plugins/org.test.plugins.dummyplugin/Custom.framework'));
+ path.join(temp, 'SampleApp/Plugins/org.test.plugins.dummyplugin/Custom.framework'));
});
- it('Test 023 : should deep symlink files to the right target location', function() {
+ it('Test 023 : should deep symlink files to the right target location', function () {
var frameworks = copyArray(valid_custom_frameworks);
var spy = spyOn(fs, 'linkSync');
install(frameworks[0], dummyPluginInfo, dummyProject, { link: true });
@@ -293,7 +292,7 @@ describe('ios plugin handler', function() {
});
});
- describe('of <js-module> elements', function() {
+ describe('of <js-module> elements', function () {
var jsModule = {src: 'www/dummyplugin.js'};
var install = pluginHandlers.getInstaller('js-module');
var wwwDest, platformWwwDest;
@@ -317,10 +316,13 @@ describe('ios plugin handler', function() {
});
});
- describe('of <asset> elements', function() {
+ describe('of <asset> elements', function () {
var asset = {src: 'www/dummyplugin.js', target: 'foo/dummy.js'};
var install = pluginHandlers.getInstaller('asset');
- var wwwDest, platformWwwDest;
+ /* eslint-disable no-unused-vars */
+ var wwwDest;
+ var platformWwwDest;
+ /* eslint-enable no-unused-vars */
beforeEach(function () {
spyOn(shell, 'cp');
@@ -341,115 +343,115 @@ describe('ios plugin handler', function() {
});
});
- it('Test 028 : of two plugins should apply xcode file changes from both', function(done){
+ it('Test 028 : of two plugins should apply xcode file changes from both', function (done) {
var api = new Api('ios', temp);
var fail = jasmine.createSpy('fail');
api.addPlugin(dummyPluginInfo)
- .then(function () {
- return api.addPlugin(weblessPluginInfo);
- })
- .fail(fail)
- .done(function() {
- expect(fail).not.toHaveBeenCalled();
-
- var xcode = projectFile.parse({
- root: temp,
- pbxproj: path.join(temp, 'SampleApp.xcodeproj/project.pbxproj')
- }).xcode;
-
- // from org.test.plugins.dummyplugin
- expect(xcode.hasFile(slashJoin('Resources', 'DummyPlugin.bundle'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin', 'DummyPluginCommand.h'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin', 'DummyPluginCommand.m'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin','targetDir','TargetDirTest.h'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.dummyplugin','targetDir','TargetDirTest.m'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('SampleApp','Plugins','org.test.plugins.dummyplugin','Custom.framework'))).toEqual(jasmine.any(Object));
- // from org.test.plugins.weblessplugin
- expect(xcode.hasFile(slashJoin('Resources', 'WeblessPluginViewController.xib'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.h'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile(slashJoin('Plugins','org.test.plugins.weblessplugin','WeblessPluginCommand.m'))).toEqual(jasmine.any(Object));
- expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toEqual(jasmine.any(Object));
-
- done();
- });
+ .then(function () {
+ return api.addPlugin(weblessPluginInfo);
+ })
+ .fail(fail)
+ .done(function () {
+ expect(fail).not.toHaveBeenCalled();
+
+ var xcode = projectFile.parse({
+ root: temp,
+ pbxproj: path.join(temp, 'SampleApp.xcodeproj/project.pbxproj')
+ }).xcode;
+
+ // from org.test.plugins.dummyplugin
+ expect(xcode.hasFile(slashJoin('Resources', 'DummyPlugin.bundle'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.dummyplugin', 'DummyPluginCommand.h'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.dummyplugin', 'DummyPluginCommand.m'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.dummyplugin', 'targetDir', 'TargetDirTest.h'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.dummyplugin', 'targetDir', 'TargetDirTest.m'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('SampleApp', 'Plugins', 'org.test.plugins.dummyplugin', 'Custom.framework'))).toEqual(jasmine.any(Object));
+ // from org.test.plugins.weblessplugin
+ expect(xcode.hasFile(slashJoin('Resources', 'WeblessPluginViewController.xib'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.weblessplugin', 'WeblessPluginCommand.h'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile(slashJoin('Plugins', 'org.test.plugins.weblessplugin', 'WeblessPluginCommand.m'))).toEqual(jasmine.any(Object));
+ expect(xcode.hasFile('usr/lib/libsqlite3.dylib')).toEqual(jasmine.any(Object));
+
+ done();
+ });
});
});
- describe('uninstallation', function() {
- describe('of <source-file> elements', function() {
+ describe('uninstallation', function () {
+ describe('of <source-file> elements', function () {
var uninstall = pluginHandlers.getUninstaller('source-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'removeSourceFile');
spyOn(dummyProject.xcode, 'removeFramework');
});
- it('Test 029 : should call into xcodeproj\'s removeSourceFile appropriately when element has no target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 029 : should call into xcodeproj\'s removeSourceFile appropriately when element has no target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir === undefined; });
uninstall(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeSourceFile).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.m'));
});
- it('Test 030 : should call into xcodeproj\'s removeSourceFile appropriately when element a target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 030 : should call into xcodeproj\'s removeSourceFile appropriately when element a target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir !== undefined; });
uninstall(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeSourceFile).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.m'));
});
- it('Test 031 : should rm the file from the right target location when element has no target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 031 : should rm the file from the right target location when element has no target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir === undefined; });
var spy = spyOn(shell, 'rm');
uninstall(source[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id));
});
- it('Test 032 : should rm the file from the right target location when element has a target-dir', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 032 : should rm the file from the right target location when element has a target-dir', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.targetDir !== undefined; });
var spy = spyOn(shell, 'rm');
uninstall(source[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir'));
});
- it('Test 033 : should call into xcodeproj\'s removeFramework appropriately when element framework=true set', function(){
- var source = copyArray(valid_source).filter(function(s) { return s.framework; });
+ it('Test 033 : should call into xcodeproj\'s removeFramework appropriately when element framework=true set', function () {
+ var source = copyArray(valid_source).filter(function (s) { return s.framework; });
uninstall(source[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeFramework).toHaveBeenCalledWith(path.join('SampleApp', 'Plugins', dummy_id, 'SourceWithFramework.m'));
});
});
- describe('of <header-file> elements', function() {
+ describe('of <header-file> elements', function () {
var uninstall = pluginHandlers.getUninstaller('header-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'removeHeaderFile');
});
- it('Test 034 : should call into xcodeproj\'s removeHeaderFile appropriately when element has no target-dir', function(){
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir === undefined; });
+ it('Test 034 : should call into xcodeproj\'s removeHeaderFile appropriately when element has no target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir === undefined; });
uninstall(headers[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeHeaderFile).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'DummyPluginCommand.h'));
});
- it('Test 035 : should call into xcodeproj\'s removeHeaderFile appropriately when element a target-dir', function(){
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 035 : should call into xcodeproj\'s removeHeaderFile appropriately when element a target-dir', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir !== undefined; });
uninstall(headers[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeHeaderFile).toHaveBeenCalledWith(slashJoin('Plugins', dummy_id, 'targetDir', 'TargetDirTest.h'));
});
- it('Test 036 : should rm the file from the right target location', function(){
- var headers = copyArray(valid_headers).filter(function(s) { return s.targetDir !== undefined; });
+ it('Test 036 : should rm the file from the right target location', function () {
+ var headers = copyArray(valid_headers).filter(function (s) { return s.targetDir !== undefined; });
var spy = spyOn(shell, 'rm');
uninstall(headers[0], dummyPluginInfo, dummyProject);
expect(spy).toHaveBeenCalledWith('-rf', path.join(temp, 'SampleApp', 'Plugins', dummy_id, 'targetDir'));
});
});
- describe('of <resource-file> elements', function() {
+ describe('of <resource-file> elements', function () {
var uninstall = pluginHandlers.getUninstaller('resource-file');
beforeEach(function () {
spyOn(dummyProject.xcode, 'removeResourceFile');
});
- it('Test 037 : should call into xcodeproj\'s removeResourceFile', function(){
+ it('Test 037 : should call into xcodeproj\'s removeResourceFile', function () {
var resources = copyArray(valid_resources);
uninstall(resources[0], dummyPluginInfo, dummyProject);
expect(dummyProject.xcode.removeResourceFile).toHaveBeenCalledWith(path.join('Resources', 'DummyPlugin.bundle'));
});
- it('Test 038 : should rm the file from the right target location', function(){
+ it('Test 038 : should rm the file from the right target location', function () {
var resources = copyArray(valid_resources);
var spy = spyOn(shell, 'rm');
uninstall(resources[0], dummyPluginInfo, dummyProject);
@@ -457,7 +459,7 @@ describe('ios plugin handler', function() {
});
});
- describe('of <framework> elements', function() {
+ describe('of <framework> elements', function () {
var uninstall = pluginHandlers.getUninstaller('framework');
beforeEach(function () {
spyOn(dummyProject.xcode, 'removeFramework');
@@ -465,10 +467,10 @@ describe('ios plugin handler', function() {
var frameworkPath = path.join(temp, 'SampleApp/Plugins/org.test.plugins.dummyplugin/Custom.framework').replace(/\\/g, '/');
- it('Test 039 : should call into xcodeproj\'s removeFramework', function(){
+ it('Test 039 : should call into xcodeproj\'s removeFramework', function () {
var frameworks = copyArray(valid_custom_frameworks);
uninstall(frameworks[0], dummyPluginInfo, dummyProject);
- expect(dummyProject.xcode.removeFramework).toHaveBeenCalledWith(frameworkPath, {customFramework:true});
+ expect(dummyProject.xcode.removeFramework).toHaveBeenCalledWith(frameworkPath, {customFramework: true});
});
// TODO: Add more tests to cover the cases:
@@ -476,7 +478,7 @@ describe('ios plugin handler', function() {
// * framework that shouldn't be added/removed
describe('with custom="true" attribute', function () {
- it('Test 040 : should rm the file from the right target location', function(){
+ it('Test 040 : should rm the file from the right target location', function () {
var frameworks = copyArray(valid_custom_frameworks);
var spy = spyOn(shell, 'rm');
uninstall(frameworks[0], dummyPluginInfo, dummyProject);
@@ -484,11 +486,11 @@ describe('ios plugin handler', function() {
});
});
- describe('without custom="true" attribute ', function() {
+ describe('without custom="true" attribute ', function () {
- it('Test 041 : should decrease framework counter after uninstallation', function() {
+ it('Test 041 : should decrease framework counter after uninstallation', function () {
var install = pluginHandlers.getInstaller('framework');
- var dummyNonCustomFrameworks = dummyPluginInfo.getFrameworks('ios').filter(function(f) {
+ var dummyNonCustomFrameworks = dummyPluginInfo.getFrameworks('ios').filter(function (f) {
return !f.custom;
});
var dummyFramework = dummyNonCustomFrameworks[0];
@@ -504,7 +506,7 @@ describe('ios plugin handler', function() {
});
});
- describe('of <js-module> elements', function() {
+ describe('of <js-module> elements', function () {
var jsModule = {src: 'www/dummyPlugin.js'};
var uninstall = pluginHandlers.getUninstaller('js-module');
var wwwDest, platformWwwDest;
@@ -517,7 +519,7 @@ describe('ios plugin handler', function() {
var existsSyncOrig = fs.existsSync;
spyOn(fs, 'existsSync').and.callFake(function (file) {
- if ([wwwDest, platformWwwDest].indexOf(file) >= 0 ) return true;
+ if ([wwwDest, platformWwwDest].indexOf(file) >= 0) return true;
return existsSyncOrig.call(fs, file);
});
});
@@ -535,7 +537,7 @@ describe('ios plugin handler', function() {
});
});
- describe('of <asset> elements', function() {
+ describe('of <asset> elements', function () {
var asset = {src: 'www/dummyPlugin.js', target: 'foo/dummy.js'};
var uninstall = pluginHandlers.getUninstaller('asset');
var wwwDest, platformWwwDest;
@@ -548,7 +550,7 @@ describe('ios plugin handler', function() {
var existsSyncOrig = fs.existsSync;
spyOn(fs, 'existsSync').and.callFake(function (file) {
- if ([wwwDest, platformWwwDest].indexOf(file) >= 0 ) return true;
+ if ([wwwDest, platformWwwDest].indexOf(file) >= 0) return true;
return existsSyncOrig.call(fs, file);
});
});
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/Podfile.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/Podfile.spec.js b/tests/spec/unit/Podfile.spec.js
index 4cf0b34..b1fb13d 100644
--- a/tests/spec/unit/Podfile.spec.js
+++ b/tests/spec/unit/Podfile.spec.js
@@ -17,10 +17,10 @@
under the License.
*/
-var path = require('path'),
- util = require('util'),
- fs = require('fs'),
- CordovaError = require('cordova-common').CordovaError;
+var path = require('path');
+var util = require('util');
+var fs = require('fs');
+var CordovaError = require('cordova-common').CordovaError;
var PROJECT_NAME = 'testProj';
var Podfile = require(path.resolve(path.join(__dirname, '..', '..', '..', 'bin', 'templates', 'scripts', 'cordova', 'lib', 'Podfile.js'))).Podfile;
@@ -28,130 +28,124 @@ var fixturePodfile = path.resolve(__dirname, 'fixtures', PROJECT_NAME, 'platform
var fixturePodXcconfigDebug = path.resolve(__dirname, 'fixtures', PROJECT_NAME, 'platforms', 'ios', 'pods-debug.xcconfig');
var fixturePodXcconfigRelease = path.resolve(__dirname, 'fixtures', PROJECT_NAME, 'platforms', 'ios', 'pods-release.xcconfig');
-
// tests are nested in a describe to ensure clean up happens after all unit tests are run
describe('unit tests for Podfile module', function () {
- var podfile = new Podfile(fixturePodfile, PROJECT_NAME);
-
- describe('tests', function () {
-
- it ('Test 001 : throws CordovaError when the path filename is not named Podfile', function () {
- var dummyPath = 'NotAPodfile';
- expect( function () {
- new Podfile(dummyPath);
- })
- .toThrow(new CordovaError(util.format('Podfile: The file at %s is not `%s`.', dummyPath, Podfile.FILENAME)));
- });
-
- it ('Test 002 : throws CordovaError when no projectName provided when creating a Podfile', function () {
- expect( function () {
- new Podfile(fixturePodfile);
- })
- .toThrow(new CordovaError('Podfile: The projectName was not specified in the constructor.'));
- });
-
- it ('Test 003 : throws CordovaError when no pod name provided when adding a spec', function () {
- expect( function () {
- podfile.addSpec(null);
- })
- .toThrow(new CordovaError('Podfile addSpec: name is not specified.'));
- });
-
- it ('Test 004 : adds the spec', function () {
- expect(podfile.existsSpec('Foo')).toBe(false);
- podfile.addSpec('Foo', '1.0');
- expect(podfile.existsSpec('Foo')).toBe(true);
- });
-
- it ('Test 005 : removes the spec', function () {
- podfile.addSpec('Baz', '3.0');
- expect(podfile.existsSpec('Baz')).toBe(true);
- podfile.removeSpec('Baz');
- expect(podfile.existsSpec('Baz')).toBe(false);
- });
-
- it ('Test 006 : clears all specs', function () {
- podfile.addSpec('Bar', '2.0');
- podfile.clear();
-
- expect(podfile.existsSpec('Foo')).toBe(false);
- expect(podfile.existsSpec('Bar')).toBe(false);
- });
-
- it ('Test 007 : isDirty tests', function () {
- podfile.addSpec('Foo', '1.0');
- expect(podfile.isDirty()).toBe(true);
-
- podfile.write();
- expect(podfile.isDirty()).toBe(false);
-
- podfile.removeSpec('Foo');
- expect(podfile.isDirty()).toBe(true);
-
- podfile.clear();
- expect(podfile.isDirty()).toBe(true);
-
- podfile.write();
- expect(podfile.isDirty()).toBe(false);
- });
-
- it ('Test 008 : writes specs to the Podfile', function () {
- podfile.clear();
-
- podfile.addSpec('Foo', '1.0');
- podfile.addSpec('Bar', '2.0');
- podfile.addSpec('Baz', '3.0');
- podfile.addSpec('Foo-Baz', '4.0');
- podfile.addSpec('Foo~Baz@!%@!%!', '5.0');
- podfile.addSpec('Bla', ':configurations => [\'Debug\', \'Beta\']');
-
- podfile.write();
-
- // verify by reading it back in a new Podfile
- var newPodfile = new Podfile(fixturePodfile, PROJECT_NAME + '2');
- expect(newPodfile.existsSpec('Foo')).toBe(true);
- expect(newPodfile.existsSpec('Bar')).toBe(true);
- expect(newPodfile.existsSpec('Baz')).toBe(true);
- expect(newPodfile.existsSpec('Foo-Baz')).toBe(true);
- expect(newPodfile.existsSpec('Foo~Baz@!%@!%!')).toBe(true);
- expect(newPodfile.existsSpec('Bla')).toBe(true);
-
- expect(newPodfile.getSpec('Foo')).toBe(podfile.getSpec('Foo'));
- expect(newPodfile.getSpec('Bar')).toBe(podfile.getSpec('Bar'));
- expect(newPodfile.getSpec('Baz')).toBe(podfile.getSpec('Baz'));
- expect(newPodfile.getSpec('Foo-Baz')).toBe(podfile.getSpec('Foo-Baz'));
- expect(newPodfile.getSpec('Foo~Baz@!%@!%!')).toBe(podfile.getSpec('Foo~Baz@!%@!%!'));
- expect(newPodfile.getSpec('Bla')).toBe(podfile.getSpec('Bla'));
- });
-
- it ('Test 009 : runs before_install to install xcconfig paths', function () {
- podfile.before_install();
-
- // Template tokens in order: project name, project name, debug | release
- var template =
- '// DO NOT MODIFY -- auto-generated by Apache Cordova\n' +
- '#include "Pods/Target Support Files/Pods-%s/Pods-%s.%s.xcconfig"';
-
- var expectedDebugContents = util.format(template, PROJECT_NAME, PROJECT_NAME, 'debug');
- var expectedReleaseContents = util.format(template, PROJECT_NAME, PROJECT_NAME, 'release');
-
- var actualDebugContents = fs.readFileSync(fixturePodXcconfigDebug, 'utf8');
- var actualReleaseContents = fs.readFileSync(fixturePodXcconfigRelease, 'utf8');
-
- expect(actualDebugContents).toBe(expectedDebugContents);
- expect(actualReleaseContents).toBe(expectedReleaseContents);
- });
-
-
- });
-
- it('Test 010 : tear down', function () {
- podfile.destroy();
-
- var text = '// DO NOT MODIFY -- auto-generated by Apache Cordova\n';
-
- fs.writeFileSync(fixturePodXcconfigDebug, text, 'utf8');
- fs.writeFileSync(fixturePodXcconfigRelease, text, 'utf8');
- });
+ var podfile = new Podfile(fixturePodfile, PROJECT_NAME);
+
+ describe('tests', function () {
+
+ it('Test 001 : throws CordovaError when the path filename is not named Podfile', function () {
+ var dummyPath = 'NotAPodfile';
+ expect(function () {
+ new Podfile(dummyPath); /* eslint no-new : 0 */
+ }).toThrow(new CordovaError(util.format('Podfile: The file at %s is not `%s`.', dummyPath, Podfile.FILENAME)));
+ });
+
+ it('Test 002 : throws CordovaError when no projectName provided when creating a Podfile', function () {
+ expect(function () {
+ new Podfile(fixturePodfile); /* eslint no-new : 0 */
+ }).toThrow(new CordovaError('Podfile: The projectName was not specified in the constructor.'));
+ });
+
+ it('Test 003 : throws CordovaError when no pod name provided when adding a spec', function () {
+ expect(function () {
+ podfile.addSpec(null);
+ }).toThrow(new CordovaError('Podfile addSpec: name is not specified.'));
+ });
+
+ it('Test 004 : adds the spec', function () {
+ expect(podfile.existsSpec('Foo')).toBe(false);
+ podfile.addSpec('Foo', '1.0');
+ expect(podfile.existsSpec('Foo')).toBe(true);
+ });
+
+ it('Test 005 : removes the spec', function () {
+ podfile.addSpec('Baz', '3.0');
+ expect(podfile.existsSpec('Baz')).toBe(true);
+ podfile.removeSpec('Baz');
+ expect(podfile.existsSpec('Baz')).toBe(false);
+ });
+
+ it('Test 006 : clears all specs', function () {
+ podfile.addSpec('Bar', '2.0');
+ podfile.clear();
+
+ expect(podfile.existsSpec('Foo')).toBe(false);
+ expect(podfile.existsSpec('Bar')).toBe(false);
+ });
+
+ it('Test 007 : isDirty tests', function () {
+ podfile.addSpec('Foo', '1.0');
+ expect(podfile.isDirty()).toBe(true);
+
+ podfile.write();
+ expect(podfile.isDirty()).toBe(false);
+
+ podfile.removeSpec('Foo');
+ expect(podfile.isDirty()).toBe(true);
+
+ podfile.clear();
+ expect(podfile.isDirty()).toBe(true);
+
+ podfile.write();
+ expect(podfile.isDirty()).toBe(false);
+ });
+
+ it('Test 008 : writes specs to the Podfile', function () {
+ podfile.clear();
+
+ podfile.addSpec('Foo', '1.0');
+ podfile.addSpec('Bar', '2.0');
+ podfile.addSpec('Baz', '3.0');
+ podfile.addSpec('Foo-Baz', '4.0');
+ podfile.addSpec('Foo~Baz@!%@!%!', '5.0');
+ podfile.addSpec('Bla', ':configurations => [\'Debug\', \'Beta\']');
+
+ podfile.write();
+
+ // verify by reading it back in a new Podfile
+ var newPodfile = new Podfile(fixturePodfile, PROJECT_NAME + '2');
+ expect(newPodfile.existsSpec('Foo')).toBe(true);
+ expect(newPodfile.existsSpec('Bar')).toBe(true);
+ expect(newPodfile.existsSpec('Baz')).toBe(true);
+ expect(newPodfile.existsSpec('Foo-Baz')).toBe(true);
+ expect(newPodfile.existsSpec('Foo~Baz@!%@!%!')).toBe(true);
+ expect(newPodfile.existsSpec('Bla')).toBe(true);
+
+ expect(newPodfile.getSpec('Foo')).toBe(podfile.getSpec('Foo'));
+ expect(newPodfile.getSpec('Bar')).toBe(podfile.getSpec('Bar'));
+ expect(newPodfile.getSpec('Baz')).toBe(podfile.getSpec('Baz'));
+ expect(newPodfile.getSpec('Foo-Baz')).toBe(podfile.getSpec('Foo-Baz'));
+ expect(newPodfile.getSpec('Foo~Baz@!%@!%!')).toBe(podfile.getSpec('Foo~Baz@!%@!%!'));
+ expect(newPodfile.getSpec('Bla')).toBe(podfile.getSpec('Bla'));
+ });
+
+ it('Test 009 : runs before_install to install xcconfig paths', function () {
+ podfile.before_install();
+
+ // Template tokens in order: project name, project name, debug | release
+ var template =
+ '// DO NOT MODIFY -- auto-generated by Apache Cordova\n' +
+ '#include "Pods/Target Support Files/Pods-%s/Pods-%s.%s.xcconfig"';
+
+ var expectedDebugContents = util.format(template, PROJECT_NAME, PROJECT_NAME, 'debug');
+ var expectedReleaseContents = util.format(template, PROJECT_NAME, PROJECT_NAME, 'release');
+
+ var actualDebugContents = fs.readFileSync(fixturePodXcconfigDebug, 'utf8');
+ var actualReleaseContents = fs.readFileSync(fixturePodXcconfigRelease, 'utf8');
+
+ expect(actualDebugContents).toBe(expectedDebugContents);
+ expect(actualReleaseContents).toBe(expectedReleaseContents);
+ });
+
+ });
+
+ it('Test 010 : tear down', function () {
+ podfile.destroy();
+
+ var text = '// DO NOT MODIFY -- auto-generated by Apache Cordova\n';
+
+ fs.writeFileSync(fixturePodXcconfigDebug, text, 'utf8');
+ fs.writeFileSync(fixturePodXcconfigRelease, text, 'utf8');
+ });
});
-
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/PodsJson.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/PodsJson.spec.js b/tests/spec/unit/PodsJson.spec.js
index aa9b9ca..2543323 100644
--- a/tests/spec/unit/PodsJson.spec.js
+++ b/tests/spec/unit/PodsJson.spec.js
@@ -17,171 +17,169 @@
under the License.
*/
-var path = require('path'),
- util = require('util'),
- CordovaError = require('cordova-common').CordovaError;
+var path = require('path');
+var util = require('util');
+var CordovaError = require('cordova-common').CordovaError;
var PodsJson = require(path.resolve(path.join(__dirname, '..', '..', '..', 'bin', 'templates', 'scripts', 'cordova', 'lib', 'PodsJson.js'))).PodsJson;
var fixturePodsJson = path.resolve(__dirname, 'fixtures', 'testProj', 'platforms', 'ios', 'pods.json');
// tests are nested in a describe to ensure clean up happens after all unit tests are run
describe('unit tests for Podfile module', function () {
- var podsjson = new PodsJson(fixturePodsJson);
-
- describe('tests', function () {
-
- it ('Test 001 : throws CordovaError when the path filename is not named pods.json', function () {
- var dummyPath = 'NotPodsJson';
- expect( function () {
- new PodsJson(dummyPath);
- })
- .toThrow(new CordovaError(util.format('PodsJson: The file at %s is not `%s`.', dummyPath, PodsJson.FILENAME)));
- });
-
- it ('Test 002 : sets and gets pod test', function () {
- var val0 = {
- name: 'Foo',
- type: 'podspec',
- spec: '1.0',
- count: 1
- };
- podsjson.set(val0.name, val0.type, val0.spec, val0.count);
- var val1 = podsjson.get(val0.name);
-
- expect(val1).toBeTruthy();
- expect(val1.name).toEqual(val0.name);
- expect(val1.type).toEqual(val0.type);
- expect(val1.spec).toEqual(val0.spec);
- expect(val1.count).toEqual(val0.count);
- });
-
- it ('Test 003 : setsJson and remove pod test', function () {
- var val0 = {
- name: 'Bar',
- type: 'podspec',
- spec: '2.0',
- count: 2
- };
- podsjson.setJson(val0.name, val0);
- var val1 = podsjson.get(val0.name);
-
- expect(val1).toBeTruthy();
- expect(val1.name).toEqual(val0.name);
- expect(val1.type).toEqual(val0.type);
- expect(val1.spec).toEqual(val0.spec);
- expect(val1.count).toEqual(val0.count);
-
- podsjson.remove(val0.name);
- val1 = podsjson.get(val0.name);
- expect(val1).toBeFalsy();
- });
-
- it ('Test 004 : clears all pods', function () {
- var val0 = {
- name: 'Baz',
- type: 'podspec',
- spec: '3.0',
- count: 3
- };
- podsjson.setJson(val0.name, val0);
- podsjson.clear();
-
- expect(podsjson.get(val0.name)).toBeFalsy();
- expect(podsjson.get('Foo')).toBeFalsy();
- expect(podsjson.get('Bar')).toBeFalsy();
- });
-
- it ('Test 005 : isDirty tests', function () {
- var val0 = {
- name: 'Foo',
- type: 'podspec',
- spec: '1.0',
- count: 1
- };
-
- podsjson.setJson(val0.name, val0);
- expect(podsjson.isDirty()).toBe(true);
-
- podsjson.write();
- expect(podsjson.isDirty()).toBe(false);
-
- podsjson.remove(val0.name);
- expect(podsjson.isDirty()).toBe(true);
-
- podsjson.clear();
- expect(podsjson.isDirty()).toBe(true);
-
- podsjson.write();
- expect(podsjson.isDirty()).toBe(false);
- });
-
- it ('Test 006 : increment and decrement count test', function () {
- var val0 = {
- name: 'Bla',
- type: 'podspec',
- spec: '4.0',
- count: 4
- };
-
- podsjson.setJson(val0.name, val0);
- expect(podsjson.get(val0.name).count).toBe(4);
-
- podsjson.increment(val0.name);
- expect(podsjson.get(val0.name).count).toBe(5);
-
- podsjson.decrement(val0.name);
- expect(podsjson.get(val0.name).count).toBe(4);
- podsjson.decrement(val0.name);
- expect(podsjson.get(val0.name).count).toBe(3);
- podsjson.decrement(val0.name);
- expect(podsjson.get(val0.name).count).toBe(2);
- podsjson.decrement(val0.name);
- expect(podsjson.get(val0.name).count).toBe(1);
-
- // this next decrement takes it down to zero, where the pod will just be removed
- podsjson.decrement(val0.name);
- expect(podsjson.get(val0.name)).toBeFalsy();
- });
-
- it ('Test 007 : writes pods to the pods.json', function () {
- podsjson.clear();
-
- var vals = {
- 'Foo': { name: 'Foo', type: 'podspec', spec: '1.0', count: 1 },
- 'Bar': { name: 'Bar', type: 'podspec', spec: '2.0', count: 2 },
- 'Baz': { name: 'Baz', type: 'podspec', spec: '3.0', count: 3 }
- };
-
- podsjson.setJson('Foo', vals.Foo);
- podsjson.setJson('Bar', vals.Bar);
- podsjson.setJson('Baz', vals.Baz);
-
- podsjson.write();
-
- // verify by reading it back in a new PodsJson
- var newPodsJson = new PodsJson(fixturePodsJson);
- expect(newPodsJson.get('Foo')).toBeTruthy();
- expect(newPodsJson.get('Bar')).toBeTruthy();
- expect(newPodsJson.get('Baz')).toBeTruthy();
-
- function podEqual(a, b) {
- return (
- a.name === b.name &&
- a.type === b.type &&
- a.spec === b.spec &&
- a.count === b.count
- );
- }
-
- expect(podEqual(podsjson.get('Foo'), newPodsJson.get('Foo'))).toBe(true);
- expect(podEqual(podsjson.get('Bar'), newPodsJson.get('Bar'))).toBe(true);
- expect(podEqual(podsjson.get('Baz'), newPodsJson.get('Baz'))).toBe(true);
- });
-
- });
-
- it('Test 008 : tear down', function () {
- podsjson.destroy();
- });
+ var podsjson = new PodsJson(fixturePodsJson);
+
+ describe('tests', function () {
+
+ it('Test 001 : throws CordovaError when the path filename is not named pods.json', function () {
+ var dummyPath = 'NotPodsJson';
+ expect(function () {
+ new PodsJson(dummyPath); /* eslint no-new : 0 */
+ }).toThrow(new CordovaError(util.format('PodsJson: The file at %s is not `%s`.', dummyPath, PodsJson.FILENAME)));
+ });
+
+ it('Test 002 : sets and gets pod test', function () {
+ var val0 = {
+ name: 'Foo',
+ type: 'podspec',
+ spec: '1.0',
+ count: 1
+ };
+ podsjson.set(val0.name, val0.type, val0.spec, val0.count);
+ var val1 = podsjson.get(val0.name);
+
+ expect(val1).toBeTruthy();
+ expect(val1.name).toEqual(val0.name);
+ expect(val1.type).toEqual(val0.type);
+ expect(val1.spec).toEqual(val0.spec);
+ expect(val1.count).toEqual(val0.count);
+ });
+
+ it('Test 003 : setsJson and remove pod test', function () {
+ var val0 = {
+ name: 'Bar',
+ type: 'podspec',
+ spec: '2.0',
+ count: 2
+ };
+ podsjson.setJson(val0.name, val0);
+ var val1 = podsjson.get(val0.name);
+
+ expect(val1).toBeTruthy();
+ expect(val1.name).toEqual(val0.name);
+ expect(val1.type).toEqual(val0.type);
+ expect(val1.spec).toEqual(val0.spec);
+ expect(val1.count).toEqual(val0.count);
+
+ podsjson.remove(val0.name);
+ val1 = podsjson.get(val0.name);
+ expect(val1).toBeFalsy();
+ });
+
+ it('Test 004 : clears all pods', function () {
+ var val0 = {
+ name: 'Baz',
+ type: 'podspec',
+ spec: '3.0',
+ count: 3
+ };
+ podsjson.setJson(val0.name, val0);
+ podsjson.clear();
+
+ expect(podsjson.get(val0.name)).toBeFalsy();
+ expect(podsjson.get('Foo')).toBeFalsy();
+ expect(podsjson.get('Bar')).toBeFalsy();
+ });
+
+ it('Test 005 : isDirty tests', function () {
+ var val0 = {
+ name: 'Foo',
+ type: 'podspec',
+ spec: '1.0',
+ count: 1
+ };
+
+ podsjson.setJson(val0.name, val0);
+ expect(podsjson.isDirty()).toBe(true);
+
+ podsjson.write();
+ expect(podsjson.isDirty()).toBe(false);
+
+ podsjson.remove(val0.name);
+ expect(podsjson.isDirty()).toBe(true);
+
+ podsjson.clear();
+ expect(podsjson.isDirty()).toBe(true);
+
+ podsjson.write();
+ expect(podsjson.isDirty()).toBe(false);
+ });
+
+ it('Test 006 : increment and decrement count test', function () {
+ var val0 = {
+ name: 'Bla',
+ type: 'podspec',
+ spec: '4.0',
+ count: 4
+ };
+
+ podsjson.setJson(val0.name, val0);
+ expect(podsjson.get(val0.name).count).toBe(4);
+
+ podsjson.increment(val0.name);
+ expect(podsjson.get(val0.name).count).toBe(5);
+
+ podsjson.decrement(val0.name);
+ expect(podsjson.get(val0.name).count).toBe(4);
+ podsjson.decrement(val0.name);
+ expect(podsjson.get(val0.name).count).toBe(3);
+ podsjson.decrement(val0.name);
+ expect(podsjson.get(val0.name).count).toBe(2);
+ podsjson.decrement(val0.name);
+ expect(podsjson.get(val0.name).count).toBe(1);
+
+ // this next decrement takes it down to zero, where the pod will just be removed
+ podsjson.decrement(val0.name);
+ expect(podsjson.get(val0.name)).toBeFalsy();
+ });
+
+ it('Test 007 : writes pods to the pods.json', function () {
+ podsjson.clear();
+
+ var vals = {
+ 'Foo': { name: 'Foo', type: 'podspec', spec: '1.0', count: 1 },
+ 'Bar': { name: 'Bar', type: 'podspec', spec: '2.0', count: 2 },
+ 'Baz': { name: 'Baz', type: 'podspec', spec: '3.0', count: 3 }
+ };
+
+ podsjson.setJson('Foo', vals.Foo);
+ podsjson.setJson('Bar', vals.Bar);
+ podsjson.setJson('Baz', vals.Baz);
+
+ podsjson.write();
+
+ // verify by reading it back in a new PodsJson
+ var newPodsJson = new PodsJson(fixturePodsJson);
+ expect(newPodsJson.get('Foo')).toBeTruthy();
+ expect(newPodsJson.get('Bar')).toBeTruthy();
+ expect(newPodsJson.get('Baz')).toBeTruthy();
+
+ function podEqual (a, b) {
+ return (
+ a.name === b.name &&
+ a.type === b.type &&
+ a.spec === b.spec &&
+ a.count === b.count
+ );
+ }
+
+ expect(podEqual(podsjson.get('Foo'), newPodsJson.get('Foo'))).toBe(true);
+ expect(podEqual(podsjson.get('Bar'), newPodsJson.get('Bar'))).toBe(true);
+ expect(podEqual(podsjson.get('Baz'), newPodsJson.get('Baz'))).toBe(true);
+ });
+
+ });
+
+ it('Test 008 : tear down', function () {
+ podsjson.destroy();
+ });
});
-
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/unit/build.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/unit/build.spec.js b/tests/spec/unit/build.spec.js
index 7d04966..6cf005c 100644
--- a/tests/spec/unit/build.spec.js
+++ b/tests/spec/unit/build.spec.js
@@ -24,12 +24,12 @@ var build = rewire('../../../bin/templates/scripts/cordova/lib/build');
describe('build', function () {
var testProjectPath = path.join('/test', 'project', 'path');
- describe('getXcodeBuildArgs method', function() {
+ describe('getXcodeBuildArgs method', function () {
var getXcodeBuildArgs = build.__get__('getXcodeBuildArgs');
build.__set__('__dirname', path.join('/test', 'dir'));
- it('should generate appropriate args if a single buildFlag is passed in', function(done) {
+ it('should generate appropriate args if a single buildFlag is passed in', function (done) {
var isDevice = true;
var buildFlags = '-xcconfig TestXcconfigFlag';
@@ -53,7 +53,7 @@ describe('build', function () {
done();
});
- it('should generate appropriate args if buildFlags are passed in', function(done) {
+ it('should generate appropriate args if buildFlags are passed in', function (done) {
var isDevice = true;
var buildFlags = [
'-xcconfig TestXcconfigFlag',
@@ -86,7 +86,7 @@ describe('build', function () {
done();
});
- it('should generate appropriate args for device', function(done) {
+ it('should generate appropriate args for device', function (done) {
var isDevice = true;
var args = getXcodeBuildArgs('TestProjectName', testProjectPath, 'TestConfiguration', isDevice, null);
expect(args[0]).toEqual('-xcconfig');
@@ -108,7 +108,7 @@ describe('build', function () {
done();
});
- it('should generate appropriate args for simulator', function(done) {
+ it('should generate appropriate args for simulator', function (done) {
var isDevice = false;
var args = getXcodeBuildArgs('TestProjectName', testProjectPath, 'TestConfiguration', isDevice, null, 'iPhone 5s');
expect(args[0]).toEqual('-xcconfig');
@@ -130,7 +130,7 @@ describe('build', function () {
done();
});
- it('should add matched flags that are not overriding for device', function(done) {
+ it('should add matched flags that are not overriding for device', function (done) {
var isDevice = true;
var buildFlags = '-sdk TestSdkFlag';
@@ -156,7 +156,7 @@ describe('build', function () {
done();
});
- it('should add matched flags that are not overriding for simulator', function(done) {
+ it('should add matched flags that are not overriding for simulator', function (done) {
var isDevice = false;
var buildFlags = '-archivePath TestArchivePathFlag';
@@ -183,11 +183,11 @@ describe('build', function () {
});
});
- describe('getXcodeArchiveArgs method', function() {
+ describe('getXcodeArchiveArgs method', function () {
var getXcodeArchiveArgs = build.__get__('getXcodeArchiveArgs');
- it('should generate the appropriate arguments', function(done) {
+ it('should generate the appropriate arguments', function (done) {
var archiveArgs = getXcodeArchiveArgs('TestProjectName', testProjectPath, '/test/output/path', '/test/export/options/path');
expect(archiveArgs[0]).toEqual('-exportArchive');
expect(archiveArgs[1]).toEqual('-archivePath');
@@ -201,11 +201,11 @@ describe('build', function () {
});
});
- describe('parseBuildFlag method', function() {
+ describe('parseBuildFlag method', function () {
var parseBuildFlag = build.__get__('parseBuildFlag');
- it('should detect an xcconfig change', function(done) {
+ it('should detect an xcconfig change', function (done) {
var buildFlag = '-xcconfig /path/to/config';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -213,7 +213,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a workspace change', function(done) {
+ it('should detect a workspace change', function (done) {
var buildFlag = '-workspace MyTestWorkspace';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -221,7 +221,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a scheme change', function(done) {
+ it('should detect a scheme change', function (done) {
var buildFlag = '-scheme MyTestScheme';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -229,7 +229,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a configuration change', function(done) {
+ it('should detect a configuration change', function (done) {
var buildFlag = '-configuration MyTestConfiguration';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -237,7 +237,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect an sdk change', function(done) {
+ it('should detect an sdk change', function (done) {
var buildFlag = '-sdk NotARealSDK';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -245,7 +245,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a destination change', function(done) {
+ it('should detect a destination change', function (done) {
var buildFlag = '-destination MyTestDestination';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -253,7 +253,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect an archivePath change', function(done) {
+ it('should detect an archivePath change', function (done) {
var buildFlag = '-archivePath MyTestArchivePath';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -261,7 +261,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a configuration_build_dir change', function(done) {
+ it('should detect a configuration_build_dir change', function (done) {
var buildFlag = 'CONFIGURATION_BUILD_DIR=/path/to/fake/config/build/dir';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -269,7 +269,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should detect a shared_precomps_dir change', function(done) {
+ it('should detect a shared_precomps_dir change', function (done) {
var buildFlag = 'SHARED_PRECOMPS_DIR=/path/to/fake/shared/precomps/dir';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -277,7 +277,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(0);
done();
});
- it('should parse arbitrary build settings', function(done) {
+ it('should parse arbitrary build settings', function (done) {
var buildFlag = 'MY_ARBITRARY_BUILD_SETTING=ValueOfArbitraryBuildSetting';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -285,7 +285,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(1);
done();
});
- it('should parse userdefaults', function(done) {
+ it('should parse userdefaults', function (done) {
var buildFlag = '-myuserdefault=TestUserDefaultValue';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
@@ -293,7 +293,7 @@ describe('build', function () {
expect(args.otherFlags.length).toEqual(1);
done();
});
- it('should parse settings with a space', function(done) {
+ it('should parse settings with a space', function (done) {
var buildFlag = '-anotherxcodebuildsetting withASpace';
var args = { 'otherFlags': [] };
parseBuildFlag(buildFlag, args);
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[5/5] ios commit: CB-12895 : removed jshint and added eslint
Posted by au...@apache.org.
CB-12895 : removed jshint and added eslint
Project: http://git-wip-us.apache.org/repos/asf/cordova-ios/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-ios/commit/83435d56
Tree: http://git-wip-us.apache.org/repos/asf/cordova-ios/tree/83435d56
Diff: http://git-wip-us.apache.org/repos/asf/cordova-ios/diff/83435d56
Branch: refs/heads/master
Commit: 83435d56d0e7e71a5bbb744cf93684b7e42997f7
Parents: 26beb94
Author: Audrey So <au...@apache.org>
Authored: Thu Jun 15 10:56:59 2017 -0700
Committer: Audrey So <au...@apache.org>
Committed: Fri Jul 14 16:18:26 2017 -0700
----------------------------------------------------------------------
.eslintignore | 3 +
.eslintrc.yml | 10 +
.gitignore | 1 +
.jshintignore | 3 -
.jshintrc | 12 -
.travis.yml | 12 +-
CordovaLib/cordova.js | 2 -
appveyor.yml | 6 +-
bin/lib/create.js | 127 +++---
bin/templates/project/www/js/index.js | 10 +-
bin/templates/scripts/cordova/Api.js | 116 +++--
bin/templates/scripts/cordova/lib/Podfile.js | 136 +++---
bin/templates/scripts/cordova/lib/PodsJson.js | 34 +-
bin/templates/scripts/cordova/lib/build.js | 288 ++++++-------
bin/templates/scripts/cordova/lib/check_reqs.js | 119 +++---
bin/templates/scripts/cordova/lib/clean.js | 26 +-
.../scripts/cordova/lib/copy-www-build-step.js | 26 +-
bin/templates/scripts/cordova/lib/list-devices | 1 -
.../cordova/lib/list-emulator-build-targets | 1 -
.../scripts/cordova/lib/list-emulator-images | 1 -
.../scripts/cordova/lib/list-started-emulators | 1 -
.../cordova/lib/plugman/pluginHandlers.js | 116 +++--
bin/templates/scripts/cordova/lib/prepare.js | 310 +++++++-------
.../scripts/cordova/lib/projectFile.js | 24 +-
bin/templates/scripts/cordova/lib/run.js | 216 +++++-----
bin/templates/scripts/cordova/lib/spawn.js | 14 +-
bin/templates/scripts/cordova/lib/versions.js | 66 ++-
package.json | 12 +-
tests/.jshintrc | 12 -
tests/scripts/killsim.js | 6 +-
tests/spec/.eslintrc.yml | 2 +
tests/spec/create.spec.js | 43 +-
tests/spec/unit/Api.spec.js | 184 ++++----
tests/spec/unit/Plugman/common.spec.js | 52 +--
tests/spec/unit/Plugman/pluginHandler.spec.js | 258 ++++++------
tests/spec/unit/Podfile.spec.js | 250 ++++++-----
tests/spec/unit/PodsJson.spec.js | 320 +++++++-------
tests/spec/unit/build.spec.js | 44 +-
.../contents-json/empty.js | 240 +++++------
.../contents-json/single-2xanyany.js | 250 +++++------
.../contents-json/typical-universal.js | 270 ++++++------
.../contents-json/varied-device.js | 280 ++++++-------
.../contents-map/empty-map.js | 384 ++++++++---------
.../contents-map/single-2xanyany-map.js | 262 ++++++------
.../contents-map/typical-universal-map.js | 292 ++++++-------
.../contents-map/varied-device-map.js | 310 +++++++-------
.../www/dummyplugin.js | 3 +-
tests/spec/unit/lib/list-devices.spec.js | 16 +-
tests/spec/unit/lib/run.spec.js | 14 +-
tests/spec/unit/prepare.spec.js | 420 +++++++++----------
tests/spec/unit/preparePlatform.spec.js | 59 ++-
tests/spec/unit/projectFile.spec.js | 34 +-
52 files changed, 2829 insertions(+), 2869 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/.eslintignore
----------------------------------------------------------------------
diff --git a/.eslintignore b/.eslintignore
new file mode 100644
index 0000000..1ec4bc1
--- /dev/null
+++ b/.eslintignore
@@ -0,0 +1,3 @@
+bin/node_modules/*
+bin/templates/project/*
+tests/spec/unit/fixtures/*
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/.eslintrc.yml b/.eslintrc.yml
new file mode 100644
index 0000000..f6aae32
--- /dev/null
+++ b/.eslintrc.yml
@@ -0,0 +1,10 @@
+root: true
+extends: semistandard
+rules:
+ indent:
+ - error
+ - 4
+ camelcase: off
+ padded-blocks: off
+ operator-linebreak: off
+ no-throw-literal: off
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/.gitignore
----------------------------------------------------------------------
diff --git a/.gitignore b/.gitignore
index 4e6a1e9..1bfa164 100644
--- a/.gitignore
+++ b/.gitignore
@@ -8,6 +8,7 @@ tmp
xcuserdata
console.log
node_modules/jshint
+node_modules/eslint
node_modules/jasmine-node
node_modules/rewire
node_modules/istanbul
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/.jshintignore
----------------------------------------------------------------------
diff --git a/.jshintignore b/.jshintignore
deleted file mode 100644
index 281391b..0000000
--- a/.jshintignore
+++ /dev/null
@@ -1,3 +0,0 @@
-bin/node_modules/*
-bin/templates/project/*
-tests/spec/unit/fixtures/*
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/.jshintrc
----------------------------------------------------------------------
diff --git a/.jshintrc b/.jshintrc
deleted file mode 100644
index d18f0a1..0000000
--- a/.jshintrc
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "node": true
- , "bitwise": true
- , "undef": true
- , "trailing": true
- , "quotmark": true
- , "indent": 4
- , "unused": "vars"
- , "latedef": "nofunc"
- , "jasmine": true
- , "esversion": 6
-}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/.travis.yml
----------------------------------------------------------------------
diff --git a/.travis.yml b/.travis.yml
index 16f480c..2866f35 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -16,10 +16,10 @@ install:
- npm install ios-deploy
- npm install -g codecov
script:
-- npm run jshint
-- npm run unit-tests
-- npm run e2e-tests
-- open -b com.apple.iphonesimulator
-- npm run objc-tests
-- npm run cover
+ - npm run unit-tests
+ - npm run e2e-tests
+ - open -b com.apple.iphonesimulator
+ - npm run objc-tests
+ - npm run cover
+ - npm run eslint
after_script: codecov
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index 57b7d71..e4b4e24 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -22,8 +22,6 @@
var PLATFORM_VERSION_BUILD_LABEL = '4.5.0-dev';
// file: src/scripts/require.js
-/*jshint -W079 */
-/*jshint -W020 */
var require,
define;
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/appveyor.yml
----------------------------------------------------------------------
diff --git a/appveyor.yml b/appveyor.yml
index 12836bb..c1b5952 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -7,12 +7,14 @@ install:
- ps: Install-Product node $env:nodejs_version
# Lines below required due to uncrustify installation failure on Windows
- npm install --prod
- - npm install jshint jasmine rewire
+ - npm install eslint eslint-config-semistandard jasmine rewire
+ - npm install eslint-config-standard eslint-plugin-import eslint-plugin-node
+ - npm install eslint-plugin-promise eslint-plugin-standard
build: off
test_script:
- node --version
- npm --version
- - npm run jshint
- npm run unit-tests
+ - npm run eslint
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/lib/create.js
----------------------------------------------------------------------
diff --git a/bin/lib/create.js b/bin/lib/create.js
index 4633381..a96227b 100755
--- a/bin/lib/create.js
+++ b/bin/lib/create.js
@@ -19,25 +19,25 @@
under the License.
*/
-var shell = require('shelljs'),
- Q = require ('q'),
- path = require('path'),
- fs = require('fs'),
- xmlescape = require('xml-escape'),
- ROOT = path.join(__dirname, '..', '..'),
- events = require('cordova-common').events;
-
-function updateSubprojectHelp() {
+var shell = require('shelljs');
+var Q = require('q');
+var path = require('path');
+var fs = require('fs');
+var xmlescape = require('xml-escape');
+var ROOT = path.join(__dirname, '..', '..');
+var events = require('cordova-common').events;
+
+function updateSubprojectHelp () {
console.log('Updates the subproject path of the CordovaLib entry to point to this script\'s version of Cordova.');
console.log('Usage: CordovaVersion/bin/update_cordova_project path/to/your/app.xcodeproj [path/to/CordovaLib.xcodeproj]');
}
-function copyJsAndCordovaLib(projectPath, projectName, use_shared) {
+function copyJsAndCordovaLib (projectPath, projectName, use_shared) {
shell.cp('-f', path.join(ROOT, 'CordovaLib', 'cordova.js'), path.join(projectPath, 'www'));
shell.cp('-rf', path.join(ROOT, 'cordova-js-src'), path.join(projectPath, 'platform_www'));
shell.cp('-f', path.join(ROOT, 'CordovaLib', 'cordova.js'), path.join(projectPath, 'platform_www'));
- fs.lstat(path.join(projectPath, 'CordovaLib'), function(err, stats) {
+ fs.lstat(path.join(projectPath, 'CordovaLib'), function (err, stats) {
if (!err) {
if (stats.isSymbolicLink()) {
fs.unlinkSync(path.join(projectPath, 'CordovaLib'));
@@ -47,7 +47,7 @@ function copyJsAndCordovaLib(projectPath, projectName, use_shared) {
}
if (use_shared) {
- update_cordova_subproject([path.join(projectPath, projectName +'.xcodeproj', 'project.pbxproj')]);
+ update_cordova_subproject([path.join(projectPath, projectName + '.xcodeproj', 'project.pbxproj')]);
// Symlink not used in project file, but is currently required for plugman because
// it reads the VERSION file from it (instead of using the cordova/version script
// like it should).
@@ -56,17 +56,17 @@ function copyJsAndCordovaLib(projectPath, projectName, use_shared) {
var r = path.join(projectPath, projectName);
shell.mkdir('-p', path.join(projectPath, 'CordovaLib', 'CordovaLib.xcodeproj'));
shell.cp('-f', path.join(r, '.gitignore'), projectPath);
- shell.cp('-rf',path.join(ROOT, 'CordovaLib', 'Classes'), path.join(projectPath, 'CordovaLib'));
+ shell.cp('-rf', path.join(ROOT, 'CordovaLib', 'Classes'), path.join(projectPath, 'CordovaLib'));
shell.cp('-f', path.join(ROOT, 'CordovaLib', 'VERSION'), path.join(projectPath, 'CordovaLib'));
shell.cp('-f', path.join(ROOT, 'CordovaLib', 'cordova.js'), path.join(projectPath, 'CordovaLib'));
shell.cp('-f', path.join(ROOT, 'CordovaLib', 'CordovaLib_Prefix.pch'), path.join(projectPath, 'CordovaLib'));
shell.cp('-f', path.join(ROOT, 'CordovaLib', 'CordovaLib.xcodeproj', 'project.pbxproj'), path.join(projectPath, 'CordovaLib', 'CordovaLib.xcodeproj'));
- update_cordova_subproject([path.join(r+'.xcodeproj', 'project.pbxproj'), path.join(projectPath, 'CordovaLib', 'CordovaLib.xcodeproj', 'project.pbxproj')]);
+ update_cordova_subproject([path.join(r + '.xcodeproj', 'project.pbxproj'), path.join(projectPath, 'CordovaLib', 'CordovaLib.xcodeproj', 'project.pbxproj')]);
}
});
}
-function copyScripts(projectPath, projectName) {
+function copyScripts (projectPath, projectName) {
var srcScriptsDir = path.join(ROOT, 'bin', 'templates', 'scripts', 'cordova');
var destScriptsDir = path.join(projectPath, 'cordova');
@@ -103,7 +103,7 @@ function copyScripts(projectPath, projectName) {
shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(destScriptsDir, 'build-release.xcconfig'));
// Make sure they are executable (sometimes zipping them can remove executable bit)
- shell.find(destScriptsDir).forEach(function(entry) {
+ shell.find(destScriptsDir).forEach(function (entry) {
shell.chmod(755, entry);
});
}
@@ -116,27 +116,27 @@ function copyScripts(projectPath, projectName) {
* @param {String} project_template_dir path to cordova-ios template directory
* @parm {BOOL} use_cli true if cli project
*/
-function copyTemplateFiles(project_path, project_name, project_template_dir, package_name) {
+function copyTemplateFiles (project_path, project_name, project_template_dir, package_name) {
var r = path.join(project_path, project_name);
- shell.rm('-rf', path.join(r+'.xcodeproj'));
+ shell.rm('-rf', path.join(r + '.xcodeproj'));
shell.cp('-rf', path.join(project_template_dir, '__TEMP__.xcodeproj'), project_path);
- shell.mv('-f', path.join(project_path, '__TEMP__.xcodeproj'), path.join(r+'.xcodeproj'));
+ shell.mv('-f', path.join(project_path, '__TEMP__.xcodeproj'), path.join(r + '.xcodeproj'));
- shell.rm('-rf', path.join(project_path, project_name+'.xcworkspace'));
+ shell.rm('-rf', path.join(project_path, project_name + '.xcworkspace'));
shell.cp('-rf', path.join(project_template_dir, '__TEMP__.xcworkspace'), project_path);
- shell.mv('-f', path.join(project_path, '__TEMP__.xcworkspace'), path.join(r+'.xcworkspace'));
- shell.mv('-f', path.join(r+'.xcworkspace', 'xcshareddata', 'xcschemes', '__PROJECT_NAME__.xcscheme'), path.join(r+'.xcworkspace', 'xcshareddata', 'xcschemes', project_name+'.xcscheme'));
+ shell.mv('-f', path.join(project_path, '__TEMP__.xcworkspace'), path.join(r + '.xcworkspace'));
+ shell.mv('-f', path.join(r + '.xcworkspace', 'xcshareddata', 'xcschemes', '__PROJECT_NAME__.xcscheme'), path.join(r + '.xcworkspace', 'xcshareddata', 'xcschemes', project_name + '.xcscheme'));
shell.rm('-rf', r);
shell.cp('-rf', path.join(project_template_dir, '__PROJECT_NAME__'), project_path);
shell.mv('-f', path.join(project_path, '__PROJECT_NAME__'), r);
- shell.mv('-f', path.join(r, '__PROJECT_NAME__-Info.plist'), path.join(r, project_name+'-Info.plist'));
- shell.mv('-f', path.join(r, '__PROJECT_NAME__-Prefix.pch'), path.join(r, project_name+'-Prefix.pch'));
+ shell.mv('-f', path.join(r, '__PROJECT_NAME__-Info.plist'), path.join(r, project_name + '-Info.plist'));
+ shell.mv('-f', path.join(r, '__PROJECT_NAME__-Prefix.pch'), path.join(r, project_name + '-Prefix.pch'));
shell.mv('-f', path.join(r, 'gitignore'), path.join(r, '.gitignore'));
- /*replace __PROJECT_NAME__ and --ID-- with ACTIVITY and ID strings, respectively, in:
+ /* replace __PROJECT_NAME__ and --ID-- with ACTIVITY and ID strings, respectively, in:
*
* - ./__PROJECT_NAME__.xcodeproj/project.pbxproj
* - ./__PROJECT_NAME__/Classes/AppDelegate.h
@@ -150,37 +150,36 @@ function copyTemplateFiles(project_path, project_name, project_template_dir, pac
// https://issues.apache.org/jira/browse/CB-12402 - Encode XML characters properly
var project_name_xml_esc = xmlescape(project_name);
- shell.sed('-i', /__PROJECT_NAME__/g, project_name_xml_esc, path.join(r+'.xcworkspace', 'contents.xcworkspacedata'));
- shell.sed('-i', /__PROJECT_NAME__/g, project_name_xml_esc, path.join(r+'.xcworkspace', 'xcshareddata', 'xcschemes', project_name +'.xcscheme'));
+ shell.sed('-i', /__PROJECT_NAME__/g, project_name_xml_esc, path.join(r + '.xcworkspace', 'contents.xcworkspacedata'));
+ shell.sed('-i', /__PROJECT_NAME__/g, project_name_xml_esc, path.join(r + '.xcworkspace', 'xcshareddata', 'xcschemes', project_name + '.xcscheme'));
var project_name_esc = project_name.replace(/&/g, '\\&');
- shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r+'.xcodeproj', 'project.pbxproj'));
+ shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r + '.xcodeproj', 'project.pbxproj'));
shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, 'Classes', 'AppDelegate.h'));
shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, 'Classes', 'AppDelegate.m'));
shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, 'Classes', 'MainViewController.h'));
shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, 'Classes', 'MainViewController.m'));
shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, 'main.m'));
- shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, project_name+'-Info.plist'));
- shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, project_name+'-Prefix.pch'));
- shell.sed('-i', /--ID--/g, package_name, path.join(r, project_name+'-Info.plist'));
+ shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, project_name + '-Info.plist'));
+ shell.sed('-i', /__PROJECT_NAME__/g, project_name_esc, path.join(r, project_name + '-Prefix.pch'));
+ shell.sed('-i', /--ID--/g, package_name, path.join(r, project_name + '-Info.plist'));
}
-function AbsParentPath(_path) {
+function AbsParentPath (_path) {
return path.resolve(path.dirname(_path));
}
-function AbsProjectPath(relative_path) {
+function AbsProjectPath (relative_path) {
var absolute_path = path.resolve(relative_path);
if (/.pbxproj$/.test(absolute_path)) {
absolute_path = AbsParentPath(absolute_path);
- }
- else if (!(/.xcodeproj$/.test(absolute_path))) {
+ } else if (!(/.xcodeproj$/.test(absolute_path))) {
throw new Error('The following is not a valid path to an Xcode project: ' + absolute_path);
}
return absolute_path;
}
-function relpath(_path, start) {
+function relpath (_path, start) {
start = start || process.cwd();
return path.relative(path.resolve(start), path.resolve(_path));
}
@@ -196,20 +195,20 @@ function relpath(_path, start) {
* - <project_template_dir>: Path to a project template (override)
*
*/
-exports.createProject = function(project_path, package_name, project_name, opts) {
+exports.createProject = function (project_path, package_name, project_name, opts) {
package_name = package_name || 'my.cordova.project';
project_name = project_name || 'CordovaExample';
var use_shared = !!opts.link;
- var bin_dir = path.join(ROOT, 'bin'),
- project_parent = path.dirname(project_path);
+ var bin_dir = path.join(ROOT, 'bin');
+ var project_parent = path.dirname(project_path);
var project_template_dir = opts.customTemplate || path.join(bin_dir, 'templates', 'project');
- //check that project path doesn't exist
+ // check that project path doesn't exist
if (fs.existsSync(project_path)) {
return Q.reject('Project already exists');
}
- //check that parent directory does exist so cp -r will not fail
+ // check that parent directory does exist so cp -r will not fail
if (!fs.existsSync(project_parent)) {
return Q.reject('Parent directory "' + project_parent + '" of given project path does not exist');
}
@@ -225,13 +224,13 @@ exports.createProject = function(project_path, package_name, project_name, opts)
shell.mkdir(project_path);
shell.cp('-rf', path.join(project_template_dir, 'www'), project_path);
- //Copy project template files
+ // Copy project template files
copyTemplateFiles(project_path, project_name, project_template_dir, package_name);
// Copy xcconfig files
shell.cp('-rf', path.join(project_template_dir, '*.xcconfig'), project_path);
- //CordovaLib stuff
+ // CordovaLib stuff
copyJsAndCordovaLib(project_path, project_name, use_shared);
copyScripts(project_path, project_name);
@@ -239,9 +238,9 @@ exports.createProject = function(project_path, package_name, project_name, opts)
return Q.resolve();
};
-exports.updateProject = function(projectPath, opts) {
- var errorString =
- 'An in-place platform update is not supported. \n'+
+exports.updateProject = function (projectPath, opts) {
+ var errorString =
+ 'An in-place platform update is not supported. \n' +
'The `platforms` folder is always treated as a build artifact.\n' +
'To update your platform, you have to remove, then add your ios platform again.\n' +
'Make sure you save your plugins beforehand using `cordova plugin save`, and save a copy of the platform first if you had manual changes in it.\n' +
@@ -250,40 +249,38 @@ exports.updateProject = function(projectPath, opts) {
'\tcordova platform add ios\n'
;
- return Q.reject(errorString);
+ return Q.reject(errorString);
};
-function generateDoneMessage(type, link) {
+function generateDoneMessage (type, link) {
var pkg = require('../../package');
- var msg = 'iOS project ' + (type == 'update' ? 'updated ' : 'created ') + 'with ' + pkg.name + '@' + pkg.version;
+ var msg = 'iOS project ' + (type === 'update' ? 'updated ' : 'created ') + 'with ' + pkg.name + '@' + pkg.version;
if (link) {
msg += ' and has a linked CordovaLib';
}
return msg;
}
-function update_cordova_subproject(argv) {
- if (argv.length < 1 || argv.length > 2)
- {
+function update_cordova_subproject (argv) {
+ if (argv.length < 1 || argv.length > 2) {
updateSubprojectHelp();
throw new Error('Usage error for update_cordova_subproject');
}
- var projectPath = AbsProjectPath(argv[0]),
- cordovaLibXcodePath;
+ var projectPath = AbsProjectPath(argv[0]);
+ var cordovaLibXcodePath;
if (argv.length < 2) {
cordovaLibXcodePath = path.join(ROOT, 'CordovaLib', 'CordovaLib.xcodeproj');
- }
- else {
+ } else {
cordovaLibXcodePath = AbsProjectPath(argv[1]);
}
- var parentProjectPath = AbsParentPath(projectPath),
- subprojectPath = relpath(cordovaLibXcodePath, parentProjectPath),
- REGEX = /(.+PBXFileReference.+wrapper.pb-project.+)(path = .+?;)(.*)(sourceTree.+;)(.+)/,
- newLine,
- lines = shell.grep('CordovaLib.xcodeproj', path.join(projectPath, 'project.pbxproj')),
- found = false;
+ var parentProjectPath = AbsParentPath(projectPath);
+ var subprojectPath = relpath(cordovaLibXcodePath, parentProjectPath);
+ var REGEX = /(.+PBXFileReference.+wrapper.pb-project.+)(path = .+?;)(.*)(sourceTree.+;)(.+)/;
+ var newLine;
+ var lines = shell.grep('CordovaLib.xcodeproj', path.join(projectPath, 'project.pbxproj'));
+ var found = false;
subprojectPath = subprojectPath.replace(/\\/g, '/');
lines = lines.split('\n');
@@ -291,7 +288,7 @@ function update_cordova_subproject(argv) {
if (lines[i].match(REGEX)) {
found = true;
newLine = lines[i].replace(/path = .+?;/, 'path = ' + subprojectPath + ';');
- newLine = newLine.replace(/sourceTree.+?;/, 'sourceTree = \"<group>\";');
+ newLine = newLine.replace(/sourceTree.+?;/, 'sourceTree = \"<group>\";'); /* eslint no-useless-escape : 0 */
if (!newLine.match('name')) {
newLine = newLine.replace('path = ', 'name = CordovaLib.xcodeproj; path = ');
}
@@ -301,8 +298,8 @@ function update_cordova_subproject(argv) {
// Patching pbxproj to replace copy www shell script with nodejs
// Don't forget to duplicate this in templates/__CLI__.xcodeproj/project.pbxproj and templates/__NON-CLI__.xcodeproj/project.pbxproj on later changes
- var copyWwwSh = 'cordova\/lib\/copy-www-build-step\.sh';
- var copyWwwJs = 'NODEJS_PATH=\/usr\/local\/bin; NVM_NODE_PATH=~\/\.nvm\/versions\/node\/`nvm version 2>\/dev\/null`\/bin; N_NODE_PATH=`find \/usr\/local\/n\/versions\/node\/\* -maxdepth 0 -type d 2>\/dev\/null \| tail -1`\/bin; XCODE_NODE_PATH=`xcode-select --print-path`\/usr\/share\/xcs\/Node\/bin; PATH=\$NODEJS_PATH:\$NVM_NODE_PATH:\$N_NODE_PATH:\$XCODE_NODE_PATH:\$PATH && node cordova\/lib\/copy-www-build-step\.js';
+ var copyWwwSh = 'cordova\/lib\/copy-www-build-step\.sh'; /* eslint no-useless-escape : 0 */
+ var copyWwwJs = 'NODEJS_PATH=\/usr\/local\/bin; NVM_NODE_PATH=~\/\.nvm\/versions\/node\/`nvm version 2>\/dev\/null`\/bin; N_NODE_PATH=`find \/usr\/local\/n\/versions\/node\/\* -maxdepth 0 -type d 2>\/dev\/null \| tail -1`\/bin; XCODE_NODE_PATH=`xcode-select --print-path`\/usr\/share\/xcs\/Node\/bin; PATH=\$NODEJS_PATH:\$NVM_NODE_PATH:\$N_NODE_PATH:\$XCODE_NODE_PATH:\$PATH && node cordova\/lib\/copy-www-build-step\.js'; /* eslint no-useless-escape : 0 */
shell.sed('-i', copyWwwSh, copyWwwJs, path.join(projectPath, 'project.pbxproj'));
if (!found) {
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/project/www/js/index.js
----------------------------------------------------------------------
diff --git a/bin/templates/project/www/js/index.js b/bin/templates/project/www/js/index.js
index c31cd83..f6d6793 100755
--- a/bin/templates/project/www/js/index.js
+++ b/bin/templates/project/www/js/index.js
@@ -18,25 +18,25 @@
*/
var app = {
// Application Constructor
- initialize: function() {
+ initialize: function () {
this.bindEvents();
},
// Bind Event Listeners
//
// Bind any events that are required on startup. Common events are:
// 'load', 'deviceready', 'offline', and 'online'.
- bindEvents: function() {
+ bindEvents: function () {
document.addEventListener('deviceready', this.onDeviceReady, false);
},
// deviceready Event Handler
//
// The scope of 'this' is the event. In order to call the 'receivedEvent'
// function, we must explicitly call 'app.receivedEvent(...);'
- onDeviceReady: function() {
+ onDeviceReady: function () {
app.receivedEvent('deviceready');
},
// Update DOM on a Received Event
- receivedEvent: function(id) {
+ receivedEvent: function (id) {
var parentElement = document.getElementById(id);
var listeningElement = parentElement.querySelector('.listening');
var receivedElement = parentElement.querySelector('.received');
@@ -48,4 +48,4 @@ var app = {
}
};
-app.initialize();
\ No newline at end of file
+app.initialize();
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/Api.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/Api.js b/bin/templates/scripts/cordova/Api.js
index d7e84c0..dd50d11 100644
--- a/bin/templates/scripts/cordova/Api.js
+++ b/bin/templates/scripts/cordova/Api.js
@@ -17,7 +17,7 @@
under the License.
*/
-/*jslint node: true */
+/* jslint node: true */
var fs = require('fs');
var path = require('path');
@@ -31,7 +31,7 @@ var PluginManager = require('cordova-common').PluginManager;
var Q = require('q');
var util = require('util');
-function setupEvents(externalEventEmitter) {
+function setupEvents (externalEventEmitter) {
if (externalEventEmitter) {
// This will make the platform internal events visible outside
events.forwardEventsTo(externalEventEmitter);
@@ -53,7 +53,7 @@ function setupEvents(externalEventEmitter) {
* logging purposes. If no EventEmitter provided, all events will be logged to
* console
*/
-function Api(platform, platformRootDir, events) {
+function Api (platform, platformRootDir, events) {
// 'platform' property is required as per PlatformApi spec
this.platform = platform || 'ios';
this.root = platformRootDir || path.resolve(__dirname, '..');
@@ -64,15 +64,15 @@ function Api(platform, platformRootDir, events) {
var xcodeCordovaProj;
try {
- xcodeProjDir = fs.readdirSync(this.root).filter( function(e) { return e.match(/\.xcodeproj$/i); })[0];
+ xcodeProjDir = fs.readdirSync(this.root).filter(function (e) { return e.match(/\.xcodeproj$/i); })[0];
if (!xcodeProjDir) {
throw new CordovaError('The provided path "' + this.root + '" is not a Cordova iOS project.');
}
- var cordovaProjName = xcodeProjDir.substring(xcodeProjDir.lastIndexOf(path.sep)+1, xcodeProjDir.indexOf('.xcodeproj'));
+ var cordovaProjName = xcodeProjDir.substring(xcodeProjDir.lastIndexOf(path.sep) + 1, xcodeProjDir.indexOf('.xcodeproj'));
xcodeCordovaProj = path.join(this.root, cordovaProjName);
- } catch(e) {
- throw new CordovaError('The provided path "'+this.root+'" is not a Cordova iOS project.');
+ } catch (e) {
+ throw new CordovaError('The provided path "' + this.root + '" is not a Cordova iOS project.');
}
this.locations = {
@@ -119,17 +119,16 @@ Api.createPlatform = function (destination, config, options, events) {
var result;
try {
result = require('../../../lib/create')
- .createProject(destination, config.packageName(), name, options)
- .then(function () {
- // after platform is created we return Api instance based on new Api.js location
- // This is required to correctly resolve paths in the future api calls
- var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
- return new PlatformApi('ios', destination, events);
- });
- }
- catch(e) {
- events.emit('error','createPlatform is not callable from the iOS project API.');
- throw(e);
+ .createProject(destination, config.packageName(), name, options)
+ .then(function () {
+ // after platform is created we return Api instance based on new Api.js location
+ // This is required to correctly resolve paths in the future api calls
+ var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
+ return new PlatformApi('ios', destination, events);
+ });
+ } catch (e) {
+ events.emit('error', 'createPlatform is not callable from the iOS project API.');
+ throw (e);
}
return result;
};
@@ -156,15 +155,14 @@ Api.updatePlatform = function (destination, options, events) {
var result;
try {
result = require('../../../lib/create')
- .updateProject(destination, options)
- .then(function () {
- var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
- return new PlatformApi('ios', destination, events);
- });
- }
- catch (e) {
- events.emit('error','updatePlatform is not callable from the iOS project API, you will need to do this manually.');
- throw(e);
+ .updateProject(destination, options)
+ .then(function () {
+ var PlatformApi = require(path.resolve(destination, 'cordova/Api'));
+ return new PlatformApi('ios', destination, events);
+ });
+ } catch (e) {
+ events.emit('error', 'updatePlatform is not callable from the iOS project API, you will need to do this manually.');
+ throw (e);
}
return result;
};
@@ -234,15 +232,15 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
return PluginManager.get(self.platform, self.locations, xcodeproj)
.addPlugin(plugin, installOptions)
- .then(function(){
+ .then(function () {
var frameworkTags = plugin.getFrameworks(self.platform);
- var frameworkPods = frameworkTags.filter(function(obj){
- return (obj.type == 'podspec');
+ var frameworkPods = frameworkTags.filter(function (obj) {
+ return (obj.type === 'podspec');
});
return Q.resolve(frameworkPods);
})
- .then(function(frameworkPods) {
+ .then(function (frameworkPods) {
if (!(frameworkPods.length)) {
return Q.resolve();
}
@@ -256,9 +254,9 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
events.emit('verbose', 'Adding pods since the plugin contained <framework>(s) with type="podspec"');
var podsjsonFile = new PodsJson(path.join(project_dir, PodsJson.FILENAME));
- var podfileFile = new Podfile(path.join(project_dir, Podfile.FILENAME), project_name);
+ var podfileFile = new Podfile(path.join(project_dir, Podfile.FILENAME), project_name);
- frameworkPods.forEach(function(obj) {
+ frameworkPods.forEach(function (obj) {
var podJson = {
name: obj.src,
type: obj.type,
@@ -266,9 +264,9 @@ Api.prototype.addPlugin = function (plugin, installOptions) {
};
var val = podsjsonFile.get(podJson.name);
- if (val) { // found
+ if (val) { // found
if (podJson.spec !== val.spec) { // exists, different spec, print warning
- events.emit('warn', plugin.id + ' depends on ' + podJson.name + '@' + podJson.spec + ', which conflicts with another plugin. ' + podJson.name + '@' + val.spec + ' is already installed and was not overwritten.');
+ events.emit('warn', plugin.id + ' depends on ' + podJson.name + '@' + podJson.spec + ', which conflicts with another plugin. ' + podJson.name + '@' + val.spec + ' is already installed and was not overwritten.');
}
// increment count, but don't add in Podfile because it already exists
podsjsonFile.increment(podJson.name);
@@ -317,15 +315,15 @@ Api.prototype.removePlugin = function (plugin, uninstallOptions) {
return PluginManager.get(self.platform, self.locations, xcodeproj)
.removePlugin(plugin, uninstallOptions)
- .then(function(){
+ .then(function () {
var frameworkTags = plugin.getFrameworks(self.platform);
- var frameworkPods = frameworkTags.filter(function(obj){
- return (obj.type == 'podspec');
+ var frameworkPods = frameworkTags.filter(function (obj) {
+ return (obj.type === 'podspec');
});
return Q.resolve(frameworkPods);
})
- .then(function(frameworkPods) {
+ .then(function (frameworkPods) {
if (!(frameworkPods.length)) {
return Q.resolve();
}
@@ -336,12 +334,12 @@ Api.prototype.removePlugin = function (plugin, uninstallOptions) {
var Podfile = require('./lib/Podfile').Podfile;
var PodsJson = require('./lib/PodsJson').PodsJson;
- events.emit('verbose', 'Adding pods since the plugin contained <framework>(s) with type=\"podspec\"');
+ events.emit('verbose', 'Adding pods since the plugin contained <framework>(s) with type=\"podspec\"'); /* eslint no-useless-escape : 0 */
var podsjsonFile = new PodsJson(path.join(project_dir, PodsJson.FILENAME));
- var podfileFile = new Podfile(path.join(project_dir, Podfile.FILENAME), project_name);
-
- frameworkPods.forEach(function(obj) {
+ var podfileFile = new Podfile(path.join(project_dir, Podfile.FILENAME), project_name);
+
+ frameworkPods.forEach(function (obj) {
var podJson = {
name: obj.src,
type: obj.type,
@@ -352,7 +350,7 @@ Api.prototype.removePlugin = function (plugin, uninstallOptions) {
if (val) { // found, decrement count
podsjsonFile.decrement(podJson.name);
} else { // not found (perhaps a sync error)
- var message = util.format('plugin \"%s\" podspec \"%s\" does not seem to be in pods.json, nothing to remove. Will attempt to remove from Podfile.', plugin.id, podJson.name);
+ var message = util.format('plugin \"%s\" podspec \"%s\" does not seem to be in pods.json, nothing to remove. Will attempt to remove from Podfile.', plugin.id, podJson.name); /* eslint no-useless-escape : 0 */
events.emit('verbose', message);
}
@@ -412,9 +410,9 @@ Api.prototype.removePlugin = function (plugin, uninstallOptions) {
Api.prototype.build = function (buildOptions) {
var self = this;
return check_reqs.run()
- .then(function () {
- return require('./lib/build').run.call(self, buildOptions);
- });
+ .then(function () {
+ return require('./lib/build').run.call(self, buildOptions);
+ });
};
/**
@@ -429,12 +427,12 @@ Api.prototype.build = function (buildOptions) {
* @return {Promise} A promise either fulfilled if package was built and ran
* successfully, or rejected with CordovaError.
*/
-Api.prototype.run = function(runOptions) {
+Api.prototype.run = function (runOptions) {
var self = this;
return check_reqs.run()
- .then(function () {
- return require('./lib/run').run.call(self, runOptions);
- });
+ .then(function () {
+ return require('./lib/run').run.call(self, runOptions);
+ });
};
/**
@@ -443,15 +441,15 @@ Api.prototype.run = function(runOptions) {
* @return {Promise} Return a promise either fulfilled, or rejected with
* CordovaError.
*/
-Api.prototype.clean = function(cleanOptions) {
+Api.prototype.clean = function (cleanOptions) {
var self = this;
return check_reqs.run()
- .then(function () {
- return require('./lib/clean').run.call(self, cleanOptions);
- })
- .then(function () {
- return require('./lib/prepare').clean.call(self, cleanOptions);
- });
+ .then(function () {
+ return require('./lib/clean').run.call(self, cleanOptions);
+ })
+ .then(function () {
+ return require('./lib/prepare').clean.call(self, cleanOptions);
+ });
};
/**
@@ -462,7 +460,7 @@ Api.prototype.clean = function(cleanOptions) {
* @return {Promise<Requirement[]>} Promise, resolved with set of Requirement
* objects for current platform.
*/
-Api.prototype.requirements = function() {
+Api.prototype.requirements = function () {
return check_reqs.check_all();
};
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/Podfile.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/Podfile.js b/bin/templates/scripts/cordova/lib/Podfile.js
index b648d37..9dc35cf 100644
--- a/bin/templates/scripts/cordova/lib/Podfile.js
+++ b/bin/templates/scripts/cordova/lib/Podfile.js
@@ -18,17 +18,17 @@
*/
'use strict';
-var fs = require('fs'),
- path = require('path'),
- util = require('util'),
- events = require('cordova-common').events,
- Q = require('q'),
- superspawn = require('cordova-common').superspawn,
- CordovaError = require('cordova-common').CordovaError;
+var fs = require('fs');
+var path = require('path');
+var util = require('util');
+var events = require('cordova-common').events;
+var Q = require('q');
+var superspawn = require('cordova-common').superspawn;
+var CordovaError = require('cordova-common').CordovaError;
Podfile.FILENAME = 'Podfile';
-function Podfile(podFilePath, projectName) {
+function Podfile (podFilePath, projectName) {
this.podToken = '##INSERT_POD##';
this.path = podFilePath;
@@ -54,12 +54,12 @@ function Podfile(podFilePath, projectName) {
this.write();
} else {
events.emit('verbose', 'Podfile found in platforms/ios');
- // parse for pods
+ // parse for pods
this.pods = this.__parseForPods(fs.readFileSync(this.path, 'utf8'));
}
}
-Podfile.prototype.__parseForPods = function(text) {
+Podfile.prototype.__parseForPods = function (text) {
// split by \n
var arr = text.split('\n');
@@ -70,38 +70,39 @@ Podfile.prototype.__parseForPods = function(text) {
var podRE = new RegExp('pod \'([^\']*)\'\\s*,?\\s*(.*)');
// only grab lines that don't have the pod spec'
- return arr.filter(function(line) {
+ return arr.filter(function (line) {
var m = podRE.exec(line);
return (m !== null);
})
- .reduce(function(obj, line){
- var m = podRE.exec(line);
+ .reduce(function (obj, line) {
+ var m = podRE.exec(line);
- if (m !== null) {
- // strip out any single quotes around the value m[2]
- var podSpec = m[2].replace(/^\'|\'$/g, '');
- obj[m[1]] = podSpec; // i.e pod 'Foo', '1.2' ==> { 'Foo' : '1.2'}
- }
+ if (m !== null) {
+ // strip out any single quotes around the value m[2]
+ var podSpec = m[2].replace(/^\'|\'$/g, ''); /* eslint no-useless-escape : 0 */
+ obj[m[1]] = podSpec; // i.e pod 'Foo', '1.2' ==> { 'Foo' : '1.2'}
+ }
- return obj;
- }, {});
+ return obj;
+ }, {});
};
-Podfile.prototype.getTemplate = function() {
+Podfile.prototype.getTemplate = function () {
return util.format(
- '# DO NOT MODIFY -- auto-generated by Apache Cordova\n' +
+ '# DO NOT MODIFY -- auto-generated by Apache Cordova\n' +
'platform :ios, \'8.0\'\n' +
'target \'%s\' do\n' +
'\tproject \'%s.xcodeproj\'\n' +
'%s\n' +
'end\n',
- this.projectName, this.projectName, this.podToken);
+ this.projectName, this.projectName, this.podToken);
};
-Podfile.prototype.addSpec = function(name, spec) {
+Podfile.prototype.addSpec = function (name, spec) {
name = name || '';
- spec = spec; // optional
+ // optional
+ spec = spec; /* eslint no-self-assign : 0 */
if (!name.length) { // blank names are not allowed
throw new CordovaError('Podfile addSpec: name is not specified.');
@@ -113,39 +114,39 @@ Podfile.prototype.addSpec = function(name, spec) {
events.emit('verbose', util.format('Added pod line for `%s`', name));
};
-Podfile.prototype.removeSpec = function(name) {
+Podfile.prototype.removeSpec = function (name) {
if (this.existsSpec(name)) {
delete this.pods[name];
this.__dirty = true;
}
-
+
events.emit('verbose', util.format('Removed pod line for `%s`', name));
};
-Podfile.prototype.getSpec = function(name) {
+Podfile.prototype.getSpec = function (name) {
return this.pods[name];
};
-Podfile.prototype.existsSpec = function(name) {
+Podfile.prototype.existsSpec = function (name) {
return (name in this.pods);
};
-Podfile.prototype.clear = function() {
+Podfile.prototype.clear = function () {
this.pods = {};
this.__dirty = true;
};
-Podfile.prototype.destroy = function() {
+Podfile.prototype.destroy = function () {
fs.unlinkSync(this.path);
events.emit('verbose', util.format('Deleted `%s`', this.path));
};
-Podfile.prototype.write = function() {
+Podfile.prototype.write = function () {
var text = this.getTemplate();
var self = this;
var podsString =
- Object.keys(this.pods).map(function(key) {
+ Object.keys(this.pods).map(function (key) {
var name = key;
var spec = self.pods[key];
@@ -160,8 +161,7 @@ Podfile.prototype.write = function() {
} else {
return util.format('\tpod \'%s\'', name);
}
- })
- .join('\n');
+ }).join('\n');
text = text.replace(this.podToken, podsString);
fs.writeFileSync(this.path, text, 'utf8');
@@ -170,16 +170,16 @@ Podfile.prototype.write = function() {
events.emit('verbose', 'Wrote to Podfile.');
};
-Podfile.prototype.isDirty = function() {
+Podfile.prototype.isDirty = function () {
return this.__dirty;
};
-Podfile.prototype.before_install = function(toolOptions) {
+Podfile.prototype.before_install = function (toolOptions) {
toolOptions = toolOptions || {};
// Template tokens in order: project name, project name, debug | release
var template =
- '// DO NOT MODIFY -- auto-generated by Apache Cordova\n' +
+ '// DO NOT MODIFY -- auto-generated by Apache Cordova\n' +
'#include "Pods/Target Support Files/Pods-%s/Pods-%s.%s.xcconfig"';
var debugContents = util.format(template, this.projectName, this.projectName, 'debug');
@@ -194,7 +194,7 @@ Podfile.prototype.before_install = function(toolOptions) {
return Q.resolve(toolOptions);
};
-Podfile.prototype.install = function(requirementsCheckerFunction) {
+Podfile.prototype.install = function (requirementsCheckerFunction) {
var opts = {};
opts.cwd = path.join(this.path, '..'); // parent path of this Podfile
opts.stdio = 'pipe';
@@ -206,34 +206,34 @@ Podfile.prototype.install = function(requirementsCheckerFunction) {
}
return requirementsCheckerFunction()
- .then(function(toolOptions) {
- return self.before_install(toolOptions);
- })
- .then(function(toolOptions) {
- if (toolOptions.ignore) {
- events.emit('verbose', '==== pod install start ====\n');
- events.emit('verbose', toolOptions.ignoreMessage);
- return Q.resolve();
- } else {
- return superspawn.spawn('pod', ['install', '--verbose'], opts)
- .progress(function (stdio){
- if (stdio.stderr) { console.error(stdio.stderr); }
- if (stdio.stdout) {
- if (first) {
- events.emit('verbose', '==== pod install start ====\n');
- first = false;
- }
- events.emit('verbose', stdio.stdout);
- }
- });
- }
- })
- .then(function() { // done
- events.emit('verbose', '==== pod install end ====\n');
- })
- .fail(function(error){
- throw error;
- });
+ .then(function (toolOptions) {
+ return self.before_install(toolOptions);
+ })
+ .then(function (toolOptions) {
+ if (toolOptions.ignore) {
+ events.emit('verbose', '==== pod install start ====\n');
+ events.emit('verbose', toolOptions.ignoreMessage);
+ return Q.resolve();
+ } else {
+ return superspawn.spawn('pod', ['install', '--verbose'], opts)
+ .progress(function (stdio) {
+ if (stdio.stderr) { console.error(stdio.stderr); }
+ if (stdio.stdout) {
+ if (first) {
+ events.emit('verbose', '==== pod install start ====\n');
+ first = false;
+ }
+ events.emit('verbose', stdio.stdout);
+ }
+ });
+ }
+ })
+ .then(function () { // done
+ events.emit('verbose', '==== pod install end ====\n');
+ })
+ .fail(function (error) {
+ throw error;
+ });
};
-module.exports.Podfile = Podfile;
\ No newline at end of file
+module.exports.Podfile = Podfile;
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/PodsJson.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/PodsJson.js b/bin/templates/scripts/cordova/lib/PodsJson.js
index b13a1af..0470527 100644
--- a/bin/templates/scripts/cordova/lib/PodsJson.js
+++ b/bin/templates/scripts/cordova/lib/PodsJson.js
@@ -17,15 +17,15 @@
under the License.
*/
-var fs = require('fs'),
- path = require('path'),
- util = require('util'),
- events = require('cordova-common').events,
- CordovaError = require('cordova-common').CordovaError;
+var fs = require('fs');
+var path = require('path');
+var util = require('util');
+var events = require('cordova-common').events;
+var CordovaError = require('cordova-common').CordovaError;
PodsJson.FILENAME = 'pods.json';
-function PodsJson(podsJsonPath) {
+function PodsJson (podsJsonPath) {
this.path = podsJsonPath;
this.contents = null;
this.__dirty = false;
@@ -41,18 +41,18 @@ function PodsJson(podsJsonPath) {
this.clear();
this.write();
} else {
- events.emit('verbose', 'pods.json found in platforms/ios');
+ events.emit('verbose', 'pods.json found in platforms/ios');
// load contents
this.contents = fs.readFileSync(this.path, 'utf8');
this.contents = JSON.parse(this.contents);
}
}
-PodsJson.prototype.get = function(name) {
+PodsJson.prototype.get = function (name) {
return this.contents[name];
};
-PodsJson.prototype.remove = function(name) {
+PodsJson.prototype.remove = function (name) {
if (this.contents[name]) {
delete this.contents[name];
this.__dirty = true;
@@ -60,17 +60,17 @@ PodsJson.prototype.remove = function(name) {
}
};
-PodsJson.prototype.clear = function() {
+PodsJson.prototype.clear = function () {
this.contents = {};
this.__dirty = true;
};
-PodsJson.prototype.destroy = function() {
+PodsJson.prototype.destroy = function () {
fs.unlinkSync(this.path);
events.emit('verbose', util.format('Deleted `%s`', this.path));
};
-PodsJson.prototype.write = function() {
+PodsJson.prototype.write = function () {
if (this.contents) {
fs.writeFileSync(this.path, JSON.stringify(this.contents, null, 4));
this.__dirty = false;
@@ -78,11 +78,11 @@ PodsJson.prototype.write = function() {
}
};
-PodsJson.prototype.set = function(name, type, spec, count) {
+PodsJson.prototype.set = function (name, type, spec, count) {
this.setJson(name, { name: name, type: type, spec: spec, count: count });
};
-PodsJson.prototype.increment = function(name) {
+PodsJson.prototype.increment = function (name) {
var val = this.get(name);
if (val) {
val.count++;
@@ -90,7 +90,7 @@ PodsJson.prototype.increment = function(name) {
}
};
-PodsJson.prototype.decrement = function(name) {
+PodsJson.prototype.decrement = function (name) {
var val = this.get(name);
if (val) {
val.count--;
@@ -102,13 +102,13 @@ PodsJson.prototype.decrement = function(name) {
}
};
-PodsJson.prototype.setJson = function(name, json) {
+PodsJson.prototype.setJson = function (name, json) {
this.contents[name] = json;
this.__dirty = true;
events.emit('verbose', util.format('Set pods.json for `%s`', name));
};
-PodsJson.prototype.isDirty = function() {
+PodsJson.prototype.isDirty = function () {
return this.__dirty;
};
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/build.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/build.js b/bin/templates/scripts/cordova/lib/build.js
index e2b8312..d7c2cbe 100644
--- a/bin/templates/scripts/cordova/lib/build.js
+++ b/bin/templates/scripts/cordova/lib/build.js
@@ -17,15 +17,13 @@
* under the License.
*/
-/*jshint node: true*/
-
-var Q = require('q'),
- path = require('path'),
- shell = require('shelljs'),
- spawn = require('./spawn'),
- fs = require('fs'),
- plist = require('plist'),
- util = require('util');
+var Q = require('q');
+var path = require('path');
+var shell = require('shelljs');
+var spawn = require('./spawn');
+var fs = require('fs');
+var plist = require('plist');
+var util = require('util');
var check_reqs = require('./check_reqs');
@@ -35,41 +33,43 @@ var projectPath = path.join(__dirname, '..', '..');
var projectName = null;
// These are regular expressions to detect if the user is changing any of the built-in xcodebuildArgs
+/* eslint-disable no-useless-escape */
var buildFlagMatchers = {
- 'xcconfig' : /^\-xcconfig\s*(.*)$/,
- 'workspace' : /^\-workspace\s*(.*)/,
- 'scheme' : /^\-scheme\s*(.*)/,
- 'configuration' : /^\-configuration\s*(.*)/,
- 'sdk' : /^\-sdk\s*(.*)/,
- 'destination' : /^\-destination\s*(.*)/,
- 'archivePath' : /^\-archivePath\s*(.*)/,
- 'configuration_build_dir' : /^(CONFIGURATION_BUILD_DIR=.*)/,
- 'shared_precomps_dir' : /^(SHARED_PRECOMPS_DIR=.*)/
+ 'xcconfig': /^\-xcconfig\s*(.*)$/,
+ 'workspace': /^\-workspace\s*(.*)/,
+ 'scheme': /^\-scheme\s*(.*)/,
+ 'configuration': /^\-configuration\s*(.*)/,
+ 'sdk': /^\-sdk\s*(.*)/,
+ 'destination': /^\-destination\s*(.*)/,
+ 'archivePath': /^\-archivePath\s*(.*)/,
+ 'configuration_build_dir': /^(CONFIGURATION_BUILD_DIR=.*)/,
+ 'shared_precomps_dir': /^(SHARED_PRECOMPS_DIR=.*)/
};
+/* eslint-enable no-useless-escape */
/**
* Returns a promise that resolves to the default simulator target; the logic here
- * matches what `cordova emulate ios` does.
- *
+ * matches what `cordova emulate ios` does.
+ *
* The return object has two properties: `name` (the Xcode destination name),
* `identifier` (the simctl identifier), and `simIdentifier` (essentially the cordova emulate target)
- *
+ *
* @return {Promise}
*/
-function getDefaultSimulatorTarget() {
+function getDefaultSimulatorTarget () {
return require('./list-emulator-build-targets').run()
- .then(function (emulators) {
- var targetEmulator;
- if (emulators.length > 0) {
- targetEmulator = emulators[0];
- }
- emulators.forEach(function (emulator) {
- if (emulator.name.indexOf('iPhone') === 0) {
- targetEmulator = emulator;
+ .then(function (emulators) {
+ var targetEmulator;
+ if (emulators.length > 0) {
+ targetEmulator = emulators[0];
}
+ emulators.forEach(function (emulator) {
+ if (emulator.name.indexOf('iPhone') === 0) {
+ targetEmulator = emulator;
+ }
+ });
+ return targetEmulator;
});
- return targetEmulator;
- });
}
module.exports.run = function (buildOpts) {
@@ -85,126 +85,125 @@ module.exports.run = function (buildOpts) {
return Q.reject('Cannot specify "device" and "emulator" options together.');
}
- if(buildOpts.buildConfig) {
- if(!fs.existsSync(buildOpts.buildConfig)) {
+ if (buildOpts.buildConfig) {
+ if (!fs.existsSync(buildOpts.buildConfig)) {
return Q.reject('Build config file does not exist:' + buildOpts.buildConfig);
}
- events.emit('log','Reading build config file:', path.resolve(buildOpts.buildConfig));
+ events.emit('log', 'Reading build config file:', path.resolve(buildOpts.buildConfig));
var contents = fs.readFileSync(buildOpts.buildConfig, 'utf-8');
var buildConfig = JSON.parse(contents.replace(/^\ufeff/, '')); // Remove BOM
- if(buildConfig.ios) {
+ if (buildConfig.ios) {
var buildType = buildOpts.release ? 'release' : 'debug';
var config = buildConfig.ios[buildType];
- if(config) {
+ if (config) {
['codeSignIdentity', 'codeSignResourceRules', 'provisioningProfile', 'developmentTeam', 'packageType', 'buildFlag'].forEach(
- function(key) {
+ function (key) {
buildOpts[key] = buildOpts[key] || config[key];
});
}
}
}
-return require('./list-devices').run()
- .then(function (devices) {
- if (devices.length > 0 && !(buildOpts.emulator)) {
- // we also explicitly set device flag in options as we pass
- // those parameters to other api (build as an example)
- buildOpts.device = true;
- return check_reqs.check_ios_deploy();
- }
- }).then(function () {
- // CB-12287: Determine the device we should target when building for a simulator
- if (!buildOpts.device) {
- var promise;
- if (buildOpts.target) {
- // a target was given to us, find the matching Xcode destination name
- promise = require('./list-emulator-build-targets').targetForSimIdentifier(buildOpts.target);
- } else {
- // no target provided, pick a default one (matching our emulator logic)
- promise = getDefaultSimulatorTarget();
+ return require('./list-devices').run()
+ .then(function (devices) {
+ if (devices.length > 0 && !(buildOpts.emulator)) {
+ // we also explicitly set device flag in options as we pass
+ // those parameters to other api (build as an example)
+ buildOpts.device = true;
+ return check_reqs.check_ios_deploy();
+ }
+ }).then(function () {
+ // CB-12287: Determine the device we should target when building for a simulator
+ if (!buildOpts.device) {
+ var promise;
+ if (buildOpts.target) {
+ // a target was given to us, find the matching Xcode destination name
+ promise = require('./list-emulator-build-targets').targetForSimIdentifier(buildOpts.target);
+ } else {
+ // no target provided, pick a default one (matching our emulator logic)
+ promise = getDefaultSimulatorTarget();
+ }
+ return promise.then(function (theTarget) {
+ emulatorTarget = theTarget.name;
+ events.emit('log', 'Building for ' + emulatorTarget + ' Simulator');
+ });
+ }
+ }).then(function () {
+ return check_reqs.run();
+ }).then(function () {
+ return findXCodeProjectIn(projectPath);
+ }).then(function (name) {
+ projectName = name;
+ var extraConfig = '';
+ if (buildOpts.codeSignIdentity) {
+ extraConfig += 'CODE_SIGN_IDENTITY = ' + buildOpts.codeSignIdentity + '\n';
+ extraConfig += 'CODE_SIGN_IDENTITY[sdk=iphoneos*] = ' + buildOpts.codeSignIdentity + '\n';
+ }
+ if (buildOpts.codeSignResourceRules) {
+ extraConfig += 'CODE_SIGN_RESOURCE_RULES_PATH = ' + buildOpts.codeSignResourceRules + '\n';
+ }
+ if (buildOpts.provisioningProfile) {
+ extraConfig += 'PROVISIONING_PROFILE = ' + buildOpts.provisioningProfile + '\n';
+ }
+ if (buildOpts.developmentTeam) {
+ extraConfig += 'DEVELOPMENT_TEAM = ' + buildOpts.developmentTeam + '\n';
+ }
+ return Q.nfcall(fs.writeFile, path.join(__dirname, '..', 'build-extras.xcconfig'), extraConfig, 'utf-8');
+ }).then(function () {
+ var configuration = buildOpts.release ? 'Release' : 'Debug';
+
+ events.emit('log', 'Building project: ' + path.join(projectPath, projectName + '.xcworkspace'));
+ events.emit('log', '\tConfiguration: ' + configuration);
+ events.emit('log', '\tPlatform: ' + (buildOpts.device ? 'device' : 'emulator'));
+
+ var buildOutputDir = path.join(projectPath, 'build', (buildOpts.device ? 'device' : 'emulator'));
+
+ // remove the build/device folder before building
+ return spawn('rm', [ '-rf', buildOutputDir ], projectPath)
+ .then(function () {
+ var xcodebuildArgs = getXcodeBuildArgs(projectName, projectPath, configuration, buildOpts.device, buildOpts.buildFlag, emulatorTarget);
+ return spawn('xcodebuild', xcodebuildArgs, projectPath);
+ });
+
+ }).then(function () {
+ if (!buildOpts.device || buildOpts.noSign) {
+ return;
}
- return promise.then(function(theTarget) {
- emulatorTarget = theTarget.name;
- events.emit('log', 'Building for ' + emulatorTarget + ' Simulator');
- });
- }
- }).then(function () {
- return check_reqs.run();
- }).then(function () {
- return findXCodeProjectIn(projectPath);
- }).then(function (name) {
- projectName = name;
- var extraConfig = '';
- if (buildOpts.codeSignIdentity) {
- extraConfig += 'CODE_SIGN_IDENTITY = ' + buildOpts.codeSignIdentity + '\n';
- extraConfig += 'CODE_SIGN_IDENTITY[sdk=iphoneos*] = ' + buildOpts.codeSignIdentity + '\n';
- }
- if (buildOpts.codeSignResourceRules) {
- extraConfig += 'CODE_SIGN_RESOURCE_RULES_PATH = ' + buildOpts.codeSignResourceRules + '\n';
- }
- if (buildOpts.provisioningProfile) {
- extraConfig += 'PROVISIONING_PROFILE = ' + buildOpts.provisioningProfile + '\n';
- }
- if (buildOpts.developmentTeam) {
- extraConfig += 'DEVELOPMENT_TEAM = ' + buildOpts.developmentTeam + '\n';
- }
- return Q.nfcall(fs.writeFile, path.join(__dirname, '..', 'build-extras.xcconfig'), extraConfig, 'utf-8');
- }).then(function () {
- var configuration = buildOpts.release ? 'Release' : 'Debug';
-
- events.emit('log','Building project: ' + path.join(projectPath, projectName + '.xcworkspace'));
- events.emit('log','\tConfiguration: ' + configuration);
- events.emit('log','\tPlatform: ' + (buildOpts.device ? 'device' : 'emulator'));
-
- var buildOutputDir = path.join(projectPath, 'build', (buildOpts.device ? 'device' : 'emulator'));
-
- // remove the build/device folder before building
- return spawn('rm', [ '-rf', buildOutputDir ], projectPath)
- .then(function() {
- var xcodebuildArgs = getXcodeBuildArgs(projectName, projectPath, configuration, buildOpts.device, buildOpts.buildFlag, emulatorTarget);
- return spawn('xcodebuild', xcodebuildArgs, projectPath);
- });
-
- }).then(function () {
- if (!buildOpts.device || buildOpts.noSign) {
- return;
- }
-
- var exportOptions = {'compileBitcode': false, 'method': 'development'};
- if (buildOpts.packageType) {
- exportOptions.method = buildOpts.packageType;
- }
+ var exportOptions = {'compileBitcode': false, 'method': 'development'};
- if (buildOpts.developmentTeam) {
- exportOptions.teamID = buildOpts.developmentTeam;
- }
+ if (buildOpts.packageType) {
+ exportOptions.method = buildOpts.packageType;
+ }
- var exportOptionsPlist = plist.build(exportOptions);
- var exportOptionsPath = path.join(projectPath, 'exportOptions.plist');
+ if (buildOpts.developmentTeam) {
+ exportOptions.teamID = buildOpts.developmentTeam;
+ }
- var buildOutputDir = path.join(projectPath, 'build', 'device');
+ var exportOptionsPlist = plist.build(exportOptions);
+ var exportOptionsPath = path.join(projectPath, 'exportOptions.plist');
+ var buildOutputDir = path.join(projectPath, 'build', 'device');
- function checkSystemRuby() {
- var ruby_cmd = shell.which('ruby');
+ function checkSystemRuby () {
+ var ruby_cmd = shell.which('ruby');
- if (ruby_cmd != '/usr/bin/ruby') {
- events.emit('warn', 'Non-system Ruby in use. This may cause packaging to fail.\n' +
- 'If you use RVM, please run `rvm use system`.\n' +
- 'If you use chruby, please run `chruby system`.');
- }
- }
+ if (ruby_cmd !== '/usr/bin/ruby') {
+ events.emit('warn', 'Non-system Ruby in use. This may cause packaging to fail.\n' +
+ 'If you use RVM, please run `rvm use system`.\n' +
+ 'If you use chruby, please run `chruby system`.');
+ }
+ }
- function packageArchive() {
- var xcodearchiveArgs = getXcodeArchiveArgs(projectName, projectPath, buildOutputDir, exportOptionsPath);
- return spawn('xcodebuild', xcodearchiveArgs, projectPath);
- }
+ function packageArchive () {
+ var xcodearchiveArgs = getXcodeArchiveArgs(projectName, projectPath, buildOutputDir, exportOptionsPath);
+ return spawn('xcodebuild', xcodearchiveArgs, projectPath);
+ }
- return Q.nfcall(fs.writeFile, exportOptionsPath, exportOptionsPlist, 'utf-8')
+ return Q.nfcall(fs.writeFile, exportOptionsPath, exportOptionsPlist, 'utf-8')
.then(checkSystemRuby)
.then(packageArchive);
- });
+ });
};
/**
@@ -212,7 +211,7 @@ return require('./list-devices').run()
* @param {String} projectPath Path where to search project
* @return {Promise} Promise either fulfilled with project name or rejected
*/
-function findXCodeProjectIn(projectPath) {
+function findXCodeProjectIn (projectPath) {
// 'Searching for Xcode project in ' + projectPath);
var xcodeProjFiles = shell.ls(projectPath).filter(function (name) {
return path.extname(name) === '.xcodeproj';
@@ -222,7 +221,7 @@ function findXCodeProjectIn(projectPath) {
return Q.reject('No Xcode project found in ' + projectPath);
}
if (xcodeProjFiles.length > 1) {
- events.emit('warn','Found multiple .xcodeproj directories in \n' +
+ events.emit('warn', 'Found multiple .xcodeproj directories in \n' +
projectPath + '\nUsing first one');
}
@@ -242,7 +241,7 @@ module.exports.findXCodeProjectIn = findXCodeProjectIn;
* @param {String} emulatorTarget Target for emulator (rather than default)
* @return {Array} Array of arguments that could be passed directly to spawn method
*/
-function getXcodeBuildArgs(projectName, projectPath, configuration, isDevice, buildFlags, emulatorTarget) {
+function getXcodeBuildArgs (projectName, projectPath, configuration, isDevice, buildFlags, emulatorTarget) {
var xcodebuildArgs;
var options;
var buildActions;
@@ -254,16 +253,16 @@ function getXcodeBuildArgs(projectName, projectPath, configuration, isDevice, bu
if (typeof buildFlags === 'string' || buildFlags instanceof String) {
parseBuildFlag(buildFlags, customArgs);
} else { // buildFlags is an Array of strings
- buildFlags.forEach( function(flag) {
+ buildFlags.forEach(function (flag) {
parseBuildFlag(flag, customArgs);
});
}
}
-
+
if (isDevice) {
options = [
'-xcconfig', customArgs.xcconfig || path.join(__dirname, '..', 'build-' + configuration.toLowerCase() + '.xcconfig'),
- '-workspace', customArgs.workspace || projectName + '.xcworkspace',
+ '-workspace', customArgs.workspace || projectName + '.xcworkspace',
'-scheme', customArgs.scheme || projectName,
'-configuration', customArgs.configuration || configuration,
'-destination', customArgs.destination || 'generic/platform=iOS',
@@ -303,7 +302,6 @@ function getXcodeBuildArgs(projectName, projectPath, configuration, isDevice, bu
return xcodebuildArgs;
}
-
/**
* Returns array of arguments for xcodebuild
* @param {String} projectName Name of xcode project
@@ -312,16 +310,16 @@ function getXcodeBuildArgs(projectName, projectPath, configuration, isDevice, bu
* @param {String} exportOptionsPath Path to the exportOptions.plist file
* @return {Array} Array of arguments that could be passed directly to spawn method
*/
-function getXcodeArchiveArgs(projectName, projectPath, outputPath, exportOptionsPath) {
- return [
- '-exportArchive',
- '-archivePath', projectName + '.xcarchive',
- '-exportOptionsPlist', exportOptionsPath,
- '-exportPath', outputPath
- ];
+function getXcodeArchiveArgs (projectName, projectPath, outputPath, exportOptionsPath) {
+ return [
+ '-exportArchive',
+ '-archivePath', projectName + '.xcarchive',
+ '-exportOptionsPlist', exportOptionsPath,
+ '-exportPath', outputPath
+ ];
}
-function parseBuildFlag(buildFlag, args) {
+function parseBuildFlag (buildFlag, args) {
var matched;
for (var key in buildFlagMatchers) {
var found = buildFlag.match(buildFlagMatchers[key]);
@@ -336,7 +334,8 @@ function parseBuildFlag(buildFlag, args) {
if (!matched) {
// If the flag starts with a '-' then it is an xcodebuild built-in option or a
// user-defined setting. The regex makes sure that we don't split a user-defined
- // setting that is wrapped in quotes.
+ // setting that is wrapped in quotes.
+ /* eslint-disable no-useless-escape */
if (buildFlag[0] === '-' && !buildFlag.match(/^.*=(\".*\")|(\'.*\')$/)) {
args.otherFlags = args.otherFlags.concat(buildFlag.split(' '));
events.emit('warn', util.format('Adding xcodebuildArg: %s', buildFlag.split(' ')));
@@ -348,7 +347,7 @@ function parseBuildFlag(buildFlag, args) {
}
// help/usage function
-module.exports.help = function help() {
+module.exports.help = function help () {
console.log('');
console.log('Usage: build [--debug | --release] [--archs=\"<list of architectures...>\"]');
console.log(' [--device | --simulator] [--codeSignIdentity=\"<identity>\"]');
@@ -359,6 +358,7 @@ module.exports.help = function help() {
console.log(' --debug : Builds project in debug mode. (Default)');
console.log(' --release : Builds project in release mode.');
console.log(' -r : Shortcut :: builds project in release mode.');
+ /* eslint-enable no-useless-escape */
// TODO: add support for building different archs
// console.log(" --archs : Builds project binaries for specific chip architectures (`anycpu`, `arm`, `x86`, `x64`).");
console.log(' --device, --simulator');
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/check_reqs.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/check_reqs.js b/bin/templates/scripts/cordova/lib/check_reqs.js
index 97877af..e42b80a 100644
--- a/bin/templates/scripts/cordova/lib/check_reqs.js
+++ b/bin/templates/scripts/cordova/lib/check_reqs.js
@@ -16,12 +16,13 @@
specific language governing permissions and limitations
under the License.
*/
+
'use strict';
-const Q = require('q'),
- shell = require('shelljs'),
- util = require('util'),
- versions = require('./versions');
+const Q = require('q');
+const shell = require('shelljs');
+const util = require('util');
+const versions = require('./versions');
const SUPPORTED_OS_PLATFORMS = [ 'darwin' ];
@@ -67,20 +68,20 @@ module.exports.check_os = function () {
Q.reject('Cordova tooling for iOS requires Apple macOS');
};
-function os_platform_is_supported() {
- return (SUPPORTED_OS_PLATFORMS.indexOf(process.platform) != -1);
+function os_platform_is_supported () {
+ return (SUPPORTED_OS_PLATFORMS.indexOf(process.platform) !== -1);
}
-function check_cocoapod_tool(toolChecker) {
+function check_cocoapod_tool (toolChecker) {
toolChecker = toolChecker || checkTool;
if (os_platform_is_supported()) { // CB-12856
return toolChecker('pod', COCOAPODS_MIN_VERSION, COCOAPODS_NOT_FOUND_MESSAGE, 'CocoaPods');
} else {
- return Q.resolve({
- 'ignore': true,
+ return Q.resolve({
+ 'ignore': true,
'ignoreMessage': `CocoaPods check and installation ignored on ${process.platform}`
});
- }
+ }
}
/**
@@ -89,26 +90,26 @@ function check_cocoapod_tool(toolChecker) {
*/
module.exports.check_cocoapods_repo_size = function () {
return check_cocoapod_tool()
- .then(function(toolOptions) {
- // check size of ~/.cocoapods repo
- let commandString = util.format('du -sh %s/.cocoapods', process.env.HOME);
- let command = shell.exec(commandString, { silent:true });
- // command.output is e.g "750M path/to/.cocoapods", we just scan the number
- let size = toolOptions.ignore? 0 : parseFloat(command.output);
-
- if (toolOptions.ignore || command.code === 0) { // success, parse output
- return Q.resolve(size, toolOptions);
- } else { // error, perhaps not found
- return Q.reject(util.format('%s (%s)', COCOAPODS_REPO_NOT_FOUND_MESSAGE, command.output));
- }
- })
- .then(function(repoSize, toolOptions) {
- if (toolOptions.ignore || COCOAPODS_SYNCED_MIN_SIZE <= repoSize) { // success, expected size
- return Q.resolve(toolOptions);
- } else {
- return Q.reject(COCOAPODS_SYNC_ERROR_MESSAGE);
- }
- });
+ .then(function (toolOptions) {
+ // check size of ~/.cocoapods repo
+ let commandString = util.format('du -sh %s/.cocoapods', process.env.HOME);
+ let command = shell.exec(commandString, { silent: true });
+ // command.output is e.g "750M path/to/.cocoapods", we just scan the number
+ let size = toolOptions.ignore ? 0 : parseFloat(command.output);
+
+ if (toolOptions.ignore || command.code === 0) { // success, parse output
+ return Q.resolve(size, toolOptions);
+ } else { // error, perhaps not found
+ return Q.reject(util.format('%s (%s)', COCOAPODS_REPO_NOT_FOUND_MESSAGE, command.output));
+ }
+ })
+ .then(function (repoSize, toolOptions) {
+ if (toolOptions.ignore || COCOAPODS_SYNCED_MIN_SIZE <= repoSize) { // success, expected size
+ return Q.resolve(toolOptions);
+ } else {
+ return Q.reject(COCOAPODS_SYNC_ERROR_MESSAGE);
+ }
+ });
};
/**
@@ -117,20 +118,20 @@ module.exports.check_cocoapods_repo_size = function () {
*/
module.exports.check_cocoapods = function (toolChecker) {
return check_cocoapod_tool(toolChecker)
- // check whether the cocoapods repo has been synced through `pod repo` command
- // a value of '0 repos' means it hasn't been synced
- .then(function(toolOptions) {
- let code = shell.exec('pod repo | grep -e "^0 repos"', { silent:true }).code;
- let repoIsSynced = (code !== 0);
-
- if (toolOptions.ignore || repoIsSynced) {
- // return check_cocoapods_repo_size();
- // we could check the repo size above, but it takes too long.
- return Q.resolve(toolOptions);
- } else {
- return Q.reject(COCOAPODS_NOT_SYNCED_MESSAGE);
- }
- });
+ // check whether the cocoapods repo has been synced through `pod repo` command
+ // a value of '0 repos' means it hasn't been synced
+ .then(function (toolOptions) {
+ let code = shell.exec('pod repo | grep -e "^0 repos"', { silent: true }).code;
+ let repoIsSynced = (code !== 0);
+
+ if (toolOptions.ignore || repoIsSynced) {
+ // return check_cocoapods_repo_size();
+ // we could check the repo size above, but it takes too long.
+ return Q.resolve(toolOptions);
+ } else {
+ return Q.reject(COCOAPODS_NOT_SYNCED_MESSAGE);
+ }
+ });
};
/**
@@ -149,7 +150,7 @@ function checkTool (tool, minVersion, message, toolFriendlyName) {
if (!tool_command) {
return Q.reject(toolFriendlyName + ' was not found. ' + (message || ''));
}
-
+
// check if tool version is greater than specified one
return versions.get_tool_version(tool).then(function (version) {
version = version.trim();
@@ -181,7 +182,7 @@ let Requirement = function (id, name, isFatal) {
*
* @return Promise<Requirement[]> Array of requirements. Due to implementation, promise is always fulfilled.
*/
-module.exports.check_all = function() {
+module.exports.check_all = function () {
const requirements = [
new Requirement('os', 'Apple macOS', true),
@@ -209,19 +210,19 @@ module.exports.check_all = function() {
let requirement = requirements[idx];
return checkFn()
- .then(function (version) {
- requirement.installed = true;
- requirement.metadata.version = version;
- result.push(requirement);
- }, function (err) {
- if (requirement.isFatal) fatalIsHit = true;
- requirement.metadata.reason = err;
- result.push(requirement);
- });
+ .then(function (version) {
+ requirement.installed = true;
+ requirement.metadata.version = version;
+ result.push(requirement);
+ }, function (err) {
+ if (requirement.isFatal) fatalIsHit = true;
+ requirement.metadata.reason = err;
+ result.push(requirement);
+ });
});
}, Q())
- .then(function () {
- // When chain is completed, return requirements array to upstream API
- return result;
- });
+ .then(function () {
+ // When chain is completed, return requirements array to upstream API
+ return result;
+ });
};
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/clean.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/clean.js b/bin/templates/scripts/cordova/lib/clean.js
index 7c8cf56..20e8ac6 100644
--- a/bin/templates/scripts/cordova/lib/clean.js
+++ b/bin/templates/scripts/cordova/lib/clean.js
@@ -6,9 +6,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
@@ -17,16 +17,14 @@
* under the License.
*/
-/*jshint node: true*/
-
-var Q = require('q'),
- path = require('path'),
- shell = require('shelljs'),
- spawn = require('./spawn');
+var Q = require('q');
+var path = require('path');
+var shell = require('shelljs');
+var spawn = require('./spawn');
var projectPath = path.join(__dirname, '..', '..');
-module.exports.run = function() {
+module.exports.run = function () {
var projectName = shell.ls(projectPath).filter(function (name) {
return path.extname(name) === '.xcodeproj';
})[0];
@@ -36,9 +34,9 @@ module.exports.run = function() {
}
return spawn('xcodebuild', ['-project', projectName, '-configuration', 'Debug', '-alltargets', 'clean'], projectPath)
- .then(function () {
- return spawn('xcodebuild', ['-project', projectName, '-configuration', 'Release', '-alltargets', 'clean'], projectPath);
- }).then(function () {
- return shell.rm('-rf', path.join(projectPath, 'build'));
- });
+ .then(function () {
+ return spawn('xcodebuild', ['-project', projectName, '-configuration', 'Release', '-alltargets', 'clean'], projectPath);
+ }).then(function () {
+ return shell.rm('-rf', path.join(projectPath, 'build'));
+ });
};
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/copy-www-build-step.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/copy-www-build-step.js b/bin/templates/scripts/cordova/lib/copy-www-build-step.js
index 7caa200..e05aacf 100644
--- a/bin/templates/scripts/cordova/lib/copy-www-build-step.js
+++ b/bin/templates/scripts/cordova/lib/copy-www-build-step.js
@@ -24,19 +24,19 @@
// This script should not be called directly.
// It is called as a build step from Xcode.
-var BUILT_PRODUCTS_DIR = process.env.BUILT_PRODUCTS_DIR,
- FULL_PRODUCT_NAME = process.env.FULL_PRODUCT_NAME,
- COPY_HIDDEN = process.env.COPY_HIDDEN,
- PROJECT_FILE_PATH = process.env.PROJECT_FILE_PATH;
+var BUILT_PRODUCTS_DIR = process.env.BUILT_PRODUCTS_DIR;
+var FULL_PRODUCT_NAME = process.env.FULL_PRODUCT_NAME;
+var COPY_HIDDEN = process.env.COPY_HIDDEN;
+var PROJECT_FILE_PATH = process.env.PROJECT_FILE_PATH;
-var path = require('path'),
- fs = require('fs'),
- shell = require('shelljs'),
- srcDir = 'www',
- dstDir = path.join(BUILT_PRODUCTS_DIR, FULL_PRODUCT_NAME),
- dstWwwDir = path.join(dstDir, 'www');
+var path = require('path');
+var fs = require('fs');
+var shell = require('shelljs');
+var srcDir = 'www';
+var dstDir = path.join(BUILT_PRODUCTS_DIR, FULL_PRODUCT_NAME);
+var dstWwwDir = path.join(dstDir, 'www');
-if(!BUILT_PRODUCTS_DIR) {
+if (!BUILT_PRODUCTS_DIR) {
console.error('The script is meant to be run as an Xcode build step and relies on env variables set by Xcode.');
process.exit(1);
}
@@ -57,13 +57,13 @@ shell.rm('-rf', path.join(dstDir, 'embedded.mobileprovision'));
// Copy www dir recursively
var code;
-if(!!COPY_HIDDEN) {
+if (COPY_HIDDEN) {
code = shell.exec('rsync -Lra "' + srcDir + '" "' + dstDir + '"').code;
} else {
code = shell.exec('rsync -Lra --exclude="- .*" "' + srcDir + '" "' + dstDir + '"').code;
}
-if(code !== 0) {
+if (code !== 0) {
console.error('Error occured on copying www. Code: ' + code);
process.exit(3);
}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/list-devices
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/list-devices b/bin/templates/scripts/cordova/lib/list-devices
index 3fa3e6d..047d595 100755
--- a/bin/templates/scripts/cordova/lib/list-devices
+++ b/bin/templates/scripts/cordova/lib/list-devices
@@ -19,7 +19,6 @@
under the License.
*/
-/*jshint node: true*/
var Q = require('q'),
exec = require('child_process').exec;
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/list-emulator-build-targets
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/list-emulator-build-targets b/bin/templates/scripts/cordova/lib/list-emulator-build-targets
index d17fc8c..c0d566f 100755
--- a/bin/templates/scripts/cordova/lib/list-emulator-build-targets
+++ b/bin/templates/scripts/cordova/lib/list-emulator-build-targets
@@ -19,7 +19,6 @@
under the License.
*/
-/*jshint node: true*/
var Q = require('q'),
exec = require('child_process').exec;
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/list-emulator-images
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/list-emulator-images b/bin/templates/scripts/cordova/lib/list-emulator-images
index 87a5ad2..d8be576 100755
--- a/bin/templates/scripts/cordova/lib/list-emulator-images
+++ b/bin/templates/scripts/cordova/lib/list-emulator-images
@@ -19,7 +19,6 @@
under the License.
*/
-/*jshint node: true*/
var Q = require('q'),
iossim = require('ios-sim'),
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/list-started-emulators
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/list-started-emulators b/bin/templates/scripts/cordova/lib/list-started-emulators
index 1269e47..710fa2f 100755
--- a/bin/templates/scripts/cordova/lib/list-started-emulators
+++ b/bin/templates/scripts/cordova/lib/list-started-emulators
@@ -19,7 +19,6 @@
under the License.
*/
-/*jshint node: true*/
var Q = require('q'),
exec = require('child_process').exec;
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org
[4/5] ios commit: CB-12895 : removed jshint and added eslint
Posted by au...@apache.org.
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/plugman/pluginHandlers.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/plugman/pluginHandlers.js b/bin/templates/scripts/cordova/lib/plugman/pluginHandlers.js
index 416aba9..1f6920f 100644
--- a/bin/templates/scripts/cordova/lib/plugman/pluginHandlers.js
+++ b/bin/templates/scripts/cordova/lib/plugman/pluginHandlers.js
@@ -30,27 +30,27 @@ var keep_these_frameworks = [
];
var handlers = {
- 'source-file':{
- install:function(obj, plugin, project, options) {
+ 'source-file': {
+ install: function (obj, plugin, project, options) {
installHelper('source-file', obj, plugin.dir, project.projectDir, plugin.id, options, project);
},
- uninstall:function(obj, plugin, project, options) {
+ uninstall: function (obj, plugin, project, options) {
uninstallHelper('source-file', obj, project.projectDir, plugin.id, options, project);
}
},
- 'header-file':{
- install:function(obj, plugin, project, options) {
+ 'header-file': {
+ install: function (obj, plugin, project, options) {
installHelper('header-file', obj, plugin.dir, project.projectDir, plugin.id, options, project);
},
- uninstall:function(obj, plugin, project, options) {
+ uninstall: function (obj, plugin, project, options) {
uninstallHelper('header-file', obj, project.projectDir, plugin.id, options, project);
}
},
- 'resource-file':{
- install:function(obj, plugin, project, options) {
- var src = obj.src,
- target = obj.target,
- srcFile = path.resolve(plugin.dir, src);
+ 'resource-file': {
+ install: function (obj, plugin, project, options) {
+ var src = obj.src;
+ var target = obj.target;
+ var srcFile = path.resolve(plugin.dir, src);
if (!target) {
target = path.basename(src);
@@ -67,9 +67,9 @@ var handlers = {
var link = !!(options && options.link);
copyFile(plugin.dir, src, project.projectDir, destFile, link);
},
- uninstall:function(obj, plugin, project, options) {
- var src = obj.src,
- target = obj.target;
+ uninstall: function (obj, plugin, project, options) {
+ var src = obj.src;
+ var target = obj.target;
if (!target) {
target = path.basename(src);
@@ -80,19 +80,19 @@ var handlers = {
shell.rm('-rf', destFile);
}
},
- 'framework':{ // CB-5238 custom frameworks only
- install:function(obj, plugin, project, options) {
- var src = obj.src,
- custom = !!(obj.custom), // convert to boolean (if truthy/falsy)
- embed = !!(obj.embed), // convert to boolean (if truthy/falsy)
- link = !embed; // either link or embed can be true, but not both. the other has to be false
-
+ 'framework': { // CB-5238 custom frameworks only
+ install: function (obj, plugin, project, options) {
+ var src = obj.src;
+ var custom = !!(obj.custom); // convert to boolean (if truthy/falsy)
+ var embed = !!(obj.embed); // convert to boolean (if truthy/falsy)
+ var link = !embed; // either link or embed can be true, but not both. the other has to be false
+
if (!custom) {
var keepFrameworks = keep_these_frameworks;
if (keepFrameworks.indexOf(src) < 0) {
if (obj.type === 'podspec') {
- //podspec handled in Api.js
+ // podspec handled in Api.js
} else {
project.frameworks[src] = project.frameworks[src] || 0;
project.frameworks[src]++;
@@ -104,8 +104,8 @@ var handlers = {
}
return;
}
- var srcFile = path.resolve(plugin.dir, src),
- targetDir = path.resolve(project.plugins_dir, plugin.id, path.basename(src));
+ var srcFile = path.resolve(plugin.dir, src);
+ var targetDir = path.resolve(project.plugins_dir, plugin.id, path.basename(src));
if (!fs.existsSync(srcFile)) throw new CordovaError('Cannot find framework "' + srcFile + '" for plugin ' + plugin.id + ' in iOS platform');
if (fs.existsSync(targetDir)) throw new CordovaError('Framework "' + targetDir + '" for plugin ' + plugin.id + ' already exists in iOS platform');
var symlink = !!(options && options.link);
@@ -123,23 +123,23 @@ var handlers = {
project.xcode.addFramework(project_relative, opt);
events.emit('verbose', util.format('Custom framework added to project. %s -> %s', src, JSON.stringify(opt)));
},
- uninstall:function(obj, plugin, project, options) {
+ uninstall: function (obj, plugin, project, options) {
var src = obj.src;
- if (!obj.custom) { //CB-9825 cocoapod integration for plugins
+ if (!obj.custom) { // CB-9825 cocoapod integration for plugins
var keepFrameworks = keep_these_frameworks;
if (keepFrameworks.indexOf(src) < 0) {
if (obj.type === 'podspec') {
var podsJSON = require(path.join(project.projectDir, 'pods.json'));
- if(podsJSON[src]) {
- if(podsJSON[src].count > 1) {
+ if (podsJSON[src]) {
+ if (podsJSON[src].count > 1) {
podsJSON[src].count = podsJSON[src].count - 1;
} else {
delete podsJSON[src];
}
}
} else {
- //this should be refactored
+ // this should be refactored
project.frameworks[src] = project.frameworks[src] || 1;
project.frameworks[src]--;
if (project.frameworks[src] < 1) {
@@ -153,8 +153,8 @@ var handlers = {
return;
}
- var targetDir = fixPathSep(path.resolve(project.plugins_dir, plugin.id, path.basename(src))),
- pbxFile = project.xcode.removeFramework(targetDir, {customFramework: true});
+ var targetDir = fixPathSep(path.resolve(project.plugins_dir, plugin.id, path.basename(src)));
+ var pbxFile = project.xcode.removeFramework(targetDir, {customFramework: true});
if (pbxFile) {
project.xcode.removeFromPbxEmbedFrameworksBuildPhase(pbxFile);
}
@@ -162,15 +162,15 @@ var handlers = {
}
},
'lib-file': {
- install:function(obj, plugin, project, options) {
+ install: function (obj, plugin, project, options) {
events.emit('verbose', '<lib-file> install is not supported for iOS plugins');
},
- uninstall:function(obj, plugin, project, options) {
+ uninstall: function (obj, plugin, project, options) {
events.emit('verbose', '<lib-file> uninstall is not supported for iOS plugins');
}
},
- 'asset':{
- install:function(obj, plugin, project, options) {
+ 'asset': {
+ install: function (obj, plugin, project, options) {
if (!obj.src) {
throw new CordovaError(generateAttributeError('src', 'asset', plugin.id));
}
@@ -181,7 +181,7 @@ var handlers = {
copyFile(plugin.dir, obj.src, project.www, obj.target);
if (options && options.usePlatformWww) copyFile(plugin.dir, obj.src, project.platformWww, obj.target);
},
- uninstall:function(obj, plugin, project, options) {
+ uninstall: function (obj, plugin, project, options) {
var target = obj.target;
if (!target) {
@@ -200,7 +200,7 @@ var handlers = {
install: function (obj, plugin, project, options) {
// Copy the plugin's files into the www directory.
var moduleSource = path.resolve(plugin.dir, obj.src);
- var moduleName = plugin.id + '.' + (obj.name || path.basename(obj.src, path.extname (obj.src)));
+ var moduleName = plugin.id + '.' + (obj.name || path.basename(obj.src, path.extname(obj.src)));
// Read in the file, prepend the cordova.define, and write it back out.
var scriptContent = fs.readFileSync(moduleSource, 'utf-8').replace(/^\ufeff/, ''); // Window BOM
@@ -234,7 +234,7 @@ module.exports.getInstaller = function (type) {
events.emit('warn', '<' + type + '> is not supported for iOS plugins');
};
-module.exports.getUninstaller = function(type) {
+module.exports.getUninstaller = function (type) {
if (handlers[type] && handlers[type].uninstall) {
return handlers[type].uninstall;
}
@@ -242,7 +242,7 @@ module.exports.getUninstaller = function(type) {
events.emit('warn', '<' + type + '> is not supported for iOS plugins');
};
-function installHelper(type, obj, plugin_dir, project_dir, plugin_id, options, project) {
+function installHelper (type, obj, plugin_dir, project_dir, plugin_id, options, project) {
var srcFile = path.resolve(plugin_dir, obj.src);
var targetDir = path.resolve(project.plugins_dir, plugin_id, obj.targetDir || '');
var destFile = path.join(targetDir, path.basename(obj.src));
@@ -271,19 +271,19 @@ function installHelper(type, obj, plugin_dir, project_dir, plugin_id, options, p
project_ref = 'Plugins/' + fixPathSep(path.relative(project.plugins_dir, destFile));
}
- if (type == 'header-file') {
+ if (type === 'header-file') {
project.xcode.addHeaderFile(project_ref);
} else if (obj.framework) {
var opt = { weak: obj.weak };
var project_relative = path.join(path.basename(project.xcode_path), project_ref);
project.xcode.addFramework(project_relative, opt);
- project.xcode.addToLibrarySearchPaths({path:project_ref});
+ project.xcode.addToLibrarySearchPaths({path: project_ref});
} else {
- project.xcode.addSourceFile(project_ref, obj.compilerFlags ? {compilerFlags:obj.compilerFlags} : {});
+ project.xcode.addSourceFile(project_ref, obj.compilerFlags ? {compilerFlags: obj.compilerFlags} : {});
}
}
-function uninstallHelper(type, obj, project_dir, plugin_id, options, project) {
+function uninstallHelper (type, obj, project_dir, plugin_id, options, project) {
var targetDir = path.resolve(project.plugins_dir, plugin_id, obj.targetDir || '');
var destFile = path.join(targetDir, path.basename(obj.src));
@@ -298,19 +298,19 @@ function uninstallHelper(type, obj, project_dir, plugin_id, options, project) {
shell.rm('-rf', targetDir);
- if (type == 'header-file') {
+ if (type === 'header-file') {
project.xcode.removeHeaderFile(project_ref);
} else if (obj.framework) {
var project_relative = path.join(path.basename(project.xcode_path), project_ref);
project.xcode.removeFramework(project_relative);
- project.xcode.removeFromLibrarySearchPaths({path:project_ref});
+ project.xcode.removeFromLibrarySearchPaths({path: project_ref});
} else {
project.xcode.removeSourceFile(project_ref);
}
}
-var pathSepFix = new RegExp(path.sep.replace(/\\/,'\\\\'),'g');
-function fixPathSep(file) {
+var pathSepFix = new RegExp(path.sep.replace(/\\/, '\\\\'), 'g');
+function fixPathSep (file) {
return file.replace(pathSepFix, '/');
}
@@ -321,14 +321,12 @@ function copyFile (plugin_dir, src, project_dir, dest, link) {
// check that src path is inside plugin directory
var real_path = fs.realpathSync(src);
var real_plugin_path = fs.realpathSync(plugin_dir);
- if (real_path.indexOf(real_plugin_path) !== 0)
- throw new CordovaError('File "' + src + '" is located outside the plugin directory "' + plugin_dir + '"');
+ if (real_path.indexOf(real_plugin_path) !== 0) { throw new CordovaError('File "' + src + '" is located outside the plugin directory "' + plugin_dir + '"'); }
dest = path.resolve(project_dir, dest);
// check that dest path is located in project directory
- if (dest.indexOf(project_dir) !== 0)
- throw new CordovaError('Destination "' + dest + '" for source file "' + src + '" is located outside the project');
+ if (dest.indexOf(project_dir) !== 0) { throw new CordovaError('Destination "' + dest + '" for source file "' + src + '" is located outside the project'); }
shell.mkdir('-p', path.dirname(dest));
@@ -345,24 +343,22 @@ function copyFile (plugin_dir, src, project_dir, dest, link) {
// Same as copy file but throws error if target exists
function copyNewFile (plugin_dir, src, project_dir, dest, link) {
var target_path = path.resolve(project_dir, dest);
- if (fs.existsSync(target_path))
- throw new CordovaError('"' + target_path + '" already exists!');
+ if (fs.existsSync(target_path)) { throw new CordovaError('"' + target_path + '" already exists!'); }
copyFile(plugin_dir, src, project_dir, dest, !!link);
}
-function linkFileOrDirTree(src, dest) {
+function linkFileOrDirTree (src, dest) {
if (fs.existsSync(dest)) {
shell.rm('-Rf', dest);
}
if (fs.statSync(src).isDirectory()) {
shell.mkdir('-p', dest);
- fs.readdirSync(src).forEach(function(entry) {
+ fs.readdirSync(src).forEach(function (entry) {
linkFileOrDirTree(path.join(src, entry), path.join(dest, entry));
});
- }
- else {
+ } else {
fs.linkSync(src, dest);
}
}
@@ -388,8 +384,8 @@ function removeFileAndParents (baseDir, destFile, stopper) {
// check if directory is empty
var curDir = path.dirname(file);
- while(curDir !== path.resolve(baseDir, stopper)) {
- if(fs.existsSync(curDir) && fs.readdirSync(curDir).length === 0) {
+ while (curDir !== path.resolve(baseDir, stopper)) {
+ if (fs.existsSync(curDir) && fs.readdirSync(curDir).length === 0) {
fs.rmdirSync(curDir);
curDir = path.resolve(curDir, '..');
} else {
@@ -399,6 +395,6 @@ function removeFileAndParents (baseDir, destFile, stopper) {
}
}
-function generateAttributeError(attribute, element, id) {
+function generateAttributeError (attribute, element, id) {
return 'Required attribute "' + attribute + '" not specified in <' + element + '> element from plugin: ' + id;
}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/prepare.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/prepare.js b/bin/templates/scripts/cordova/lib/prepare.js
index d59ff81..0beb95e 100644
--- a/bin/templates/scripts/cordova/lib/prepare.js
+++ b/bin/templates/scripts/cordova/lib/prepare.js
@@ -37,15 +37,13 @@ var FileUpdater = require('cordova-common').FileUpdater;
var projectFile = require('./projectFile');
// launch storyboard and related constants
-var LAUNCHIMAGE_BUILD_SETTING = 'ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME';
+var LAUNCHIMAGE_BUILD_SETTING = 'ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME';
var LAUNCHIMAGE_BUILD_SETTING_VALUE = 'LaunchImage';
var UI_LAUNCH_STORYBOARD_NAME = 'UILaunchStoryboardName';
var CDV_LAUNCH_STORYBOARD_NAME = 'CDVLaunchScreen';
var IMAGESET_COMPACT_SIZE_CLASS = 'compact';
var CDV_ANY_SIZE_CLASS = 'any';
-/*jshint sub:true*/
-
module.exports.prepare = function (cordovaProject, options) {
var self = this;
@@ -56,19 +54,19 @@ module.exports.prepare = function (cordovaProject, options) {
// Update own www dir with project's www assets and plugins' assets and js-files
return Q.when(updateWww(cordovaProject, this.locations))
- .then(function () {
- // update project according to config.xml changes.
- return updateProject(self._config, self.locations);
- })
- .then(function () {
- updateIcons(cordovaProject, self.locations);
- updateSplashScreens(cordovaProject, self.locations);
- updateLaunchStoryboardImages(cordovaProject, self.locations);
- updateFileResources(cordovaProject, self.locations);
- })
- .then(function () {
- events.emit('verbose', 'Prepared iOS project successfully');
- });
+ .then(function () {
+ // update project according to config.xml changes.
+ return updateProject(self._config, self.locations);
+ })
+ .then(function () {
+ updateIcons(cordovaProject, self.locations);
+ updateSplashScreens(cordovaProject, self.locations);
+ updateLaunchStoryboardImages(cordovaProject, self.locations);
+ updateFileResources(cordovaProject, self.locations);
+ })
+ .then(function () {
+ events.emit('verbose', 'Prepared iOS project successfully');
+ });
};
module.exports.clean = function (options) {
@@ -109,7 +107,7 @@ module.exports.clean = function (options) {
* represents current project's configuration. When returned, the
* configuration is already dumped to appropriate config.xml file.
*/
-function updateConfigFile(sourceConfig, configMunger, locations) {
+function updateConfigFile (sourceConfig, configMunger, locations) {
events.emit('verbose', 'Generating platform-specific config.xml from defaults for iOS at ' + locations.configXml);
// First cleanup current config and merge project's one into own
@@ -124,7 +122,7 @@ function updateConfigFile(sourceConfig, configMunger, locations) {
// Merge changes from app's config.xml into platform's one
var config = new ConfigParser(locations.configXml);
xmlHelpers.mergeXml(sourceConfig.doc.getroot(),
- config.doc.getroot(), 'ios', /*clobber=*/true);
+ config.doc.getroot(), 'ios', /* clobber= */true);
config.write();
return config;
@@ -133,7 +131,7 @@ function updateConfigFile(sourceConfig, configMunger, locations) {
/**
* Logs all file operations via the verbose event stream, indented.
*/
-function logFileOp(message) {
+function logFileOp (message) {
events.emit('verbose', ' ' + message);
}
@@ -146,7 +144,7 @@ function logFileOp(message) {
* @param {boolean} destinations An object that contains destinations
* paths for www files.
*/
-function updateWww(cordovaProject, destinations) {
+function updateWww (cordovaProject, destinations) {
var sourceDirs = [
path.relative(cordovaProject.root, cordovaProject.locations.www),
path.relative(cordovaProject.root, destinations.platformWww)
@@ -169,7 +167,7 @@ function updateWww(cordovaProject, destinations) {
/**
* Cleans all files from the platform 'www' directory.
*/
-function cleanWww(projectRoot, locations) {
+function cleanWww (projectRoot, locations) {
var targetDir = path.relative(projectRoot, locations.www);
events.emit('verbose', 'Cleaning ' + targetDir);
@@ -185,7 +183,7 @@ function cleanWww(projectRoot, locations) {
* be used to update project
* @param {Object} locations A map of locations for this platform (In/Out)
*/
-function updateProject(platformConfig, locations) {
+function updateProject (platformConfig, locations) {
// CB-6992 it is necessary to normalize characters
// because node and shell scripts handles unicode symbols differently
@@ -227,16 +225,16 @@ function updateProject(platformConfig, locations) {
updateProjectPlistForLaunchStoryboard(platformConfig, infoPlist);
var info_contents = plist.build(infoPlist);
- info_contents = info_contents.replace(/<string>[\s\r\n]*<\/string>/g,'<string></string>');
+ info_contents = info_contents.replace(/<string>[\s\r\n]*<\/string>/g, '<string></string>');
fs.writeFileSync(plistFile, info_contents, 'utf-8');
events.emit('verbose', 'Wrote out iOS Bundle Identifier "' + pkg + '" and iOS Bundle Version "' + version + '" to ' + plistFile);
- return handleBuildSettings(platformConfig, locations, infoPlist).then(function() {
- if (name == originalName) {
+ return handleBuildSettings(platformConfig, locations, infoPlist).then(function () {
+ if (name === originalName) {
events.emit('verbose', 'iOS Product Name has not changed (still "' + originalName + '")');
return Q();
} else { // CB-11712 <name> was changed, we don't support it'
- var errorString =
+ var errorString =
'The product name change (<name> tag) in config.xml is not supported dynamically.\n' +
'To change your product name, you have to remove, then add your ios platform again.\n' +
'Make sure you save your plugins beforehand using `cordova plugin save`.\n' +
@@ -250,43 +248,43 @@ function updateProject(platformConfig, locations) {
});
}
-function handleOrientationSettings(platformConfig, infoPlist) {
+function handleOrientationSettings (platformConfig, infoPlist) {
switch (getOrientationValue(platformConfig)) {
- case 'portrait':
- infoPlist['UIInterfaceOrientation'] = [ 'UIInterfaceOrientationPortrait' ];
- infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ];
- infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ];
- break;
- case 'landscape':
- infoPlist['UIInterfaceOrientation'] = [ 'UIInterfaceOrientationLandscapeLeft' ];
- infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
- infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
- break;
- case 'all':
- infoPlist['UIInterfaceOrientation'] = [ 'UIInterfaceOrientationPortrait' ];
- infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
- infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
- break;
- case 'default':
- infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
- infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
- delete infoPlist['UIInterfaceOrientation'];
+ case 'portrait':
+ infoPlist['UIInterfaceOrientation'] = [ 'UIInterfaceOrientationPortrait' ];
+ infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ];
+ infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown' ];
+ break;
+ case 'landscape':
+ infoPlist['UIInterfaceOrientation'] = [ 'UIInterfaceOrientationLandscapeLeft' ];
+ infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
+ infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
+ break;
+ case 'all':
+ infoPlist['UIInterfaceOrientation'] = [ 'UIInterfaceOrientationPortrait' ];
+ infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
+ infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
+ break;
+ case 'default':
+ infoPlist['UISupportedInterfaceOrientations'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
+ infoPlist['UISupportedInterfaceOrientations~ipad'] = [ 'UIInterfaceOrientationPortrait', 'UIInterfaceOrientationPortraitUpsideDown', 'UIInterfaceOrientationLandscapeLeft', 'UIInterfaceOrientationLandscapeRight' ];
+ delete infoPlist['UIInterfaceOrientation'];
}
}
-function handleBuildSettings(platformConfig, locations, infoPlist) {
+function handleBuildSettings (platformConfig, locations, infoPlist) {
var targetDevice = parseTargetDevicePreference(platformConfig.getPreference('target-device', 'ios'));
var deploymentTarget = platformConfig.getPreference('deployment-target', 'ios');
var needUpdatedBuildSettingsForLaunchStoryboard = checkIfBuildSettingsNeedUpdatedForLaunchStoryboard(platformConfig, infoPlist);
- // no build settings provided and we don't need to update build settings for launch storyboards,
+ // no build settings provided and we don't need to update build settings for launch storyboards,
// then we don't need to parse and update .pbxproj file
if (!targetDevice && !deploymentTarget && !needUpdatedBuildSettingsForLaunchStoryboard) {
return Q();
}
- var proj = new xcode.project(locations.pbxproj);
+ var proj = new xcode.project(locations.pbxproj); /* eslint new-cap : 0 */
try {
proj.parseSync();
@@ -311,7 +309,7 @@ function handleBuildSettings(platformConfig, locations, infoPlist) {
return Q();
}
-function mapIconResources(icons, iconsDir) {
+function mapIconResources (icons, iconsDir) {
// See https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/MobileHIG/IconMatrix.html
// for launch images sizes reference.
var platformIcons = [
@@ -344,7 +342,7 @@ function mapIconResources(icons, iconsDir) {
return pathMap;
}
-function getIconsDir(projectRoot, platformProjDir) {
+function getIconsDir (projectRoot, platformProjDir) {
var iconsDir;
var xcassetsExists = folderExists(path.join(projectRoot, platformProjDir, 'Images.xcassets/'));
@@ -357,7 +355,7 @@ function getIconsDir(projectRoot, platformProjDir) {
return iconsDir;
}
-function updateIcons(cordovaProject, locations) {
+function updateIcons (cordovaProject, locations) {
var icons = cordovaProject.projectConfig.getIcons('ios');
if (icons.length === 0) {
@@ -373,7 +371,7 @@ function updateIcons(cordovaProject, locations) {
resourceMap, { rootDir: cordovaProject.root }, logFileOp);
}
-function cleanIcons(projectRoot, projectConfig, locations) {
+function cleanIcons (projectRoot, projectConfig, locations) {
var icons = projectConfig.getIcons('ios');
if (icons.length > 0) {
var platformProjDir = path.relative(projectRoot, locations.xcodeCordovaProj);
@@ -390,7 +388,7 @@ function cleanIcons(projectRoot, projectConfig, locations) {
}
}
-function mapSplashScreenResources(splashScreens, splashScreensDir) {
+function mapSplashScreenResources (splashScreens, splashScreensDir) {
var platformSplashScreens = [
{dest: 'Default~iphone.png', width: 320, height: 480},
{dest: 'Default@2x~iphone.png', width: 640, height: 960},
@@ -415,7 +413,7 @@ function mapSplashScreenResources(splashScreens, splashScreensDir) {
return pathMap;
}
-function getSplashScreensDir(projectRoot, platformProjDir) {
+function getSplashScreensDir (projectRoot, platformProjDir) {
var splashScreensDir;
var xcassetsExists = folderExists(path.join(projectRoot, platformProjDir, 'Images.xcassets/'));
@@ -428,7 +426,7 @@ function getSplashScreensDir(projectRoot, platformProjDir) {
return splashScreensDir;
}
-function updateSplashScreens(cordovaProject, locations) {
+function updateSplashScreens (cordovaProject, locations) {
var splashScreens = cordovaProject.projectConfig.getSplashScreens('ios');
if (splashScreens.length === 0) {
@@ -444,7 +442,7 @@ function updateSplashScreens(cordovaProject, locations) {
resourceMap, { rootDir: cordovaProject.root }, logFileOp);
}
-function cleanSplashScreens(projectRoot, projectConfig, locations) {
+function cleanSplashScreens (projectRoot, projectConfig, locations) {
var splashScreens = projectConfig.getSplashScreens('ios');
if (splashScreens.length > 0) {
var platformProjDir = path.relative(projectRoot, locations.xcodeCordovaProj);
@@ -461,7 +459,7 @@ function cleanSplashScreens(projectRoot, projectConfig, locations) {
}
}
-function updateFileResources(cordovaProject, locations) {
+function updateFileResources (cordovaProject, locations) {
const platformDir = path.relative(cordovaProject.root, locations.root);
const files = cordovaProject.projectConfig.getFileResources('ios');
@@ -474,9 +472,9 @@ function updateFileResources(cordovaProject, locations) {
}
let resourceMap = {};
- files.forEach(function(res) {
- let src = res.src,
- target = res.target;
+ files.forEach(function (res) {
+ let src = res.src;
+ let target = res.target;
if (!target) {
target = src;
@@ -498,7 +496,7 @@ function updateFileResources(cordovaProject, locations) {
project.write();
}
-function cleanFileResources(projectRoot, projectConfig, locations) {
+function cleanFileResources (projectRoot, projectConfig, locations) {
const platformDir = path.relative(projectRoot, locations.root);
const files = projectConfig.getFileResources('ios', true);
if (files.length > 0) {
@@ -507,9 +505,9 @@ function cleanFileResources(projectRoot, projectConfig, locations) {
const project = projectFile.parse(locations);
var resourceMap = {};
- files.forEach(function(res) {
- let src = res.src,
- target = res.target;
+ files.forEach(function (res) {
+ let src = res.src;
+ let target = res.target;
if (!target) {
target = src;
@@ -524,7 +522,7 @@ function cleanFileResources(projectRoot, projectConfig, locations) {
});
FileUpdater.updatePaths(
- resourceMap, { rootDir: projectRoot, all: true}, logFileOp);
+ resourceMap, {rootDir: projectRoot, all: true}, logFileOp);
project.write();
}
@@ -536,9 +534,9 @@ function cleanFileResources(projectRoot, projectConfig, locations) {
* combinations are returned, but not all will have a `filename` property. If the latter isn't present,
* the device won't attempt to load an image matching the same traits. If the filename is present,
* the device will try to load the image if it corresponds to the traits.
- *
+ *
* The resulting return looks like this:
- *
+ *
* [
* {
* idiom: 'universal|ipad|iphone',
@@ -550,12 +548,12 @@ function cleanFileResources(projectRoot, projectConfig, locations) {
* target: undefined|'path/to/asset/library/Default@scale~idiom~widthheight.png'
* }, ...
* ]
- *
+ *
* @param {Array<Object>} splashScreens splash screens as defined in config.xml for this platform
* @param {string} launchStoryboardImagesDir project-root/Images.xcassets/LaunchStoryboard.imageset/
* @return {Array<Object>}
*/
-function mapLaunchStoryboardContents(splashScreens, launchStoryboardImagesDir) {
+function mapLaunchStoryboardContents (splashScreens, launchStoryboardImagesDir) {
var platformLaunchStoryboardImages = [];
var idioms = ['universal', 'ipad', 'iphone'];
var scalesForIdiom = {
@@ -567,8 +565,8 @@ function mapLaunchStoryboardContents(splashScreens, launchStoryboardImagesDir) {
idioms.forEach(function (idiom) {
scalesForIdiom[idiom].forEach(function (scale) {
- sizes.forEach(function(width) {
- sizes.forEach(function(height) {
+ sizes.forEach(function (width) {
+ sizes.forEach(function (height) {
var item = {
idiom: idiom,
scale: scale,
@@ -577,7 +575,7 @@ function mapLaunchStoryboardContents(splashScreens, launchStoryboardImagesDir) {
};
/* examples of the search pattern:
- * scale ~ idiom ~ width height
+ * scale ~ idiom ~ width height
* @2x ~ universal ~ any any
* @3x ~ iphone ~ com any
* @2x ~ ipad ~ com any
@@ -610,20 +608,20 @@ function mapLaunchStoryboardContents(splashScreens, launchStoryboardImagesDir) {
/**
* Returns a dictionary representing the source and destination paths for the launch storyboard images
- * that need to be copied.
- *
+ * that need to be copied.
+ *
* The resulting return looks like this:
- *
+ *
* {
* 'target-path': 'source-path',
* ...
* }
- *
+ *
* @param {Array<Object>} splashScreens splash screens as defined in config.xml for this platform
* @param {string} launchStoryboardImagesDir project-root/Images.xcassets/LaunchStoryboard.imageset/
* @return {Object}
*/
-function mapLaunchStoryboardResources(splashScreens, launchStoryboardImagesDir) {
+function mapLaunchStoryboardResources (splashScreens, launchStoryboardImagesDir) {
var platformLaunchStoryboardImages = mapLaunchStoryboardContents(splashScreens, launchStoryboardImagesDir);
var pathMap = {};
platformLaunchStoryboardImages.forEach(function (item) {
@@ -635,10 +633,10 @@ function mapLaunchStoryboardResources(splashScreens, launchStoryboardImagesDir)
}
/**
- * Builds the object that represents the contents.json file for the LaunchStoryboard image set.
- *
+ * Builds the object that represents the contents.json file for the LaunchStoryboard image set.
+ *
* The resulting return looks like this:
- *
+ *
* {
* images: [
* {
@@ -653,15 +651,15 @@ function mapLaunchStoryboardResources(splashScreens, launchStoryboardImagesDir)
* version: 1
* }
* }
- *
+ *
* A bit of minor logic is used to map from the array of images returned from mapLaunchStoryboardContents
* to the format requried by Xcode.
- *
+ *
* @param {Array<Object>} splashScreens splash screens as defined in config.xml for this platform
* @param {string} launchStoryboardImagesDir project-root/Images.xcassets/LaunchStoryboard.imageset/
* @return {Object}
*/
-function getLaunchStoryboardContentsJSON(splashScreens, launchStoryboardImagesDir) {
+function getLaunchStoryboardContentsJSON (splashScreens, launchStoryboardImagesDir) {
var platformLaunchStoryboardImages = mapLaunchStoryboardContents(splashScreens, launchStoryboardImagesDir);
var contentsJSON = {
@@ -671,14 +669,14 @@ function getLaunchStoryboardContentsJSON(splashScreens, launchStoryboardImagesDi
version: 1
}
};
- contentsJSON.images = platformLaunchStoryboardImages.map(function(item) {
+ contentsJSON.images = platformLaunchStoryboardImages.map(function (item) {
var newItem = {
idiom: item.idiom,
scale: item.scale
};
// Xcode doesn't want any size class property if the class is "any"
- // If our size class is "com", Xcode wants "compact".
+ // If our size class is "com", Xcode wants "compact".
if (item.width !== CDV_ANY_SIZE_CLASS) {
newItem['width-class'] = IMAGESET_COMPACT_SIZE_CLASS;
}
@@ -686,7 +684,7 @@ function getLaunchStoryboardContentsJSON(splashScreens, launchStoryboardImagesDi
newItem['height-class'] = IMAGESET_COMPACT_SIZE_CLASS;
}
- // Xcode doesn't want a filename property if there's no image for these traits
+ // Xcode doesn't want a filename property if there's no image for these traits
if (item.filename) {
newItem.filename = item.filename;
}
@@ -697,14 +695,14 @@ function getLaunchStoryboardContentsJSON(splashScreens, launchStoryboardImagesDi
/**
* Determines if the project's build settings may need to be updated for launch storyboard support
- *
+ *
*/
-function checkIfBuildSettingsNeedUpdatedForLaunchStoryboard(platformConfig, infoPlist) {
+function checkIfBuildSettingsNeedUpdatedForLaunchStoryboard (platformConfig, infoPlist) {
var hasLaunchStoryboardImages = platformHasLaunchStoryboardImages(platformConfig);
var hasLegacyLaunchImages = platformHasLegacyLaunchImages(platformConfig);
var currentLaunchStoryboard = infoPlist[UI_LAUNCH_STORYBOARD_NAME];
- if (hasLaunchStoryboardImages && currentLaunchStoryboard == CDV_LAUNCH_STORYBOARD_NAME && !hasLegacyLaunchImages) {
+ if (hasLaunchStoryboardImages && currentLaunchStoryboard === CDV_LAUNCH_STORYBOARD_NAME && !hasLegacyLaunchImages) {
// don't need legacy launch images if we are using our launch storyboard
// so we do need to update the project file
events.emit('verbose', 'Need to update build settings because project is using our launch storyboard.');
@@ -719,12 +717,12 @@ function checkIfBuildSettingsNeedUpdatedForLaunchStoryboard(platformConfig, info
return false;
}
-function updateBuildSettingsForLaunchStoryboard(proj, platformConfig, infoPlist) {
+function updateBuildSettingsForLaunchStoryboard (proj, platformConfig, infoPlist) {
var hasLaunchStoryboardImages = platformHasLaunchStoryboardImages(platformConfig);
var hasLegacyLaunchImages = platformHasLegacyLaunchImages(platformConfig);
var currentLaunchStoryboard = infoPlist[UI_LAUNCH_STORYBOARD_NAME];
- if (hasLaunchStoryboardImages && currentLaunchStoryboard == CDV_LAUNCH_STORYBOARD_NAME && !hasLegacyLaunchImages) {
+ if (hasLaunchStoryboardImages && currentLaunchStoryboard === CDV_LAUNCH_STORYBOARD_NAME && !hasLegacyLaunchImages) {
// don't need legacy launch images if we are using our launch storyboard
events.emit('verbose', 'Removed ' + LAUNCHIMAGE_BUILD_SETTING + ' because project is using our launch storyboard.');
proj.removeBuildProperty(LAUNCHIMAGE_BUILD_SETTING);
@@ -737,7 +735,7 @@ function updateBuildSettingsForLaunchStoryboard(proj, platformConfig, infoPlist)
}
}
-function splashScreensHaveLaunchStoryboardImages(contentsJSON) {
+function splashScreensHaveLaunchStoryboardImages (contentsJSON) {
/* do we have any launch images do we have for our launch storyboard?
* Again, for old Node versions, the below code is equivalent to this:
* return !!contentsJSON.images.find(function (item) {
@@ -749,13 +747,13 @@ function splashScreensHaveLaunchStoryboardImages(contentsJSON) {
}, undefined);
}
-function platformHasLaunchStoryboardImages(platformConfig) {
+function platformHasLaunchStoryboardImages (platformConfig) {
var splashScreens = platformConfig.getSplashScreens('ios');
- var contentsJSON = getLaunchStoryboardContentsJSON(splashScreens, ''); // note: we don't need a file path here; we're just counting
+ var contentsJSON = getLaunchStoryboardContentsJSON(splashScreens, ''); // note: we don't need a file path here; we're just counting
return splashScreensHaveLaunchStoryboardImages(contentsJSON);
}
-function platformHasLegacyLaunchImages(platformConfig) {
+function platformHasLegacyLaunchImages (platformConfig) {
var splashScreens = platformConfig.getSplashScreens('ios');
return !!splashScreens.reduce(function (p, c) {
return (c.width !== undefined || c.height !== undefined) ? c : p;
@@ -765,13 +763,13 @@ function platformHasLegacyLaunchImages(platformConfig) {
/**
* Updates the project's plist based upon our launch storyboard images. If there are no images, then we should
* fall back to the regular launch images that might be supplied (that is, our app will be scaled on an iPad Pro),
- * and if there are some images, we need to alter the UILaunchStoryboardName property to point to
+ * and if there are some images, we need to alter the UILaunchStoryboardName property to point to
* CDVLaunchScreen.
- *
+ *
* There's some logic here to avoid overwriting changes the user might have made to their plist if they are using
* their own launch storyboard.
*/
-function updateProjectPlistForLaunchStoryboard(platformConfig, infoPlist) {
+function updateProjectPlistForLaunchStoryboard (platformConfig, infoPlist) {
var currentLaunchStoryboard = infoPlist[UI_LAUNCH_STORYBOARD_NAME];
events.emit('verbose', 'Current launch storyboard ' + currentLaunchStoryboard);
@@ -799,11 +797,11 @@ function updateProjectPlistForLaunchStoryboard(platformConfig, infoPlist) {
/**
* Returns the directory for the Launch Storyboard image set, if image sets are being used. If they aren't
* being used, returns null.
- *
+ *
* @param {string} projectRoot The project's root directory
* @param {string} platformProjDir The platform's project directory
*/
-function getLaunchStoryboardImagesDir(projectRoot, platformProjDir) {
+function getLaunchStoryboardImagesDir (projectRoot, platformProjDir) {
var launchStoryboardImagesDir;
var xcassetsExists = folderExists(path.join(projectRoot, platformProjDir, 'Images.xcassets/'));
@@ -819,11 +817,11 @@ function getLaunchStoryboardImagesDir(projectRoot, platformProjDir) {
/**
* Update the images for the Launch Storyboard and updates the image set's contents.json file appropriately.
- *
+ *
* @param {Object} cordovaProject The cordova project
* @param {Object} locations A dictionary containing useful location paths
*/
-function updateLaunchStoryboardImages(cordovaProject, locations) {
+function updateLaunchStoryboardImages (cordovaProject, locations) {
var splashScreens = cordovaProject.projectConfig.getSplashScreens('ios');
var platformProjDir = path.relative(cordovaProject.root, locations.xcodeCordovaProj);
var launchStoryboardImagesDir = getLaunchStoryboardImagesDir(cordovaProject.root, platformProjDir);
@@ -835,10 +833,10 @@ function updateLaunchStoryboardImages(cordovaProject, locations) {
events.emit('verbose', 'Updating launch storyboard images at ' + launchStoryboardImagesDir);
FileUpdater.updatePaths(
resourceMap, { rootDir: cordovaProject.root }, logFileOp);
-
+
events.emit('verbose', 'Updating Storyboard image set contents.json');
fs.writeFileSync(path.join(cordovaProject.root, launchStoryboardImagesDir, 'Contents.json'),
- JSON.stringify(contentsJSON, null, 2));
+ JSON.stringify(contentsJSON, null, 2));
}
}
@@ -847,10 +845,10 @@ function updateLaunchStoryboardImages(cordovaProject, locations) {
* file appropriately.
*
* @param {string} projectRoot Path to the project root
- * @param {Object} projectConfig The project's config.xml
+ * @param {Object} projectConfig The project's config.xml
* @param {Object} locations A dictionary containing useful location paths
*/
-function cleanLaunchStoryboardImages(projectRoot, projectConfig, locations) {
+function cleanLaunchStoryboardImages (projectRoot, projectConfig, locations) {
var splashScreens = projectConfig.getSplashScreens('ios');
var platformProjDir = path.relative(projectRoot, locations.xcodeCordovaProj);
var launchStoryboardImagesDir = getLaunchStoryboardImagesDir(projectRoot, platformProjDir);
@@ -868,13 +866,13 @@ function cleanLaunchStoryboardImages(projectRoot, projectConfig, locations) {
resourceMap, { rootDir: projectRoot, all: true }, logFileOp);
// delete filename from contents.json
- contentsJSON.images.forEach(function(image) {
+ contentsJSON.images.forEach(function (image) {
image.filename = undefined;
});
events.emit('verbose', 'Updating Storyboard image set contents.json');
fs.writeFileSync(path.join(projectRoot, launchStoryboardImagesDir, 'Contents.json'),
- JSON.stringify(contentsJSON, null, 2));
+ JSON.stringify(contentsJSON, null, 2));
}
}
@@ -887,7 +885,7 @@ function cleanLaunchStoryboardImages(projectRoot, projectConfig, locations) {
* @return {String} Global/platform-specific orientation in lower-case
* (or empty string if both are undefined).
*/
-function getOrientationValue(platformConfig) {
+function getOrientationValue (platformConfig) {
var ORIENTATION_DEFAULT = 'default';
@@ -899,7 +897,7 @@ function getOrientationValue(platformConfig) {
orientation = orientation.toLowerCase();
// Check if the given global orientation is supported
- if (['default', 'portrait','landscape', 'all'].indexOf(orientation) >= 0) {
+ if (['default', 'portrait', 'landscape', 'all'].indexOf(orientation) >= 0) {
return orientation;
}
@@ -928,45 +926,45 @@ function getOrientationValue(platformConfig) {
NSAllowsArbitraryLoadsInMedia, // boolean (default:false)
}
*/
-function processAccessAndAllowNavigationEntries(config) {
+function processAccessAndAllowNavigationEntries (config) {
var accesses = config.getAccesses();
var allow_navigations = config.getAllowNavigations();
return allow_navigations
- // we concat allow_navigations and accesses, after processing accesses
- .concat(accesses.map(function(obj) {
- // map accesses to a common key interface using 'href', not origin
- obj.href = obj.origin;
- delete obj.origin;
- return obj;
- }))
- // we reduce the array to an object with all the entries processed (key is Hostname)
- .reduce(function(previousReturn, currentElement) {
- var options = {
- minimum_tls_version : currentElement.minimum_tls_version,
- requires_forward_secrecy : currentElement.requires_forward_secrecy,
- requires_certificate_transparency : currentElement.requires_certificate_transparency,
- allows_arbitrary_loads_in_media : currentElement.allows_arbitrary_loads_in_media,
- allows_arbitrary_loads_in_web_content : currentElement.allows_arbitrary_loads_in_web_content,
- allows_local_networking : currentElement.allows_local_networking
- };
- var obj = parseWhitelistUrlForATS(currentElement.href, options);
-
- if (obj) {
- // we 'union' duplicate entries
- var item = previousReturn[obj.Hostname];
- if (!item) {
- item = {};
- }
- for(var o in obj) {
- if (obj.hasOwnProperty(o)) {
- item[o] = obj[o];
+ // we concat allow_navigations and accesses, after processing accesses
+ .concat(accesses.map(function (obj) {
+ // map accesses to a common key interface using 'href', not origin
+ obj.href = obj.origin;
+ delete obj.origin;
+ return obj;
+ }))
+ // we reduce the array to an object with all the entries processed (key is Hostname)
+ .reduce(function (previousReturn, currentElement) {
+ var options = {
+ minimum_tls_version: currentElement.minimum_tls_version,
+ requires_forward_secrecy: currentElement.requires_forward_secrecy,
+ requires_certificate_transparency: currentElement.requires_certificate_transparency,
+ allows_arbitrary_loads_in_media: currentElement.allows_arbitrary_loads_in_media,
+ allows_arbitrary_loads_in_web_content: currentElement.allows_arbitrary_loads_in_web_content,
+ allows_local_networking: currentElement.allows_local_networking
+ };
+ var obj = parseWhitelistUrlForATS(currentElement.href, options);
+
+ if (obj) {
+ // we 'union' duplicate entries
+ var item = previousReturn[obj.Hostname];
+ if (!item) {
+ item = {};
}
+ for (var o in obj) {
+ if (obj.hasOwnProperty(o)) {
+ item[o] = obj[o];
+ }
+ }
+ previousReturn[obj.Hostname] = item;
}
- previousReturn[obj.Hostname] = item;
- }
- return previousReturn;
- }, {});
+ return previousReturn;
+ }, {});
}
/*
@@ -989,7 +987,7 @@ function processAccessAndAllowNavigationEntries(config) {
null is returned if the URL cannot be parsed, or is to be skipped for ATS.
*/
-function parseWhitelistUrlForATS(url, options) {
+function parseWhitelistUrlForATS (url, options) {
var href = URL.parse(url);
var retObj = {};
retObj.Hostname = href.hostname;
@@ -1054,25 +1052,23 @@ function parseWhitelistUrlForATS(url, options) {
// if the scheme is HTTP, we set NSExceptionAllowsInsecureHTTPLoads to YES. Default is NO
if (href.protocol === 'http:') {
retObj.NSExceptionAllowsInsecureHTTPLoads = true;
- }
- else if (!href.protocol && href.pathname.indexOf('*:/') === 0) { // wilcard in protocol
+ } else if (!href.protocol && href.pathname.indexOf('*:/') === 0) { // wilcard in protocol
retObj.NSExceptionAllowsInsecureHTTPLoads = true;
}
return retObj;
}
-
/*
App Transport Security (ATS) writer from <access> and <allow-navigation> tags
in config.xml
*/
-function writeATSEntries(config) {
- var pObj = processAccessAndAllowNavigationEntries(config);
+function writeATSEntries (config) {
+ var pObj = processAccessAndAllowNavigationEntries(config);
var ats = {};
- for(var hostname in pObj) {
+ for (var hostname in pObj) {
if (pObj.hasOwnProperty(hostname)) {
var entry = pObj[hostname];
@@ -1093,13 +1089,13 @@ function writeATSEntries(config) {
if (entry.NSAllowsLocalNetworking) {
ats['NSAllowsLocalNetworking'] = true;
}
-
+
continue;
}
var exceptionDomain = {};
- for(var key in entry) {
+ for (var key in entry) {
if (entry.hasOwnProperty(key) && key !== 'Hostname') {
exceptionDomain[key] = entry[key];
}
@@ -1116,7 +1112,7 @@ function writeATSEntries(config) {
return ats;
}
-function folderExists(folderPath) {
+function folderExists (folderPath) {
try {
var stat = fs.statSync(folderPath);
return stat && stat.isDirectory();
@@ -1127,14 +1123,14 @@ function folderExists(folderPath) {
// Construct a default value for CFBundleVersion as the version with any
// -rclabel stripped=.
-function default_CFBundleVersion(version) {
+function default_CFBundleVersion (version) {
return version.split('-')[0];
}
// Converts cordova specific representation of target device to XCode value
-function parseTargetDevicePreference(value) {
+function parseTargetDevicePreference (value) {
if (!value) return null;
- var map = { 'universal': '"1,2"', 'handset': '"1"', 'tablet': '"2"'};
+ var map = {'universal': '"1,2"', 'handset': '"1"', 'tablet': '"2"'};
if (map[value.toLowerCase()]) {
return map[value.toLowerCase()];
}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/projectFile.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/projectFile.js b/bin/templates/scripts/cordova/lib/projectFile.js
index aab3863..8a3f7e5 100644
--- a/bin/templates/scripts/cordova/lib/projectFile.js
+++ b/bin/templates/scripts/cordova/lib/projectFile.js
@@ -17,8 +17,6 @@
under the License.
*/
-/*jshint node: true*/
-
var xcode = require('xcode');
var plist = require('plist');
var _ = require('underscore');
@@ -31,7 +29,7 @@ var CordovaError = require('cordova-common').CordovaError;
var cachedProjectFiles = {};
-function parseProjectFile(locations) {
+function parseProjectFile (locations) {
var project_dir = locations.root;
var pbxPath = locations.pbxproj;
@@ -62,24 +60,24 @@ function parseProjectFile(locations) {
var resourcesDir = path.resolve(xcode_dir, 'Resources');
cachedProjectFiles[project_dir] = {
- plugins_dir:pluginsDir,
- resources_dir:resourcesDir,
- xcode:xcodeproj,
- xcode_path:xcode_dir,
+ plugins_dir: pluginsDir,
+ resources_dir: resourcesDir,
+ xcode: xcodeproj,
+ xcode_path: xcode_dir,
pbx: pbxPath,
projectDir: project_dir,
platformWww: path.join(project_dir, 'platform_www'),
www: path.join(project_dir, 'www'),
write: function () {
fs.writeFileSync(pbxPath, xcodeproj.writeSync());
- if (Object.keys(this.frameworks).length === 0){
+ if (Object.keys(this.frameworks).length === 0) {
// If there is no framework references remain in the project, just remove this file
shell.rm('-rf', frameworks_file);
return;
}
fs.writeFileSync(frameworks_file, JSON.stringify(this.frameworks, null, 4));
},
- getPackageName: function() {
+ getPackageName: function () {
return plist.parse(fs.readFileSync(plist_file, 'utf8')).CFBundleIdentifier;
},
getInstaller: function (name) {
@@ -93,7 +91,7 @@ function parseProjectFile(locations) {
return cachedProjectFiles[project_dir];
}
-function purgeProjectFileCache(project_dir) {
+function purgeProjectFileCache (project_dir) {
delete cachedProjectFiles[project_dir];
}
@@ -115,7 +113,7 @@ xcode.project.prototype.addToPbxEmbedFrameworksBuildPhase = function (file) {
xcode.project.prototype.removeFromPbxEmbedFrameworksBuildPhase = function (file) {
var sources = this.pbxEmbedFrameworksBuildPhaseObj(file.target);
if (sources) {
- sources.files = _.reject(sources.files, function(file){
+ sources.files = _.reject(sources.files, function (file) {
return file.comment === longComment(file);
});
}
@@ -124,13 +122,13 @@ xcode.project.prototype.removeFromPbxEmbedFrameworksBuildPhase = function (file)
// special handlers to add frameworks to the 'Embed Frameworks' build phase, needed for custom frameworks
// see CB-9517. should probably be moved to node-xcode.
var util = require('util');
-function pbxBuildPhaseObj(file) {
+function pbxBuildPhaseObj (file) {
var obj = Object.create(null);
obj.value = file.uuid;
obj.comment = longComment(file);
return obj;
}
-function longComment(file) {
+function longComment (file) {
return util.format('%s in %s', file.basename, file.group);
}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/run.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/run.js b/bin/templates/scripts/cordova/lib/run.js
index d3a2cd1..3a6246e 100644
--- a/bin/templates/scripts/cordova/lib/run.js
+++ b/bin/templates/scripts/cordova/lib/run.js
@@ -17,14 +17,12 @@
under the License.
*/
-/*jshint node: true*/
-
-var Q = require('q'),
- path = require('path'),
- iossim = require('ios-sim'),
- build = require('./build'),
- spawn = require('./spawn'),
- check_reqs = require('./check_reqs');
+var Q = require('q');
+var path = require('path');
+var iossim = require('ios-sim');
+var build = require('./build');
+var spawn = require('./spawn');
+var check_reqs = require('./check_reqs');
var events = require('cordova-common').events;
@@ -51,70 +49,70 @@ module.exports.run = function (runOptions) {
var useDevice = !!runOptions.device;
return require('./list-devices').run()
- .then(function (devices) {
- if (devices.length > 0 && !(runOptions.emulator)) {
- useDevice = true;
- // we also explicitly set device flag in options as we pass
- // those parameters to other api (build as an example)
- runOptions.device = true;
- return check_reqs.check_ios_deploy();
- }
- }).then(function () {
- if (!runOptions.nobuild) {
- return build.run(runOptions);
- } else {
- return Q.resolve();
- }
- }).then(function () {
- return build.findXCodeProjectIn(projectPath);
- }).then(function (projectName) {
- var appPath = path.join(projectPath, 'build', 'emulator', projectName + '.app');
- var buildOutputDir = path.join(projectPath, 'build', 'device');
-
- // select command to run and arguments depending whether
- // we're running on device/emulator
- if (useDevice) {
- return module.exports.checkDeviceConnected()
- .then(function() {
- // Unpack IPA
- var ipafile = path.join(buildOutputDir, projectName + '.ipa');
-
- // unpack the existing platform/ios/build/device/appname.ipa (zipfile), will create a Payload folder
- return spawn('unzip', [ '-o', '-qq', ipafile ], buildOutputDir);
- })
- .then(function() {
- // Uncompress IPA (zip file)
- var appFileInflated = path.join(buildOutputDir, 'Payload', projectName + '.app');
- var appFile = path.join(buildOutputDir, projectName + '.app');
- var payloadFolder = path.join(buildOutputDir, 'Payload');
-
- // delete the existing platform/ios/build/device/appname.app
- return spawn('rm', [ '-rf', appFile ], buildOutputDir)
- .then(function() {
- // move the platform/ios/build/device/Payload/appname.app to parent
- return spawn('mv', [ '-f', appFileInflated, buildOutputDir ], buildOutputDir);
+ .then(function (devices) {
+ if (devices.length > 0 && !(runOptions.emulator)) {
+ useDevice = true;
+ // we also explicitly set device flag in options as we pass
+ // those parameters to other api (build as an example)
+ runOptions.device = true;
+ return check_reqs.check_ios_deploy();
+ }
+ }).then(function () {
+ if (!runOptions.nobuild) {
+ return build.run(runOptions);
+ } else {
+ return Q.resolve();
+ }
+ }).then(function () {
+ return build.findXCodeProjectIn(projectPath);
+ }).then(function (projectName) {
+ var appPath = path.join(projectPath, 'build', 'emulator', projectName + '.app');
+ var buildOutputDir = path.join(projectPath, 'build', 'device');
+
+ // select command to run and arguments depending whether
+ // we're running on device/emulator
+ if (useDevice) {
+ return module.exports.checkDeviceConnected()
+ .then(function () {
+ // Unpack IPA
+ var ipafile = path.join(buildOutputDir, projectName + '.ipa');
+
+ // unpack the existing platform/ios/build/device/appname.ipa (zipfile), will create a Payload folder
+ return spawn('unzip', [ '-o', '-qq', ipafile ], buildOutputDir);
+ })
+ .then(function () {
+ // Uncompress IPA (zip file)
+ var appFileInflated = path.join(buildOutputDir, 'Payload', projectName + '.app');
+ var appFile = path.join(buildOutputDir, projectName + '.app');
+ var payloadFolder = path.join(buildOutputDir, 'Payload');
+
+ // delete the existing platform/ios/build/device/appname.app
+ return spawn('rm', [ '-rf', appFile ], buildOutputDir)
+ .then(function () {
+ // move the platform/ios/build/device/Payload/appname.app to parent
+ return spawn('mv', [ '-f', appFileInflated, buildOutputDir ], buildOutputDir);
+ })
+ .then(function () {
+ // delete the platform/ios/build/device/Payload folder
+ return spawn('rm', [ '-rf', payloadFolder ], buildOutputDir);
+ });
})
- .then(function() {
- // delete the platform/ios/build/device/Payload folder
- return spawn('rm', [ '-rf', payloadFolder ], buildOutputDir);
+ .then(function () {
+ appPath = path.join(projectPath, 'build', 'device', projectName + '.app');
+ var extraArgs = [];
+ if (runOptions.argv) {
+ // argv.slice(2) removes node and run.js, filterSupportedArgs removes the run.js args
+ extraArgs = module.exports.filterSupportedArgs(runOptions.argv.slice(2));
+ }
+ return module.exports.deployToDevice(appPath, runOptions.target, extraArgs);
+ }, function () {
+ // if device connection check failed use emulator then
+ return module.exports.deployToSim(appPath, runOptions.target);
});
- })
- .then(function() {
- appPath = path.join(projectPath, 'build', 'device', projectName + '.app');
- var extraArgs = [];
- if (runOptions.argv) {
- // argv.slice(2) removes node and run.js, filterSupportedArgs removes the run.js args
- extraArgs = module.exports.filterSupportedArgs(runOptions.argv.slice(2));
- }
- return module.exports.deployToDevice(appPath, runOptions.target, extraArgs);
- }, function () {
- // if device connection check failed use emulator then
+ } else {
return module.exports.deployToSim(appPath, runOptions.target);
- });
- } else {
- return module.exports.deployToSim(appPath, runOptions.target);
- }
- });
+ }
+ });
};
module.exports.filterSupportedArgs = filterSupportedArgs;
@@ -130,27 +128,27 @@ module.exports.listEmulators = listEmulators;
*
* @return {Array} array with unsupported args for the 'run' command
*/
-function filterSupportedArgs(args) {
- var filtered = [];
- var sargs = ['--device', '--emulator', '--nobuild', '--list', '--target', '--debug', '--release'];
- var re = new RegExp(sargs.join('|'));
-
- args.forEach(function(element) {
- // supported args not found, we add
- // we do a regex search because --target can be "--target=XXX"
- if (element.search(re) == -1) {
- filtered.push(element);
- }
- }, this);
+function filterSupportedArgs (args) {
+ var filtered = [];
+ var sargs = ['--device', '--emulator', '--nobuild', '--list', '--target', '--debug', '--release'];
+ var re = new RegExp(sargs.join('|'));
+
+ args.forEach(function (element) {
+ // supported args not found, we add
+ // we do a regex search because --target can be "--target=XXX"
+ if (element.search(re) === -1) {
+ filtered.push(element);
+ }
+ }, this);
- return filtered;
+ return filtered;
}
/**
* Checks if any iOS device is connected
* @return {Promise} Fullfilled when any device is connected, rejected otherwise
*/
-function checkDeviceConnected() {
+function checkDeviceConnected () {
return spawn('ios-deploy', ['-c', '-t', '1']);
}
@@ -160,7 +158,7 @@ function checkDeviceConnected() {
* @param {String} appPath Path to application package
* @return {Promise} Resolves when deploy succeeds otherwise rejects
*/
-function deployToDevice(appPath, target, extraArgs) {
+function deployToDevice (appPath, target, extraArgs) {
// Deploying to device...
if (target) {
return spawn('ios-deploy', ['--justlaunch', '-d', '-b', appPath, '-i', target].concat(extraArgs));
@@ -175,51 +173,51 @@ function deployToDevice(appPath, target, extraArgs) {
* @param {String} target Target device type
* @return {Promise} Resolves when deploy succeeds otherwise rejects
*/
-function deployToSim(appPath, target) {
+function deployToSim (appPath, target) {
// Select target device for emulator. Default is 'iPhone-6'
if (!target) {
return require('./list-emulator-images').run()
- .then(function (emulators) {
- if (emulators.length > 0) {
- target = emulators[0];
- }
- emulators.forEach(function (emulator) {
- if (emulator.indexOf('iPhone') === 0) {
- target = emulator;
+ .then(function (emulators) {
+ if (emulators.length > 0) {
+ target = emulators[0];
}
+ emulators.forEach(function (emulator) {
+ if (emulator.indexOf('iPhone') === 0) {
+ target = emulator;
+ }
+ });
+ events.emit('log', 'No target specified for emulator. Deploying to ' + target + ' simulator');
+ return startSim(appPath, target);
});
- events.emit('log','No target specified for emulator. Deploying to ' + target + ' simulator');
- return startSim(appPath, target);
- });
} else {
return startSim(appPath, target);
}
}
-function startSim(appPath, target) {
+function startSim (appPath, target) {
var logPath = path.join(cordovaPath, 'console.log');
return iossim.launch(appPath, 'com.apple.CoreSimulator.SimDeviceType.' + target, logPath, '--exit');
}
-function listDevices() {
+function listDevices () {
return require('./list-devices').run()
- .then(function (devices) {
- events.emit('log','Available iOS Devices:');
- devices.forEach(function (device) {
- events.emit('log','\t' + device);
+ .then(function (devices) {
+ events.emit('log', 'Available iOS Devices:');
+ devices.forEach(function (device) {
+ events.emit('log', '\t' + device);
+ });
});
- });
}
-function listEmulators() {
+function listEmulators () {
return require('./list-emulator-images').run()
- .then(function (emulators) {
- events.emit('log','Available iOS Simulators:');
- emulators.forEach(function (emulator) {
- events.emit('log','\t' + emulator);
+ .then(function (emulators) {
+ events.emit('log', 'Available iOS Simulators:');
+ emulators.forEach(function (emulator) {
+ events.emit('log', '\t' + emulator);
+ });
});
- });
}
module.exports.help = function () {
@@ -238,7 +236,7 @@ module.exports.help = function () {
console.log('Examples:');
console.log(' run');
console.log(' run --device');
- console.log(' run --emulator --target=\"iPhone-6-Plus\"');
+ console.log(' run --emulator --target=\"iPhone-6-Plus\"'); /* eslint no-useless-escape : 0 */
console.log(' run --device --release');
console.log(' run --emulator --debug');
console.log('');
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/spawn.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/spawn.js b/bin/templates/scripts/cordova/lib/spawn.js
index 2162b9c..b5a5685 100644
--- a/bin/templates/scripts/cordova/lib/spawn.js
+++ b/bin/templates/scripts/cordova/lib/spawn.js
@@ -17,32 +17,30 @@
under the License.
*/
-/*jshint node: true*/
-
-var Q = require('q'),
- proc = require('child_process');
+var Q = require('q');
+var proc = require('child_process');
/**
- * Run specified command with arguments
+ * Run specified command with arguments
* @param {String} cmd Command
* @param {Array} args Array of arguments that should be passed to command
* @param {String} opt_cwd Working directory for command
* @param {String} opt_verbosity Verbosity level for command stdout output, "verbose" by default
* @return {Promise} Promise either fullfilled or rejected with error code
*/
-module.exports = function(cmd, args, opt_cwd) {
+module.exports = function (cmd, args, opt_cwd) {
var d = Q.defer();
try {
var child = proc.spawn(cmd, args, {cwd: opt_cwd, stdio: 'inherit'});
- child.on('exit', function(code) {
+ child.on('exit', function (code) {
if (code) {
d.reject('Error code ' + code + ' for command: ' + cmd + ' with args: ' + args);
} else {
d.resolve();
}
});
- } catch(e) {
+ } catch (e) {
d.reject(e);
}
return d.promise;
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/bin/templates/scripts/cordova/lib/versions.js
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/lib/versions.js b/bin/templates/scripts/cordova/lib/versions.js
index da31d4f..c6a41b8 100755
--- a/bin/templates/scripts/cordova/lib/versions.js
+++ b/bin/templates/scripts/cordova/lib/versions.js
@@ -19,53 +19,51 @@
under the License.
*/
-var child_process = require('child_process'),
- Q = require('q');
+var child_process = require('child_process');
+var Q = require('q');
-exports.get_apple_ios_version = function() {
+exports.get_apple_ios_version = function () {
var d = Q.defer();
- child_process.exec('xcodebuild -showsdks', function(error, stdout, stderr) {
+ child_process.exec('xcodebuild -showsdks', function (error, stdout, stderr) {
if (error) {
d.reject(stderr);
- }
- else {
+ } else {
d.resolve(stdout);
}
});
- return d.promise.then(function(output) {
- var regex = /[0-9]*\.[0-9]*/,
- versions = [],
- regexIOS = /^iOS \d+/;
+ return d.promise.then(function (output) {
+ var regex = /[0-9]*\.[0-9]*/;
+ var versions = [];
+ var regexIOS = /^iOS \d+/;
output = output.split('\n');
for (var i = 0; i < output.length; i++) {
if (output[i].trim().match(regexIOS)) {
versions[versions.length] = parseFloat(output[i].match(regex)[0]);
- }
+ }
}
versions.sort();
console.log(versions[0]);
return Q();
- }, function(stderr) {
+ }, function (stderr) {
return Q.reject(stderr);
});
};
-exports.get_apple_osx_version = function() {
+exports.get_apple_osx_version = function () {
var d = Q.defer();
- child_process.exec('xcodebuild -showsdks', function(error, stdout, stderr) {
+ child_process.exec('xcodebuild -showsdks', function (error, stdout, stderr) {
if (error) {
d.reject(stderr);
- }
- else {
+ } else {
d.resolve(stdout);
}
});
- return d.promise.then(function(output) {
- var regex = /[0-9]*\.[0-9]*/,
- versions = [],
- regexOSX = /^OS X \d+/;
+ return d.promise.then(function (output) {
+ var regex = /[0-9]*\.[0-9]*/;
+ var versions = [];
+ var regexOSX = /^OS X \d+/;
output = output.split('\n');
for (var i = 0; i < output.length; i++) {
if (output[i].trim().match(regexOSX)) {
@@ -75,14 +73,14 @@ exports.get_apple_osx_version = function() {
versions.sort();
console.log(versions[0]);
return Q();
- }, function(stderr) {
+ }, function (stderr) {
return Q.reject(stderr);
});
};
-exports.get_apple_xcode_version = function() {
+exports.get_apple_xcode_version = function () {
var d = Q.defer();
- child_process.exec('xcodebuild -version', function(error, stdout, stderr) {
+ child_process.exec('xcodebuild -version', function (error, stdout, stderr) {
var versionMatch = /Xcode (.*)/.exec(stdout);
if (error || !versionMatch) {
d.reject(stderr);
@@ -98,9 +96,9 @@ exports.get_apple_xcode_version = function() {
* @return {Promise} Promise that either resolved with ios-deploy version
* or rejected in case of error
*/
-exports.get_ios_deploy_version = function() {
+exports.get_ios_deploy_version = function () {
var d = Q.defer();
- child_process.exec('ios-deploy --version', function(error, stdout, stderr) {
+ child_process.exec('ios-deploy --version', function (error, stdout, stderr) {
if (error) {
d.reject(stderr);
} else {
@@ -115,9 +113,9 @@ exports.get_ios_deploy_version = function() {
* @return {Promise} Promise that either resolved with pod version
* or rejected in case of error
*/
-exports.get_cocoapods_version = function() {
+exports.get_cocoapods_version = function () {
var d = Q.defer();
- child_process.exec('pod --version', function(error, stdout, stderr) {
+ child_process.exec('pod --version', function (error, stdout, stderr) {
if (error) {
d.reject(stderr);
} else {
@@ -132,9 +130,9 @@ exports.get_cocoapods_version = function() {
* @return {Promise} Promise that either resolved with ios-sim version
* or rejected in case of error
*/
-exports.get_ios_sim_version = function() {
+exports.get_ios_sim_version = function () {
var d = Q.defer();
- child_process.exec('ios-sim --version', function(error, stdout, stderr) {
+ child_process.exec('ios-sim --version', function (error, stdout, stderr) {
if (error) {
d.reject(stderr);
} else {
@@ -152,11 +150,11 @@ exports.get_ios_sim_version = function() {
*/
exports.get_tool_version = function (toolName) {
switch (toolName) {
- case 'xcodebuild': return exports.get_apple_xcode_version();
- case 'ios-sim': return exports.get_ios_sim_version();
- case 'ios-deploy': return exports.get_ios_deploy_version();
- case 'pod': return exports.get_cocoapods_version();
- default: return Q.reject(toolName + ' is not valid tool name. Valid names are: \'xcodebuild\', \'ios-sim\', \'ios-deploy\', and \'pod\'');
+ case 'xcodebuild': return exports.get_apple_xcode_version();
+ case 'ios-sim': return exports.get_ios_sim_version();
+ case 'ios-deploy': return exports.get_ios_deploy_version();
+ case 'pod': return exports.get_cocoapods_version();
+ default: return Q.reject(toolName + ' is not valid tool name. Valid names are: \'xcodebuild\', \'ios-sim\', \'ios-deploy\', and \'pod\'');
}
};
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/package.json
----------------------------------------------------------------------
diff --git a/package.json b/package.json
index 63927a0..92a7b4d 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,7 @@
],
"scripts": {
"test": "npm run e2e-tests && npm run objc-tests && npm run unit-tests",
- "posttest": "npm run jshint",
+ "posttest": "npm run eslint",
"cover": "istanbul cover --root bin/templates/scripts/cordova --print detail jasmine -- --config=tests/spec/jasmine.json",
"e2e-tests": "jasmine tests/spec/create.spec.js",
"objc-tests": "npm run objc-tests-lib && npm run objc-tests-framework",
@@ -27,15 +27,21 @@
"objc-tests-framework": "xcodebuild test -workspace tests/cordova-ios.xcworkspace -scheme CordovaFrameworkApp -destination \"platform=iOS Simulator,name=iPhone 5\" CONFIGURATION_BUILD_DIR=\"`mktemp -d 2>/dev/null || mktemp -d -t 'cordova-ios'`\"",
"preobjc-tests": "tests/scripts/killsim.js",
"unit-tests": "jasmine --config=tests/spec/jasmine.json",
- "jshint": "jshint bin tests"
+ "eslint": "eslint bin tests"
},
"author": "Apache Software Foundation",
"license": "Apache-2.0",
"devDependencies": {
"coffee-script": "^1.7.1",
+ "eslint": "^4.0.0",
+ "eslint-config-semistandard": "^11.0.0",
+ "eslint-config-standard": "^10.2.1",
+ "eslint-plugin-import": "^2.7.0",
+ "eslint-plugin-node": "^5.1.0",
+ "eslint-plugin-promise": "^3.5.0",
+ "eslint-plugin-standard": "^3.0.1",
"istanbul": "^0.4.2",
"jasmine": "~2.6.0",
- "jshint": "^2.6.0",
"nodeunit": "^0.8.7",
"rewire": "^2.5.1",
"tmp": "^0.0.26",
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/.jshintrc
----------------------------------------------------------------------
diff --git a/tests/.jshintrc b/tests/.jshintrc
deleted file mode 100644
index 23199d7..0000000
--- a/tests/.jshintrc
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "node": true
- , "bitwise": true
- , "undef": true
- , "trailing": true
- , "quotmark": true
- , "indent": 4
- , "unused": "vars"
- , "latedef": "nofunc"
- , "jasmine": true
- , "esversion": 6
-}
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/scripts/killsim.js
----------------------------------------------------------------------
diff --git a/tests/scripts/killsim.js b/tests/scripts/killsim.js
index 0a8cdc1..531b5e9 100755
--- a/tests/scripts/killsim.js
+++ b/tests/scripts/killsim.js
@@ -21,7 +21,7 @@
var shell = require('shelljs');
-function killSimulator(processName) {
+function killSimulator (processName) {
var result;
var return_code = 0;
// check iOS Simulator if running
@@ -30,7 +30,7 @@ function killSimulator(processName) {
// if iOS Simulator is running, kill it
if (return_code === 0) { // found
- shell.echo('iOS Simulator is running as ("'+ processName +'"), we\'re going to kill it.');
+ shell.echo('iOS Simulator is running as ("' + processName + '"), we\'re going to kill it.');
result = shell.exec('killall "' + processName + '"');
if (result.code !== 0) {
shell.echo('Failed to kill process: ' + processName);
@@ -41,4 +41,4 @@ function killSimulator(processName) {
}
killSimulator('iOS Simulator'); // XCode 6
-killSimulator('Simulator'); // XCode 7
+killSimulator('Simulator'); // XCode 7
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/.eslintrc.yml
----------------------------------------------------------------------
diff --git a/tests/spec/.eslintrc.yml b/tests/spec/.eslintrc.yml
new file mode 100644
index 0000000..6afba65
--- /dev/null
+++ b/tests/spec/.eslintrc.yml
@@ -0,0 +1,2 @@
+env:
+ jasmine: true
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/83435d56/tests/spec/create.spec.js
----------------------------------------------------------------------
diff --git a/tests/spec/create.spec.js b/tests/spec/create.spec.js
index f12b717..dbb04f8 100644
--- a/tests/spec/create.spec.js
+++ b/tests/spec/create.spec.js
@@ -17,20 +17,20 @@
under the License.
*/
-var shell = require('shelljs'),
- spec = __dirname,
- path = require('path'),
- util = require('util');
+var shell = require('shelljs');
+var spec = __dirname;
+var path = require('path');
+var util = require('util');
- var cordova_bin = path.join(spec, '../..', 'bin');
- var tmp = require('tmp').dirSync().name;
+var cordova_bin = path.join(spec, '../..', 'bin');
+var tmp = require('tmp').dirSync().name;
-function createAndBuild(projectname, projectid) {
+function createAndBuild (projectname, projectid) {
var return_code = 0;
var command;
// remove existing folder
- command = path.join(tmp, projectname);
+ command = path.join(tmp, projectname);
shell.rm('-rf', command);
// create the project
@@ -46,66 +46,65 @@ function createAndBuild(projectname, projectid) {
expect(return_code).toBe(0);
// clean-up
- command = path.join(tmp, projectname);
+ command = path.join(tmp, projectname);
shell.rm('-rf', command);
}
+describe('create', function () {
-describe('create', function() {
-
- it('Test#001 : create project with ascii name, no spaces', function() {
+ it('Test#001 : create project with ascii name, no spaces', function () {
var projectname = 'testcreate';
var projectid = 'com.test.app1';
createAndBuild(projectname, projectid);
});
- it('Test#002 : create project with ascii name, and spaces', function() {
+ it('Test#002 : create project with ascii name, and spaces', function () {
var projectname = 'test create';
var projectid = 'com.test.app2';
createAndBuild(projectname, projectid);
});
- it('Test#003 : create project with unicode name, no spaces', function() {
+ it('Test#003 : create project with unicode name, no spaces', function () {
var projectname = '応応応応用用用用';
var projectid = 'com.test.app3';
createAndBuild(projectname, projectid);
});
- it('Test#004 : create project with unicode name 2, no spaces', function() {
+ it('Test#004 : create project with unicode name 2, no spaces', function () {
var projectname = 'إثرا';
var projectid = 'com.test.app3.2';
createAndBuild(projectname, projectid);
});
- it('Test#005 : create project with unicode name, and spaces', function() {
+ it('Test#005 : create project with unicode name, and spaces', function () {
var projectname = '応応応応 用用用用';
var projectid = 'com.test.app4';
createAndBuild(projectname, projectid);
});
- it('Test#006 : create project with ascii+unicode name, no spaces', function() {
+ it('Test#006 : create project with ascii+unicode name, no spaces', function () {
var projectname = '応応応応hello用用用用';
var projectid = 'com.test.app5';
createAndBuild(projectname, projectid);
});
- it('Test#007 : create project with ascii+unicode name, and spaces', function() {
+ it('Test#007 : create project with ascii+unicode name, and spaces', function () {
var projectname = '応応応応 hello 用用用用';
var projectid = 'com.test.app6';
createAndBuild(projectname, projectid);
});
- it('Test#008 : create project with ascii name, and spaces, ampersand(&)', function() {
- var projectname = 'hello & world';
- var projectid = 'com.test.app7';
+ it('Test#008 : create project with ascii name, and spaces, ampersand(&)', function () {
+ var projectname = 'hello & world';
+ var projectid = 'com.test.app7';
- createAndBuild(projectname, projectid);
+ createAndBuild(projectname, projectid);
});
});
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org