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.
This commit is contained in:
parent
93e3a48004
commit
b38dea0597
25901 changed files with 9982925 additions and 369 deletions
32
gaia/tests/jsmarionette/runner/mozilla-profile-builder/lib/options/prefs.js
Executable file
32
gaia/tests/jsmarionette/runner/mozilla-profile-builder/lib/options/prefs.js
Executable file
|
|
@ -0,0 +1,32 @@
|
|||
'use strict';
|
||||
var fs = require('fs'),
|
||||
fsPath = require('path'),
|
||||
pref = require('../pref');
|
||||
|
||||
var USER_PREF = 'user.js';
|
||||
/**
|
||||
* Appends prefs to the given profile.
|
||||
*
|
||||
* Options:
|
||||
* - (Object) prefs: key/value pairs.
|
||||
*
|
||||
* @param {String} profile path to profile.
|
||||
* @param {Object} options for prefs.
|
||||
* @param {Function} callback fires after successfully saving.
|
||||
*/
|
||||
function appendPrefs(profile, options, callback) {
|
||||
// we userPrefs was used in the past
|
||||
var prefsConfig = options.prefs || options.userPrefs;
|
||||
// don't do anything unless there are some new prefs
|
||||
if (!prefsConfig || Object.keys(prefsConfig).length === 0) {
|
||||
return process.nextTick(callback.bind(null, null, profile));
|
||||
}
|
||||
|
||||
var filename = fsPath.join(profile, USER_PREF);
|
||||
fs.appendFile(filename, '\n' + pref(prefsConfig), function(err) {
|
||||
if (err) return callback(err);
|
||||
callback(null, profile);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = appendPrefs;
|
||||
Loading…
Reference in a new issue