-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #17 from dbradf/v2
Version 2
- Loading branch information
Showing
19 changed files
with
1,412 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# Contributing | ||
|
||
When contributing to this repository, please first discuss the change you wish to make via github issues before making the change. | ||
|
||
Please note we have a code of conduct, please follow it in all your interactions with the project. | ||
|
||
## Pull Request Process | ||
|
||
* Update the README.md with details of changes to the interface. | ||
* Ensure the travis build is passing for the given change (npm test). | ||
* Increase the version numbers in any examples files and the README.md to the new version that this pull request would represent. The versioning scheme we use is http://semver.org/ | ||
* Ensure any correlated issue numbers are included in the pull request. | ||
|
||
## Code of Conduct | ||
|
||
http://contributor-covenant.org/version/1/2/0/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Development information | ||
|
||
## Prerequisites | ||
|
||
* node.js v6 or higher | ||
|
||
## Code Structure | ||
|
||
* bin/ | ||
* command line interface and command line parsing code. bin/synthmanager.js is the entry point. yargs is used to do the command line parsing. | ||
* lib/ | ||
* code that implements the command line functionality. | ||
* test/ | ||
* tests. The tests use mocha, chai and testdouble.js. | ||
* index.js | ||
* library entrypoint that provides webdriver functionality for running tests locally. | ||
|
||
## Command Tasks | ||
|
||
### Linting | ||
|
||
``` | ||
gulp lint | ||
``` | ||
|
||
### Testing | ||
|
||
``` | ||
gulp test | ||
``` | ||
|
||
### Lint and Test in one Tasks | ||
|
||
``` | ||
gulp | ||
``` | ||
|
||
or | ||
|
||
``` | ||
npm test | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
const dependencies = require('../../lib/dependency'); | ||
const logger = require('winston'); | ||
const _ = require('lodash'); | ||
|
||
exports.command = 'config'; | ||
exports.desc = 'Change configuration options of a synthetic'; | ||
exports.builder = { | ||
name: { | ||
alias: 'n', | ||
desc: 'Name of synthetic to configure', | ||
type: 'string', | ||
}, | ||
id: { | ||
alias: 'i', | ||
desc: 'Id of synthetic to configure', | ||
type: 'string', | ||
}, | ||
frequency: { | ||
desc: 'Frequency to run synthetic(in minutes)', | ||
choices: [1, 5, 10, 15, 30, 60, 360, 720, 1440], | ||
type: 'number', | ||
}, | ||
locations: { | ||
desc: 'Locations to run synthetic', | ||
type: 'array', | ||
}, | ||
uri: { | ||
alias: 'u', | ||
desc: 'URI for synthetic', | ||
type: 'string', | ||
}, | ||
status: { | ||
alias: 's', | ||
desc: 'Is the synthetic enabled?', | ||
choices: ['ENABLED', 'DISABLED', 'MUTED'], | ||
}, | ||
rename: { | ||
desc: 'New name to use for synthetic', | ||
type: 'string', | ||
}, | ||
addemail: { | ||
desc: 'Add emails to alerting for synthetics (parameter can be specified multiple times)', | ||
type: 'array', | ||
}, | ||
rmemail: { | ||
desc: 'Remove email from alerting for synthetics', | ||
type: 'string', | ||
}, | ||
} | ||
|
||
function validate(argv) { | ||
if (_.isNil(argv.name) && _.isNil(argv.id)) { | ||
throw new Error('ERROR: Either name or id must be specified'); | ||
} | ||
|
||
const allOptions = [argv.frequency, argv.locations, argv.uri, argv.status, argv.rename, argv.addemail, argv.rmemail]; | ||
|
||
if (_.every(allOptions, _.isNil)) { | ||
throw new Error('Error: No changes specified'); | ||
} | ||
} | ||
|
||
exports.handler = function (argv) { | ||
require('../../lib/config/LoggingConfig')(argv); | ||
|
||
validate(argv); | ||
|
||
const config = require('../../lib/config/SyntheticsConfig').getConfig(argv); | ||
|
||
logger.verbose('Config: ' + argv.name + ':' + argv.id); | ||
logger.verbose(argv); | ||
|
||
const changeConfigOrchestrator = dependencies(config).changeConfigOrchestrator; | ||
|
||
if (!_.isNil(argv.id)) { | ||
changeConfigOrchestrator.changeConfigurationById( | ||
argv.id, | ||
argv.frequency, | ||
argv.locations, | ||
argv.uri, | ||
argv.status, | ||
argv.rename, | ||
argv.addemail, | ||
argv.rmemail | ||
); | ||
} else if (!_.isNil(argv.name)) { | ||
changeConfigOrchestrator.changeConfigurationByName( | ||
argv.name, | ||
argv.frequency, | ||
argv.locations, | ||
argv.uri, | ||
argv.status, | ||
argv.rename, | ||
argv.addemail, | ||
argv.rmemail | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
const dependencies = require('../../lib/dependency'); | ||
const logger = require('winston'); | ||
const _ = require('lodash'); | ||
|
||
exports.command = 'locations'; | ||
exports.desc = 'List available locations for synthetics to run'; | ||
|
||
exports.handler = function (argv) { | ||
require('../../lib/config/LoggingConfig')(argv); | ||
|
||
const config = require('../../lib/config/SyntheticsConfig').getConfig(argv); | ||
|
||
logger.verbose('Locations'); | ||
logger.verbose(argv); | ||
|
||
dependencies(config).listLocationsOrchestrator.listLocations(); | ||
} |
Oops, something went wrong.