Comparing version 3.5.2 to 3.6.0
@@ -11,2 +11,3 @@ var _ = require('lodash'); | ||
var resolveVersion = require('./resolveVersion'); | ||
var uuid = require('node-uuid'); | ||
@@ -30,3 +31,4 @@ var exec = Promise.promisify(child_process.exec); | ||
config: {}, | ||
log: _.bindKey(this, 'log') | ||
log: _.bindKey(this, 'log'), | ||
logLevel: 'INFO', | ||
}); | ||
@@ -36,2 +38,3 @@ this.options = options; | ||
this.nodes = []; | ||
this.id = uuid.v4(); | ||
}; | ||
@@ -38,0 +41,0 @@ |
@@ -67,3 +67,3 @@ var _ = require('lodash'); | ||
if (semver.satisfies(version, '5.x || 3.x')) { | ||
if (semver.satisfies(version, '>=5.0.0-alpha1 || 3.x')) { | ||
return create5xPluginInstallCommand(path, plugin, features); | ||
@@ -70,0 +70,0 @@ } |
@@ -16,2 +16,3 @@ var child_process = require('child_process'); | ||
var getActualVersion = require('./getActualVersion'); | ||
var uuid = require('node-uuid'); | ||
var getFeatures = require('./featureDetection').getFeatures; | ||
@@ -27,4 +28,6 @@ | ||
this.config = options.config; | ||
this.logLevel = options.logLevel; | ||
this.options = options; | ||
this.clusterNameOverride = options.clusterNameOverride; | ||
this.id = uuid.v4(); | ||
}; | ||
@@ -41,3 +44,3 @@ | ||
.spread(function (version, features) { | ||
return writeTempConfig(self.config, self.path) | ||
return writeTempConfig(self.config, self.logLevel, self.path) | ||
.then(writeShieldConfig(self.options, version)) | ||
@@ -44,0 +47,0 @@ .then(function (configPath) { |
@@ -5,6 +5,7 @@ var temp = require('temp'); | ||
var fsExtra = require('fs-extra'); | ||
var path = require('path'); | ||
var join = path.join; | ||
var join = require('path').join; | ||
var Promise = require('bluebird'); | ||
var configureLogging = require('./configureLogging'); | ||
var writeFile = Promise.promisify(fs.writeFile); | ||
@@ -22,15 +23,23 @@ var mkdirTemp = Promise.promisify(temp.mkdir); | ||
module.exports = function (config, esPath) { | ||
module.exports = function (config, logLevel, esPath) { | ||
return mkdirTemp({prefix: 'libesvm-'}).then(function createConfig(dir) { | ||
var configFileDestination = path.join(dir, 'elasticsearch.json'); | ||
return Promise.all([ | ||
writeFile(configFileDestination, JSON.stringify(config), 'utf8'), | ||
copy(join(esPath, 'config'), dir) | ||
]) | ||
return Promise.attempt(function () { | ||
return copy(join(esPath, 'config'), dir); | ||
}) | ||
.then(function () { | ||
return remove(join(dir, 'elasticsearch.yml')); | ||
return Promise.props({ | ||
es: configureLogging.enforceEsvmMinimumLevels(config, logLevel), | ||
logging: configureLogging.readAndSetLevel(join(dir, 'logging.yml'), logLevel), | ||
}); | ||
}) | ||
.then(function (configs) { | ||
return Promise.all([ | ||
remove(join(dir, 'elasticsearch.yml')), | ||
remove(join(dir, 'logging.yml')), | ||
writeFile(join(dir, 'elasticsearch.json'), JSON.stringify(configs.es), 'utf8'), | ||
writeFile(join(dir, 'logging.json'), JSON.stringify(configs.logging), 'utf8'), | ||
]); | ||
}) | ||
.thenReturn(dir); | ||
}); | ||
}; |
{ | ||
"name": "libesvm", | ||
"version": "3.5.2", | ||
"version": "3.6.0", | ||
"description": "libesvm is a library for managning an Elasticsearch process for development and testing.", | ||
@@ -32,4 +32,9 @@ "main": "index.js", | ||
"lodash": "~2.4.1", | ||
"lodash.defaultsdeep": "^4.3.5", | ||
"lodash.forown": "^4.1.0", | ||
"lodash.isplainobject": "^4.0.4", | ||
"lodash.set": "^4.1.0", | ||
"mkdirp": "~0.5.0", | ||
"moment": "^2.7.0", | ||
"node-uuid": "^1.4.7", | ||
"properties-parser": "^0.2.3", | ||
@@ -46,3 +51,4 @@ "rcloader": "^0.1.4", | ||
"devDependencies": { | ||
"chai": "~1.9.1", | ||
"chai": "^3.5.0", | ||
"chai-as-promised": "^5.3.0", | ||
"cli-color": "^0.3.2", | ||
@@ -49,0 +55,0 @@ "connect": "^3.3.5", |
@@ -34,2 +34,3 @@ libesvm | ||
* `nodes` - The number of nodes to start. This can either be a number or an array of config objects (1 per node) | ||
* `logLevel` - Set elasticsearch's log level. (Default is `INFO`, options are `OFF`, `FATAL`, `ERROR`, `WARN`, `INFO`, `DEBUG`, `TRACE`, and `ALL`). *Note: esvm requires that the `node` and `http` modules have a minimum of `INFO` level, though you can set all other modules to lower than `INFO` using this setting* | ||
* `config` - The config to start the server with. | ||
@@ -66,3 +67,3 @@ | ||
}; | ||
var cluster = libesvm.createCluster(options); | ||
@@ -106,3 +107,3 @@ | ||
}).then(function () { | ||
return cluster.start(); | ||
return cluster.start(); | ||
}).then(function () { | ||
@@ -121,2 +122,1 @@ process.on('SIGINT', function () { | ||
``` | ||
@@ -12,18 +12,17 @@ var expect = require('chai').expect; | ||
function writeMockConfig(done) { | ||
temp.mkdirAsync('mockFiles').then(function(dir) { | ||
return fs.mkdirAsync(join(dir, 'config')).then(function() { | ||
return temp.mkdirAsync('mockFiles') | ||
.then(function(dir) { | ||
return fs.mkdirAsync(join(dir, 'config')) | ||
.then(function() { | ||
var tempFiles = ['elasticsearch.json', 'logging.yml']; | ||
return Promise.all(tempFiles.map(function(file) { | ||
return Promise.map(tempFiles, function(file) { | ||
return fs.writeFileAsync(join(dir, 'config', file), ''); | ||
})); | ||
}).then(function() { | ||
done(dir); | ||
}); | ||
}); | ||
}) | ||
.thenReturn(dir); | ||
}); | ||
} | ||
function removeMockConfig(done) { | ||
temp.cleanupAsync().then(function(stats) { | ||
done(); | ||
}); | ||
function removeMockConfig() { | ||
return temp.cleanupAsync(); | ||
} | ||
@@ -33,30 +32,33 @@ | ||
var mockConfigFolder; | ||
beforeEach(function(done) { | ||
writeMockConfig(function(dir) { | ||
beforeEach(function() { | ||
return writeMockConfig() | ||
.then(function (dir) { | ||
mockConfigFolder = dir; | ||
done(); | ||
}); | ||
}); | ||
it('should create a temp folder with configs', function(done) { | ||
writeTempConfig({foo: 'bar'}, mockConfigFolder).then(function(path) { | ||
it('should create a temp folder with configs', function() { | ||
return writeTempConfig({foo: 'bar'}, 'INFO', mockConfigFolder) | ||
.then(function(path) { | ||
return fs.readdirAsync(path); | ||
}).then(function(files) { | ||
expect(files.indexOf('elasticsearch.json')).to.be.above(-1); | ||
expect(files.indexOf('logging.yml')).to.be.above(-1); | ||
done(); | ||
}) | ||
.then(function(files) { | ||
expect(files).to.contain('elasticsearch.json'); | ||
expect(files).to.contain('logging.json'); | ||
expect(files).to.not.contain('logging.yml'); | ||
expect(files).to.not.contain('elasticsearch.yaml'); | ||
}); | ||
}); | ||
afterEach(function(done) { | ||
removeMockConfig(function() { | ||
fs.readdirAsync(mockConfigFolder).then(function(files) { | ||
throw new Error('mock config should be cleaned up'); | ||
}, function(err) { | ||
expect(err.cause.code).to.equal('ENOENT'); | ||
done(); | ||
}); | ||
afterEach(function() { | ||
return removeMockConfig() | ||
.then(function () { | ||
return fs.readdirAsync(mockConfigFolder); | ||
}) | ||
.then(function(files) { | ||
throw new Error('mock config should be cleaned up'); | ||
}, function(err) { | ||
expect(err.cause.code).to.equal('ENOENT'); | ||
}); | ||
}); | ||
}); | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
72450
51
2045
22
7
17
+ Addedlodash.defaultsdeep@^4.3.5
+ Addedlodash.forown@^4.1.0
+ Addedlodash.isplainobject@^4.0.4
+ Addedlodash.set@^4.1.0
+ Addednode-uuid@^1.4.7
+ Addedlodash.defaultsdeep@4.6.1(transitive)
+ Addedlodash.forown@4.4.0(transitive)
+ Addedlodash.isplainobject@4.0.6(transitive)
+ Addedlodash.set@4.3.2(transitive)