New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

libesvm

Package Overview
Dependencies
Maintainers
3
Versions
61
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

libesvm - npm Package Compare versions

Comparing version

to
3.2.1

.travis.yml

35

lib/installPlugin.js

@@ -1,6 +0,7 @@

var _ = require('lodash');
var Promises = require('bluebird');
var exec = require('child_process').exec;
var semver = require('semver');
var join = require('path').join;
var _ = require('lodash');
var Promises = require('bluebird');
var exec = require('child_process').exec;
var semver = require('semver');
var join = require('path').join;
var installSnapshotPlugin = require('./installSnapshotPlugin');

@@ -13,4 +14,20 @@ var ERR_UNKNOWN = 0;

var cmd = join(path, 'bin', 'plugin');
cmd += (oldCommand === true) ? ' --install ' : ' install ';
cmd += (_.isPlainObject(plugin)) ? plugin.name + ' --url ' + plugin.path : plugin;
if (oldCommand) {
cmd += ' --install ';
if (_.isPlainObject(plugin)) {
cmd += plugin.name;
if (plugin.path) cmd += ' --url ' + plugin.path;
if (plugin.staging) cmd += ' -Des.plugins.staging=true';
} else {
cmd += plugin;
}
} else {
cmd += ' install ';
if (_.isPlainObject(plugin)) {
cmd += (plugin.path) ? plugin.path : plugin.name;
if (plugin.staging) cmd += ' -Des.plugins.staging=true';
} else {
cmd += plugin;
}
}
return cmd;

@@ -33,3 +50,3 @@ }

*/
module.exports = function (options, cb) {
module.exports = function installPlugin(options, cb) {
var log = options.log || _.noop;

@@ -40,2 +57,4 @@ var path = options.path;

if (_.isPlainObject(plugin) && plugin.snapshot) return installSnapshotPlugin(options, installPlugin, cb);
function handleInstallError(resolve, reject, stdout, fn) {

@@ -42,0 +61,0 @@ var errorCause = getErrorCause(stdout);

@@ -15,2 +15,3 @@ var child_process = require('child_process');

var isWindows = /^win/.test(process.platform);
var getActualVersion = require('./getActualVersion');

@@ -30,36 +31,38 @@ var Node = module.exports = function Node (options) {

var self = this;
return writeTempConfig(self.config, self.path)
.then(writeShieldConfig(self.options))
.then(function (configPath) {
return new Promises(function (resolve, reject) {
self.configPath = configPath;
var args = ['-Des.path.conf='+configPath];
return getActualVersion(self.path).then(function (version) {
return writeTempConfig(self.config, self.path)
.then(writeShieldConfig(self.options))
.then(function (configPath) {
return new Promises(function (resolve, reject) {
self.configPath = configPath;
var args = ['-Des.path.conf='+configPath];
// branch names aren't valid semver, just check the first number
var majorVersion = (self.version || self.branch).split('.').shift();
if (majorVersion === '0') {
args.unshift('-f');
}
// branch names aren't valid semver, just check the first number
var majorVersion = version.split('.').shift();
if (majorVersion === '0') {
args.unshift('-f');
}
if (self.clusterNameOverride) {
args.push('-Des.cluster.name='+self.clusterNameOverride);
}
if (self.clusterNameOverride) {
args.push('-Des.cluster.name='+self.clusterNameOverride);
}
// the path of the executable
var file = 'elasticsearch' + (isWindows ? '.bat' : '');
var path = join(self.path, 'bin', file);
// the path of the executable
var file = 'elasticsearch' + (isWindows ? '.bat' : '');
var path = join(self.path, 'bin', file);
// run the process
self.process = spawn(path, args);
// run the process
self.process = spawn(path, args);
self.process.stdout
.pipe(split())
.pipe(self.logLineParser('stdout'));
self.process.stdout
.pipe(split())
.pipe(self.logLineParser('stdout'));
self.process.stderr
.pipe(split())
.pipe(self.logLineParser('stderr'));
self.process.stderr
.pipe(split())
.pipe(self.logLineParser('stderr'));
self.process.once('error', reject);
self.once('start', resolve);
self.process.once('error', reject);
self.once('start', resolve);
});
});

@@ -66,0 +69,0 @@ }).nodeify(cb);

var _ = require('lodash');
var bcrypt = require('bcrypt');
var bcrypt = require('bcryptjs');
var glob = require('glob');

@@ -33,3 +33,5 @@ var path = require('path');

return Promise.each(users, function (user) {
return hash(user.password, 10)
return Promise.fromNode(function (cb) {
bcrypt.hash(user.password, bcrypt.genSaltSync(10), cb);
})
.then(function (hash) {

@@ -64,10 +66,9 @@ userHash[user.username] = hash;

return function (configPath) {
if (options.shield && options.shield.users) {
return copyShieldFiles(options.path, configPath)
.then(createUsersAndRoles(configPath, options.shield.users))
.thenReturn(configPath);
}
return Promise.resolve(configPath);
if (!options.shield || !options.shield.users) return Promise.resolve(configPath);
return copyShieldFiles(options.path, configPath)
.then(createUsersAndRoles(configPath, options.shield.users))
.thenReturn(configPath);
}
}
{
"name": "libesvm",
"version": "3.2.0",
"version": "3.2.1",
"description": "libesvm is a library for managning an Elasticsearch process for development and testing.",

@@ -20,3 +20,3 @@ "main": "index.js",

],
"license": "Apache 2.0",
"license": "Apache-2.0",
"bugs": {

@@ -27,4 +27,4 @@ "url": "https://github.com/ccowan/libesvm/issues"

"dependencies": {
"bcrypt": "^0.8.5",
"bluebird": "~2.1.2",
"bcryptjs": "^2.3.0",
"bluebird": "~2.10.2",
"fs-extra": "^0.24.0",

@@ -36,2 +36,3 @@ "glob": "^6.0.1",

"properties-parser": "^0.2.3",
"rcloader": "^0.1.4",
"request": "~2.65.0",

@@ -38,0 +39,0 @@ "rimraf": "~2.2.8",

var fs = require('fs');
var expect = require('chai').expect;
var cache = require('../lib/cache');
var crypto = require('crypto');
var temp = require('temp').track();
/**
* A utility to create a temp file name
* @param {string} prefix The prefix for the cache file
* @param {function} cb The node style callback
* @returns {null}
*/
var tmpfile = function (prefix, cb) {
prefix = prefix && prefix + '-' || '';
crypto.randomBytes(32, function (err, buf) {
if (err) return cb(err);
var filename = crypto.createHash('sha1')
.update(buf)
.digest('hex');
cb(null, '/tmp/' + prefix + filename);
});
};
describe('Cache', function() {
describe('File opperations', function() {
describe('File operations', function() {
after(function (done) {
temp.cleanup(done);
});
it('should return an empty object when fetch is called and the cache is new', function (done) {
tmpfile('empty-test', function (err, filename) {
var source = cache.source;
cache.source = filename;
temp.open('empty-test', function (err, filename) {
cache.source = filename.path;
cache.fetch().then(function (data) {
cache.source = source;
expect(data).to.be.empty;

@@ -39,18 +23,28 @@ done();

it('should save a new value', function (done) {
tmpfile('test', function (err, filename) {
var source = cache.source;
cache.source = filename;
cache.set('myTest', 'test');
cache.save(function (err) {
cache.source = source;
if (err) return done(err);
fs.readFile(filename, function (err, buf) {
if (err) return done(err);
var data = JSON.parse(buf.toString('utf8'));
expect(data).to.have.property('myTest', 'test');
fs.unlink(filename, done);
});
it('should save a new value on set', function (done) {
temp.open('set-test', function (err, filename) {
cache.source = filename.path;
cache.set('myTest', 'test', function (err) {
var contents = fs.readFileSync(filename.path, { encoding: 'utf8' });
var data = JSON.parse(contents);
expect(data).to.have.property('myTest', 'test');
done();
});
});
});
it('should save a new value on save', function (done) {
temp.open('save-test', function (err, filename) {
cache.source = filename.path;
cache.set('myTest', 'test')
.then(function () {
cache.save(function (err) {
var contents = fs.readFileSync(filename.path, { encoding: 'utf8' });
var data = JSON.parse(contents);
expect(data).to.have.property('myTest', 'test');
done();
});
});
});

@@ -57,0 +51,0 @@ });

var fs = require('fs');
var path = require('path');
var temp = require('temp').track();
var expect = require('chai').expect;
var cache = require('../lib/cache');
var crypto = require('crypto');
/**
* A utility to create a temp file name
* @param {string} prefix The prefix for the cache file
* @param {function} cb The node style callback
* @returns {null}
*/
var tmpfile = function (prefix, cb) {
prefix = prefix && prefix + '-' || '';
crypto.randomBytes(32, function (err, buf) {
if (err) return cb(err);
var filename = crypto.createHash('sha1')
.update(buf)
.digest('hex');
cb(null, '/tmp/' + prefix + filename);
});
};
describe('Cache', function() {
describe('Base functionality', function () {
var fixture = {
example: 'test',
bar: 'foo',
foo: 'bar',
};
var fixture = {
example: 'test',
bar: 'foo',
foo: 'bar',
};
// Create the cache fixture
before(function (done) {
temp.open('es-load-cache', function (err, filename) {
if (err) return done(err);
// Create the cache fixture
before(function (done) {
tmpfile('es-load-cache', function (err, filename) {
if (err) return done(err);
cache.source = filename;
fs.writeFile(cache.source, JSON.stringify(fixture), done);
cache.source = filename.path;
fs.writeFile(cache.source, JSON.stringify(fixture), done);
});
});
});
// Clean up the cache file
after(function (done) {
fs.unlink(cache.source, done);
});
it('should return valid data', function(done) {
cache.get('bar').then(function (val) {
expect(val).to.equal('foo');
done();
// Clean up the cache file
after(function (done) {
temp.cleanup(done);
});
});
it('should return undefined for invalid data', function(done) {
cache.get('monkey').then(function (val) {
expect(val).to.be.an('undefined');
done();
it('should return valid data', function(done) {
cache.get('bar').then(function (val) {
expect(val).to.equal('foo');
done();
});
});
});
it('should set a new value', function() {
cache.set('name', 'test').then(function () {
return cache.get('name');
})
.then(function (val) {
expect(val).to.equal('test');
it('should return undefined for invalid data', function(done) {
cache.get('monkey').then(function (val) {
expect(val).to.be.an('undefined');
done();
});
});
it('should set a new value', function() {
cache.set('name', 'test').then(function () {
return cache.get('name');
})
.then(function (val) {
expect(val).to.equal('test');
});
});
});
});

Sorry, the diff of this file is not supported yet