Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #16074 from timdream/build-appdata-wappush
Browse files Browse the repository at this point in the history
Bug 968703 - Migrate code snippet for wapppush customization, r=yurenju
  • Loading branch information
timdream committed Feb 7, 2014
2 parents 427b1ed + 80f5820 commit 4003a9e
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 8 deletions.
2 changes: 1 addition & 1 deletion apps/wappush/.gitignore
@@ -1 +1 @@
js/whitelist.json
/js/whitelist.json
6 changes: 6 additions & 0 deletions apps/wappush/Makefile
@@ -0,0 +1,6 @@
-include $(PWD)/build/common.mk

.PHONY: build
build:
@echo 'Building wappush app...'
@$(call run-app-js-command, build)
18 changes: 18 additions & 0 deletions apps/wappush/build/build.js
@@ -0,0 +1,18 @@
'use strict';

/* global require, exports */

var utils = require('utils');

function execute(config) {
var distDir = config.GAIA_DISTRIBUTION_DIR;

var file = utils.getFile(config.GAIA_DIR,
'apps', 'wappush', 'js', 'whitelist.json');
var defaultContent = [];
var content = utils.getDistributionFileContent('wappush-whitelist',
defaultContent, distDir);
utils.writeContent(file, content);
}

exports.execute = execute;
7 changes: 0 additions & 7 deletions build/applications-data.js
Expand Up @@ -405,13 +405,6 @@ function execute(options) {
utils.writeContent(init,
utils.getDistributionFileContent('wapuaprof.json', content, distDir));

// WAP Push
init = utils.getFile(config.GAIA_DIR, 'apps', 'wappush', 'js', 'whitelist.json');
content = [];

utils.writeContent(init,
utils.getDistributionFileContent('wappush-whitelist', content));

// Communications config
init = utils.getFile(config.GAIA_DIR,
'apps', 'communications', 'contacts', 'config.json');
Expand Down
13 changes: 13 additions & 0 deletions build/test/integration/distribution.test.js
Expand Up @@ -35,6 +35,18 @@ suite('Distribution mechanism', function() {
'Local', 'Property providerType should equal "Local"')
}

function validateWappush() {
var wappushZip = new AdmZip(path.join(process.cwd(), 'profile',
'webapps', 'wappush.gaiamobile.org', 'application.zip'));
var whitelist =
wappushZip.readAsText(wappushZip.getEntry('js/whitelist.json'));
assert.isNotNull(whitelist, 'js/whitelist.json should exist');
var list = JSON.parse(whitelist);
assert.isDefined(list[0], 'whitelist[0] should be defined');
assert.equal(list[0], '9871010079',
'whitelist[0] should equal "9871010079"');
}

test('build with GAIA_DISTRIBUTION_DIR', function(done) {
var distDir = path.join(process.cwd(), 'build', 'test', 'resources',
'distribution_test');
Expand All @@ -43,6 +55,7 @@ suite('Distribution mechanism', function() {
helper.checkError(error, stdout, stderr);
validateSettings();
validateCalendar();
validateWappush();
done();
});
});
Expand Down
@@ -0,0 +1 @@
["9871010079"]

0 comments on commit 4003a9e

Please sign in to comment.