chore(package): update all dependencies

This commit is contained in:
Julien Fontanet 2016-06-29 11:31:29 +02:00
parent ab1f08f687
commit ab3a594884
8 changed files with 51 additions and 75 deletions

View File

@ -1,11 +0,0 @@
{
"comments": false,
"compact": true,
"optional": [
"es7.asyncFunctions",
"es7.decorators",
"es7.exportExtensions",
"es7.functionBind",
"runtime"
]
}

View File

@ -1,9 +1,6 @@
/.nyc_output/
/bower_components/
/dist/
/node_modules/
npm-debug.log
npm-debug.log.*
!node_modules/*
node_modules/*/

View File

@ -1,5 +0,0 @@
Error.stackTraceLimit = 100
try { require('trace') } catch (_) {}
try { require('clarify') } catch (_) {}
try { require('source-map-support/register') } catch (_) {}

View File

@ -1 +0,0 @@
--require ./.mocha.js

View File

@ -3,7 +3,6 @@ node_js:
- 'stable'
- '4'
- '0.12'
- '0.10'
# Use containers.
# http://docs.travis-ci.com/user/workers/container-based-infrastructure/

View File

@ -6,25 +6,16 @@ XO-Server plugin which sends email reports and Xmpp messages when backup jobs ar
## Install
Go inside your `xo-server` folder and install it:
Installation of the [npm package](https://npmjs.org/package/xo-server-backup-reports):
```
> npm install xo-server-backup-reports
> npm install --global xo-server-backup-reports
```
## Usage
### Prerequisite
You must have the [xo-server-transport-email](https://github.com/vatesfr/xo-server-transport-email) plugin enabled to use xo-server-backup-reports or/and the [xo-server-transport-xmpp](https://github.com/vatesfr/xo-server-transport-xmpp) plugin.
### Add the plugin to XO-Server config
```yaml
plugins:
xo-server-backup-reports:
```
Like all other xo-server plugins, it can be configured directly via
the web iterface, see [the plugin documentation](https://xen-orchestra.com/docs/plugins.html).
## Development

View File

@ -26,37 +26,45 @@
"files": [
"dist/"
],
"engines": {
"node": ">=0.12"
},
"dependencies": {
"babel-runtime": "^5.8.34",
"lodash.foreach": "^3.0.3",
"moment": "^2.10.6"
"lodash": "^4.13.1",
"moment": "^2.13.0"
},
"devDependencies": {
"babel": "^5.8.34",
"babel-eslint": "^4.1.5",
"clarify": "^1.0.5",
"babel-cli": "^6.10.1",
"babel-eslint": "^6.1.0",
"babel-preset-es2015": "^6.9.0",
"babel-preset-stage-0": "^6.5.0",
"dependency-check": "^2.5.1",
"mocha": "^2.3.4",
"must": "^0.13.1",
"nyc": "^3.2.2",
"source-map-support": "^0.3.3",
"standard": "^5.4.1",
"trace": "^2.0.1"
"ghooks": "^1.2.4",
"standard": "^7.1.2"
},
"scripts": {
"build": "babel --source-maps --out-dir=dist/ src/",
"dev": "babel --watch --source-maps --out-dir=dist/ src/",
"dev-test": "mocha --opts .mocha.opts --watch --reporter=min \"dist/**/*.spec.js\"",
"lint": "standard",
"build": "NODE_ENV=production babel --source-maps --out-dir=dist/ src/",
"depcheck": "dependency-check ./package.json",
"dev": "babel --watch --source-maps --out-dir=dist/ src/",
"lint": "standard",
"posttest": "npm run lint && npm run depcheck",
"prepublish": "npm run build",
"test": "nyc mocha --opts .mocha.opts \"dist/**/*.spec.js\""
"prepublish": "npm run build"
},
"babel": {
"presets": [
"stage-0",
"es2015"
]
},
"standard": {
"ignore": [
"dist/**"
"dist"
],
"parser": "babel-eslint"
},
"config": {
"ghooks": {
"commit-msg": "npm test"
}
}
}

View File

@ -1,4 +1,4 @@
import forEach from 'lodash.foreach'
import forEach from 'lodash/forEach'
import moment from 'moment'
export const configurationSchema = {
@ -30,6 +30,10 @@ export const configurationSchema = {
// ===================================================================
const logError = e => {
console.error('backup report error:', e)
}
class BackupReportsXoPlugin {
constructor (xo) {
this._xo = xo
@ -49,15 +53,11 @@ class BackupReportsXoPlugin {
this._xo.removeListener('job:terminated', this._report)
}
async _wrapper (status) {
try {
await this._listener(status)
} catch (e) {
console.error('backup report error: ' + e)
}
_wrapper (status) {
return new Promise(resolve => resolve(this._listener(status))).catch(logError)
}
async _listener (status) {
_listener (status) {
let nSuccess = 0
let nCalls = 0
let reportWhen
@ -116,7 +116,7 @@ class BackupReportsXoPlugin {
return
}
const globalStatus = nSuccess === nCalls ? 'Success' : 'Fail'
const globalSuccess = nSuccess === nCalls
const start = moment(status.start)
const end = moment(status.end)
const duration = moment.duration(end - start).humanize()
@ -125,13 +125,13 @@ class BackupReportsXoPlugin {
.replace(/([A-Z])/g, ' $1').replace(/^./, letter => letter.toUpperCase()) // humanize
const tag = status.calls[Object.keys(status.calls)[0]].params.tag
if (reportWhen === 'fail' && globalStatus === 'Success') {
if (globalSuccess && reportWhen === 'fail') {
return
}
// Global status.
text.unshift([
`## Global status for "${tag}" (${method}): ${globalStatus}`,
`## Global status for "${tag}" (${method}): ${globalSuccess ? 'Success' : 'Fail'}`,
` - Start time: ${String(start)}`,
` - End time: ${String(end)}`,
` - Duration: ${duration}`,
@ -143,23 +143,21 @@ class BackupReportsXoPlugin {
// TODO : Handle errors when `sendEmail` isn't present. (Plugin dependencies)
if (this._xo.sendEmail) {
await this._xo.sendEmail({
const xo = this._xo
return Promise.all([
xo.sendEmail && xo.sendEmail({
to: this._mailsReceivers,
subject: `Backup Reports for "${tag}" (XenOrchestra)`,
subject: `Backup Reports for "${tag}" (Xen Orchestra)`,
markdown
})
}
if (this._xo.sendToXmppClient) {
this._xo.sendToXmppClient({
}),
xo.sendToXmppClient && xo.sendToXmppClient({
to: this._xmppReceivers,
message: markdown
})
}
])
}
}
// ===================================================================
export default ({xo}) => new BackupReportsXoPlugin(xo)
export default ({ xo }) => new BackupReportsXoPlugin(xo)