MXS-1300: Make the MaxCtrl core a Node.js module
The core is now a module that is loaded by the command line client. This allows the core library to be reused for testing.
This commit is contained in:
parent
9a6e281456
commit
9e688772cc
@ -13,7 +13,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
var maxctrl = require('./core.js')
|
||||
var maxctrl = require('maxctrl-core')
|
||||
|
||||
// Mangle the arguments if we are being called from the command line
|
||||
if (process.argv[0] == process.execPath) {
|
||||
|
@ -16,8 +16,6 @@ var program = require('yargs');
|
||||
|
||||
const maxctrl_version = '1.0.0';
|
||||
|
||||
require('./common.js')()
|
||||
|
||||
program
|
||||
.version(maxctrl_version)
|
||||
.group(['u', 'p', 'h', 's', 't', 'q', 'tsv'], 'Global Options:')
|
20
maxctrl/maxctrl_core/package.json
Normal file
20
maxctrl/maxctrl_core/package.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"name": "maxctrl-core",
|
||||
"version": "1.0.0",
|
||||
"description": "MaxScale Administrative Client Core Library",
|
||||
"repository": "https://github.com/mariadb-corporation/MaxScale",
|
||||
"main": "core.js",
|
||||
"keywords": [
|
||||
"maxscale"
|
||||
],
|
||||
"author": "MariaDB Corporation Ab",
|
||||
"license": "SEE LICENSE IN ../../LICENSE.TXT",
|
||||
"dependencies": {
|
||||
"cli-table": "^0.3.1",
|
||||
"lodash": "^4.17.4",
|
||||
"lodash-getpath": "^0.2.4",
|
||||
"request": "^2.81.0",
|
||||
"request-promise-native": "^1.0.3",
|
||||
"yargs": "^8.0.2"
|
||||
}
|
||||
}
|
@ -16,12 +16,7 @@
|
||||
"author": "MariaDB Corporation Ab",
|
||||
"license": "SEE LICENSE IN ../../LICENSE.TXT",
|
||||
"dependencies": {
|
||||
"cli-table": "^0.3.1",
|
||||
"lodash": "^4.17.4",
|
||||
"lodash-getpath": "^0.2.4",
|
||||
"request": "^2.81.0",
|
||||
"request-promise-native": "^1.0.3",
|
||||
"yargs": "^8.0.2"
|
||||
"maxscale-core": "file:./maxctrl_core"
|
||||
},
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
|
@ -3,7 +3,7 @@ require('../test_utils.js')()
|
||||
describe("Diagnostic commands", function() {
|
||||
before(startMaxScale)
|
||||
|
||||
var ctrl = require('../core.js')
|
||||
var ctrl = require('maxctrl-core')
|
||||
var tests = [
|
||||
'list servers',
|
||||
'list services',
|
||||
|
@ -8,10 +8,8 @@ describe("Server states", function() {
|
||||
})
|
||||
})
|
||||
|
||||
var ctrl = require('../core.js')
|
||||
var opts = {
|
||||
extra_args: [ '--quiet']
|
||||
}
|
||||
var ctrl = require('maxctrl-core')
|
||||
var opts = { extra_args: [ '--quiet'] }
|
||||
|
||||
it('set correct state', function() {
|
||||
return ctrl.execute('set server server2 master'.split(' '), opts)
|
||||
|
Loading…
x
Reference in New Issue
Block a user