Publish Vulpes Preview 15 sources for desktop, Android and Tundra
Share Gaia assets and adapters, keep private profiles and development documents local, and update both public READMEs.
61
gaia/apps/search/build/build.js
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
'use strict';
|
||||
|
||||
/* jshint node: true */
|
||||
|
||||
var utils = require('utils');
|
||||
|
||||
var SearchAppBuilder = function() {
|
||||
};
|
||||
|
||||
function pickAsset(root, filename, ppx) {
|
||||
if (ppx !== '1') {
|
||||
var suffix = '@' + ppx + 'x';
|
||||
var hdpiFile = filename.replace(/(\.[a-z]+$)/, suffix + '$1');
|
||||
var file = utils.getFile(root.path, hdpiFile);
|
||||
if (file.exists()) {
|
||||
return file;
|
||||
}
|
||||
}
|
||||
return utils.getFile(root.path, filename);
|
||||
}
|
||||
|
||||
SearchAppBuilder.prototype.setOptions = function(options) {
|
||||
this.stageDir = utils.getFile(options.STAGE_APP_DIR);
|
||||
this.appDir = utils.getFile(options.APP_DIR);
|
||||
this.buildDir = utils.getFile(this.appDir.path, '/build');
|
||||
this.distDirPath = options.GAIA_DISTRIBUTION_DIR;
|
||||
};
|
||||
|
||||
SearchAppBuilder.prototype.initTopsitesJSON = function() {
|
||||
var defaultJSONpath =
|
||||
utils.joinPath(this.appDir.path, 'build', 'topsites.json');
|
||||
var defaultJson = utils.getJSON(utils.getFile(defaultJSONpath));
|
||||
|
||||
defaultJson.forEach(function(site) {
|
||||
if (site.tilePath) {
|
||||
var file = pickAsset(this.buildDir, site.tilePath,
|
||||
this.options.GAIA_DEV_PIXELS_PER_PX);
|
||||
var icon = utils.getFileAsDataURI(file);
|
||||
site.tile = icon;
|
||||
delete site.tilePath;
|
||||
}
|
||||
}.bind(this));
|
||||
|
||||
var file = utils.getFile(this.stageDir.path, 'js', 'inittopsites.json');
|
||||
var fileContents = utils.getDistributionFileContent('topsites', defaultJson,
|
||||
this.distDirPath);
|
||||
utils.writeContent(file, fileContents);
|
||||
};
|
||||
|
||||
SearchAppBuilder.prototype.execute = function(options) {
|
||||
this.options = options;
|
||||
this.setOptions(options);
|
||||
if (options.PROFILE_FOLDER !== 'profile-test') {
|
||||
this.initTopsitesJSON();
|
||||
}
|
||||
};
|
||||
|
||||
exports.execute = function(options) {
|
||||
utils.copyToStage(options);
|
||||
(new SearchAppBuilder()).execute(options);
|
||||
};
|
||||
BIN
gaia/apps/search/build/mozilla.org.jpg
Executable file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
gaia/apps/search/build/mozilla.org@1.5x.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
gaia/apps/search/build/mozilla.org@2.25x.jpg
Executable file
|
After Width: | Height: | Size: 18 KiB |
BIN
gaia/apps/search/build/mozilla.org@2x.jpg
Executable file
|
After Width: | Height: | Size: 16 KiB |
BIN
gaia/apps/search/build/mozillasupport.jpg
Executable file
|
After Width: | Height: | Size: 6.9 KiB |
BIN
gaia/apps/search/build/mozillasupport@1.5x.jpg
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
gaia/apps/search/build/mozillasupport@2.25x.jpg
Executable file
|
After Width: | Height: | Size: 16 KiB |
BIN
gaia/apps/search/build/mozillasupport@2x.jpg
Executable file
|
After Width: | Height: | Size: 17 KiB |
14
gaia/apps/search/build/topsites.json
Executable file
|
|
@ -0,0 +1,14 @@
|
|||
[
|
||||
{
|
||||
"title": "Mozilla",
|
||||
"url": "https://mozilla.org",
|
||||
"frecency": 0,
|
||||
"tilePath": "mozilla.org.jpg"
|
||||
},
|
||||
{
|
||||
"title": "Mozilla Support",
|
||||
"url": "https://support.mozilla.org",
|
||||
"frecency": 0,
|
||||
"tilePath": "mozillasupport.jpg"
|
||||
}
|
||||
]
|
||||