chore(project): merge db-server project admin/config stuff to top level

This commit is contained in:
Phil Booth 2015-08-04 15:41:07 +01:00
Родитель 2540f41313
Коммит b17f477972
27 изменённых файлов: 54 добавлений и 406 удалений

Просмотреть файл

Просмотреть файл

@ -1,18 +0,0 @@
{
"asi": true,
"eqeqeq": true,
"esnext": true,
"forin": false,
"maxerr": 100,
"noarg": true,
"node": true,
"predef": [
"exports",
"process",
"require"
],
"shadow": false,
"strict": false,
"undef": true,
"unused": "vars"
}

Просмотреть файл

Просмотреть файл

Просмотреть файл

Просмотреть файл

@ -17,8 +17,8 @@ you saw the issue.
Patches should be submitted as pull requests (PR).
Before submitting a PR:
- Your code must run and pass all the automated tests before you submit your PR for review. "Work in progress" pull requests are allowed to be submitted, but should be clearly labeled as such and should not be merged until all tests pass and the code has been reviewed.
- Run `grunt jshint` to make sure your code passes linting.
- Your code must run and pass all the automated tests before you submit your PR for review. "Work in progress" pull requests are allowed to be submitted, but should be clearly labeled as such and should not be merged until all tests pass and the code has been reviewed.
- Run `grunt eslint` to make sure your code passes linting.
- Run `npm test` to make sure all tests still pass.
- Your patch should include new tests that cover your changes. It is your and your reviewer's responsibility to ensure your patch includes adequate tests.
@ -26,7 +26,7 @@ When submitting a PR:
- You agree to license your code under the project's open source license ([MPL 2.0](/LICENSE)).
- Base your branch off the current `master` (see below for an example workflow).
- Add both your code and new tests if relevant.
- Run `grunt jshint` and `npm test` to make sure your code passes linting and tests.
- Run `grunt eslint` and `npm test` to make sure your code passes linting and tests.
- Please do not include merge commits in pull requests; include only commits with the new relevant code.
After your PR is merged:
@ -36,7 +36,7 @@ See the main [README.md](/README.md) for information on prerequisites, installin
## Code Review ##
This project is production Mozilla code and subject to our [engineering practices and quality standards](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Committing_Rules_and_Responsibilities). Every patch must be peer reviewed. This project is part of the [Firefox Accounts module](https://wiki.mozilla.org/Modules/Other#Firefox_Accounts), and your patch must be reviewed by one of the listed module owners or peers.
This project is production Mozilla code and subject to our [engineering practices and quality standards](https://developer.mozilla.org/en-US/docs/Mozilla/Developer_guide/Committing_Rules_and_Responsibilities). Every patch must be peer reviewed. This project is part of the [Firefox Accounts module](https://wiki.mozilla.org/Modules/Other#Firefox_Accounts), and your patch must be reviewed by one of the listed module owners or peers.
## Example Workflow ##

Просмотреть файл

@ -7,5 +7,5 @@ module.exports = function (grunt) {
grunt.loadTasks('grunttasks');
grunt.registerTask('default', ['jshint', 'copyright']);
grunt.registerTask('default', ['eslint', 'copyright']);
};

Просмотреть файл

@ -1,12 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt)
grunt.loadTasks('grunttasks')
grunt.registerTask('default', ['eslint', 'copyright'])
}

Просмотреть файл

@ -1,26 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
// takes care of bumping the version number in package.json
module.exports = function (grunt) {
'use strict'
grunt.config('bump', {
options: {
files: ['package.json'],
bumpVersion: true,
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json', 'CHANGELOG'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
push: false,
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abrev=1 --dirty=-d'
}
})
}

Просмотреть файл

@ -1,26 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
module.exports = function (grunt) {
'use strict'
grunt.config('copyright', {
app: {
src: [
'{,lib/,scripts/}*.js'
],
options: {
pattern: 'This Source Code Form is subject to the terms of the Mozilla Public'
}
},
tests: {
src: [
'test/{local,backend}/*.js'
],
options: {
pattern: 'Any copyright is dedicated to the Public Domain.'
}
}
})
}

Просмотреть файл

@ -1,31 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//
// A task to stamp a new version.
//
// Before running this task you should update CHANGELOG with the
// changes for this release. Protip: you only need to make changes
// to CHANGELOG; this task will add and commit for you.
//
// * version is updated in package.json
// * git tag with version name is created.
// * git commit with updated package.json created.
//
// NOTE: This task will not push this commit for you.
//
module.exports = function (grunt) {
'use strict'
grunt.registerTask('version', [
'bump-only:minor',
'bump-commit'
])
grunt.registerTask('version:patch', [
'bump-only:patch',
'bump-commit'
])
}

Просмотреть файл

@ -3,10 +3,6 @@
"version": "0.42.0",
"description": "Firefox Accounts DB Server",
"main": "index.js",
"scripts": {
"test": "grunt && ./scripts/tap-coverage.js test/local",
"outdated": "npm outdated --depth 0"
},
"repository": {
"type": "git",
"url": "https://github.com/mozilla/fxa-auth-db-server"
@ -20,17 +16,6 @@
"dependencies": {
"restify": "2.8.2"
},
"devDependencies": {
"ass": "git://github.com/jrgm/ass.git#5be99ee",
"bluebird": "1.2.2",
"eslint-config-fxa": "1.2.0",
"grunt": "0.4.5",
"grunt-bump": "0.3.0",
"grunt-copyright": "0.2.0",
"grunt-eslint": "14.0.0",
"load-grunt-tasks": "0.6.0",
"tap": "0.4.12"
},
"keywords": [],
"engines": {
"node": "0.10.x"

Просмотреть файл

@ -1,38 +0,0 @@
#!/usr/bin/env node
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
if (!process.env.NO_COVERAGE) {
var ass = require('ass').enable( {
// exclude files in /client/ and /test/ from code coverage
exclude: [ '/client/', '/test' ]
})
}
var path = require('path'),
spawn = require('child_process').spawn,
fs = require('fs')
var p = spawn(path.join(path.dirname(__dirname), 'node_modules', '.bin', 'tap'),
process.argv.slice(2), { stdio: 'inherit' })
p.on('close', function(code) {
if (!process.env.NO_COVERAGE) {
ass.report('json', function(err, r) {
console.log('code coverage:', r.percent + '%')
process.stdout.write('generating coverage.html: ')
var start = new Date()
ass.report('html', function(err, html) {
fs.writeFileSync(path.join(path.dirname(__dirname), 'coverage.html'),
html)
process.stdout.write('complete in ' +
((new Date() - start) / 1000.0).toFixed(1) + 's\n')
process.exit(code)
})
})
} else {
process.exit(code)
}
})

Просмотреть файл

@ -5,7 +5,7 @@
// takes care of bumping the version number in package.json
module.exports = function (grunt) {
'use strict';
'use strict'
grunt.config('bump', {
options: {
@ -13,7 +13,7 @@ module.exports = function (grunt) {
bumpVersion: true,
commit: true,
commitMessage: 'Release v%VERSION%',
commitFiles: ['package.json', 'npm-shrinkwrap.json', 'CHANGELOG'],
commitFiles: ['package.json', 'npm-shrinkwrap.json', 'CHANGELOG-db.md', 'CHANGELOG-server.md'],
createTag: true,
tagName: 'v%VERSION%',
tagMessage: 'Version %VERSION%',
@ -21,6 +21,6 @@ module.exports = function (grunt) {
pushTo: 'origin',
gitDescribeOptions: '--tags --always --abrev=1 --dirty=-d'
}
});
};
})
}

Просмотреть файл

@ -3,12 +3,12 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
module.exports = function (grunt) {
'use strict';
'use strict'
grunt.config('copyright', {
app: {
src: [
'{,bin/,config/,db/,scripts/}*.js'
'{bin,config,fxa-auth-db-server/lib,lib,lib/db,scripts}/*.js'
],
options: {
pattern: 'This Source Code Form is subject to the terms of the Mozilla Public'
@ -16,7 +16,8 @@ module.exports = function (grunt) {
},
tests: {
src: [
'test/{remote,local,backend}/*.js'
'test/{remote,local,backend}/*.js',
'fxa-auth-db-server/test/{backend,local}/*.js'
],
options: {
pattern: 'Any copyright is dedicated to the Public Domain.'

Просмотреть файл

@ -10,7 +10,11 @@ module.exports = function (grunt) {
eslintrc: '.eslintrc'
},
files: [
'{,grunttasks/,lib/,scripts/,test/,test/backend/,test/local/}*.js'
'index.js',
'{grunttasks,lib,lib/db,scripts,test}/*.js',
'fxa-auth-db-server/index.js',
'fxa-auth-db-server/{lib,test,test/backend,test/local}/*.js',
'test/{backend,local,mem}/*.js'
]
})

Просмотреть файл

@ -1,16 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
module.exports = function (grunt) {
'use strict';
grunt.config('jshint', {
files: [
'{,bin/,config/,db/,scripts/,test/**/}*.js'
],
options: {
jshintrc: '.jshintrc'
}
})
}

Просмотреть файл

@ -17,15 +17,15 @@
//
module.exports = function (grunt) {
'use strict';
'use strict'
grunt.registerTask('version', [
'bump-only:minor',
'bump-commit'
]);
])
grunt.registerTask('version:patch', [
'bump-only:patch',
'bump-commit'
]);
};
])
}

Просмотреть файл

@ -67,7 +67,7 @@ module.exports = function (log, error) {
)
var pruneIn = options.pruneEvery / 2 + Math.floor(Math.random() * options.pruneEvery)
setTimeout(prune.bind(this), pruneIn).unref();
setTimeout(prune.bind(this), pruneIn).unref()
}
// start the pruning off, but only if enabled in config
if ( options.enablePruning ) {
@ -521,7 +521,7 @@ module.exports = function (log, error) {
var GET_UNLOCK_CODE = 'call unlockCode_1(?)'
MySql.prototype.unlockCode = function (uid) {
return this.readFirstResult(GET_UNLOCK_CODE, [uid]);
return this.readFirstResult(GET_UNLOCK_CODE, [uid])
}
// Internal

177
npm-shrinkwrap.json сгенерированный
Просмотреть файл

@ -1064,183 +1064,6 @@
}
}
},
"grunt-contrib-jshint": {
"version": "0.10.0",
"from": "grunt-contrib-jshint@0.10.0",
"resolved": "https://registry.npmjs.org/grunt-contrib-jshint/-/grunt-contrib-jshint-0.10.0.tgz",
"dependencies": {
"jshint": {
"version": "2.5.11",
"from": "jshint@>=2.5.0 <2.6.0",
"resolved": "https://registry.npmjs.org/jshint/-/jshint-2.5.11.tgz",
"dependencies": {
"cli": {
"version": "0.6.6",
"from": "cli@>=0.6.0 <0.7.0",
"resolved": "https://registry.npmjs.org/cli/-/cli-0.6.6.tgz",
"dependencies": {
"glob": {
"version": "3.2.11",
"from": "glob@>=3.2.1 <3.3.0",
"resolved": "https://registry.npmjs.org/glob/-/glob-3.2.11.tgz",
"dependencies": {
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
},
"minimatch": {
"version": "0.3.0",
"from": "minimatch@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-0.3.0.tgz",
"dependencies": {
"lru-cache": {
"version": "2.6.5",
"from": "lru-cache@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.5.tgz"
},
"sigmund": {
"version": "1.0.1",
"from": "sigmund@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz"
}
}
}
}
}
}
},
"console-browserify": {
"version": "1.1.0",
"from": "console-browserify@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/console-browserify/-/console-browserify-1.1.0.tgz",
"dependencies": {
"date-now": {
"version": "0.1.4",
"from": "date-now@>=0.1.4 <0.2.0",
"resolved": "https://registry.npmjs.org/date-now/-/date-now-0.1.4.tgz"
}
}
},
"exit": {
"version": "0.1.2",
"from": "exit@>=0.1.1 <0.2.0",
"resolved": "https://registry.npmjs.org/exit/-/exit-0.1.2.tgz"
},
"htmlparser2": {
"version": "3.8.3",
"from": "htmlparser2@>=3.8.0 <3.9.0",
"resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-3.8.3.tgz",
"dependencies": {
"domhandler": {
"version": "2.3.0",
"from": "domhandler@>=2.3.0 <2.4.0",
"resolved": "https://registry.npmjs.org/domhandler/-/domhandler-2.3.0.tgz"
},
"domutils": {
"version": "1.5.1",
"from": "domutils@>=1.5.0 <1.6.0",
"resolved": "https://registry.npmjs.org/domutils/-/domutils-1.5.1.tgz",
"dependencies": {
"dom-serializer": {
"version": "0.1.0",
"from": "dom-serializer@>=0.0.0 <1.0.0",
"resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-0.1.0.tgz",
"dependencies": {
"domelementtype": {
"version": "1.1.3",
"from": "domelementtype@>=1.1.1 <1.2.0",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.1.3.tgz"
},
"entities": {
"version": "1.1.1",
"from": "entities@>=1.1.1 <1.2.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.1.1.tgz"
}
}
}
}
},
"domelementtype": {
"version": "1.3.0",
"from": "domelementtype@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/domelementtype/-/domelementtype-1.3.0.tgz"
},
"readable-stream": {
"version": "1.1.13",
"from": "readable-stream@>=1.1.0 <1.2.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.1.13.tgz",
"dependencies": {
"core-util-is": {
"version": "1.0.1",
"from": "core-util-is@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.1.tgz"
},
"isarray": {
"version": "0.0.1",
"from": "isarray@0.0.1",
"resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz"
},
"string_decoder": {
"version": "0.10.31",
"from": "string_decoder@>=0.10.0 <0.11.0",
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-0.10.31.tgz"
},
"inherits": {
"version": "2.0.1",
"from": "inherits@>=2.0.1 <2.1.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
},
"entities": {
"version": "1.0.0",
"from": "entities@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/entities/-/entities-1.0.0.tgz"
}
}
},
"minimatch": {
"version": "1.0.0",
"from": "minimatch@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-1.0.0.tgz",
"dependencies": {
"lru-cache": {
"version": "2.6.5",
"from": "lru-cache@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-2.6.5.tgz"
},
"sigmund": {
"version": "1.0.1",
"from": "sigmund@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/sigmund/-/sigmund-1.0.1.tgz"
}
}
},
"shelljs": {
"version": "0.3.0",
"from": "shelljs@>=0.3.0 <0.4.0",
"resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.3.0.tgz"
},
"strip-json-comments": {
"version": "1.0.2",
"from": "strip-json-comments@>=1.0.0 <1.1.0",
"resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-1.0.2.tgz"
},
"underscore": {
"version": "1.6.0",
"from": "underscore@>=1.6.0 <1.7.0",
"resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz"
}
}
},
"hooker": {
"version": "0.2.3",
"from": "hooker@>=0.2.3 <0.3.0",
"resolved": "https://registry.npmjs.org/hooker/-/hooker-0.2.3.tgz"
}
}
},
"grunt-copyright": {
"version": "0.2.0",
"from": "grunt-copyright@0.2.0",

Просмотреть файл

@ -11,9 +11,10 @@
"fxa-auth-db-mysql": "bin/db_patcher.js"
},
"scripts": {
"test": "npm run test-mysql && npm run test-mem",
"test-mysql": "grunt && node ./bin/db_patcher.js >/dev/null && ./scripts/tap-coverage.js test/backend test/local",
"test": "npm run test-mysql && npm run test-mem && npm run test-server",
"test-mysql": "grunt && node ./bin/db_patcher.js >/dev/null && ./scripts/tap-coverage.js test/backend test/local",
"test-mem": "./scripts/tap-coverage.js test/mem",
"test-server": "./scripts/tap-coverage.js fxa-auth-db-server/test/local",
"start": "node ./bin/db_patcher.js >/dev/null && node ./bin/server.js",
"start-mem": "node ./bin/mem",
"outdated": "npm outdated --depth 0"
@ -36,10 +37,11 @@
},
"devDependencies": {
"ass": "git://github.com/jrgm/ass.git#5be99ee",
"eslint-config-fxa": "1.2.0",
"grunt": "0.4.5",
"grunt-bump": "0.3.0",
"grunt-contrib-jshint": "0.10.0",
"grunt-copyright": "0.2.0",
"grunt-eslint": "14.0.0",
"grunt-nsp-shrinkwrap": "0.0.3",
"load-grunt-tasks": "0.6.0",
"mysql-patcher": "0.7.0",

Просмотреть файл

@ -8,31 +8,31 @@ if (!process.env.NO_COVERAGE) {
var ass = require('ass').enable( {
// exclude files in /client/ and /test/ from code coverage
exclude: [ '/client/', '/test' ]
});
})
}
var path = require('path'),
spawn = require('child_process').spawn,
fs = require('fs');
fs = require('fs')
var p = spawn(path.join(path.dirname(__dirname), 'node_modules', '.bin', 'tap'),
process.argv.slice(2), { stdio: 'inherit' });
process.argv.slice(2), { stdio: 'inherit' })
p.on('close', function(code) {
if (!process.env.NO_COVERAGE) {
ass.report('json', function(err, r) {
console.log('code coverage:', r.percent + '%');
process.stdout.write('generating coverage.html: ');
var start = new Date();
console.log('code coverage:', r.percent + '%')
process.stdout.write('generating coverage.html: ')
var start = new Date()
ass.report('html', function(err, html) {
fs.writeFileSync(path.join(path.dirname(__dirname), 'coverage.html'),
html);
html)
process.stdout.write('complete in ' +
((new Date() - start) / 1000.0).toFixed(1) + 's\n');
process.exit(code);
});
});
((new Date() - start) / 1000.0).toFixed(1) + 's\n')
process.exit(code)
})
})
} else {
process.exit(code);
process.exit(code)
}
});
})

Просмотреть файл

@ -18,7 +18,7 @@ DB.connect(config)
test(
'processUnpublishedEvents guards for callback not returning promise',
function (t) {
t.plan(2);
t.plan(2)
return db.processUnpublishedEvents(function (events) {
t.ok(true, 'The db.processUnpublishedEvents callback was called')
// ... but the callback itself returns nothing
@ -33,7 +33,7 @@ DB.connect(config)
test(
'account activity should generate event logs',
function (t) {
t.plan(14);
t.plan(14)
var user = fake.newUserDataBuffer()
var verifiedUser = fake.newUserDataBuffer()
verifiedUser.account.emailVerified = true

Просмотреть файл

@ -30,7 +30,7 @@ DB.connect(config)
test(
'db/mysql logs stats periodically',
function (t) {
t.plan(4);
t.plan(4)
return dfd.promise
.then(
function(stats) {

Просмотреть файл

@ -16,7 +16,7 @@ DB.connect(config)
test(
'ping',
function (t) {
t.plan(1);
t.plan(1)
return db.ping()
.then(function(account) {
t.pass('Got the ping ok')
@ -205,15 +205,15 @@ DB.connect(config)
var possibleErrors = [
{ msg: 'ER_BAD_NULL_ERROR', errno: 1048 },
{ msg: 'ER_NO_DEFAULT_FOR_FIELD', errno: 1364 }
];
var matchedError = false;
]
var matchedError = false
possibleErrors.forEach(function(possibleErr) {
if (err.message === possibleErr.msg) {
if (err.errno === possibleErr.errno ) {
matchedError = true;
matchedError = true
}
}
});
})
t.ok(matchedError, 'error message and errno are correct')
t.end()
})

Просмотреть файл

@ -18,7 +18,7 @@ DB.connect(config)
test(
'ping',
function (t) {
t.plan(1);
t.plan(1)
return db.ping()
.then(function(account) {
t.pass('Got the ping ok')
@ -31,7 +31,7 @@ DB.connect(config)
test(
'prune tokens',
function (t) {
t.plan(9);
t.plan(9)
var user = fake.newUserDataBuffer()
return db.createAccount(user.accountId, user.account)
.then(function() {
@ -52,7 +52,7 @@ DB.connect(config)
})
.then(function() {
// set pruneLastRun to be zero, so we know it will run
var sql = "UPDATE dbMetadata SET value = '0' WHERE name = 'prune-last-ran'"
var sql = 'UPDATE dbMetadata SET value = \'0\' WHERE name = \'prune-last-ran\''
return db.write(sql, [])
})
.then(function() {

Просмотреть файл

@ -29,7 +29,7 @@
*/
// support code coverage
require('ass');
require('ass')
var tap = require('tap')