Comparing version 0.0.7 to 0.0.8
@@ -77,2 +77,5 @@ var _ = require('lodash'); | ||
node.on('log', log); | ||
node.on('error', function (error) { | ||
self.emit('error', error); | ||
}); | ||
return node; | ||
@@ -79,0 +82,0 @@ }); |
var downloadAndInstall = require('./downloadAndInstall'); | ||
var _ = require('lodash'); | ||
var pp = require('properties-parser'); | ||
var fs = require('fs'); | ||
var Promise = require('bluebird'); | ||
var readFileAsync = Promise.promisify(fs.readFile); | ||
var join = require('path').join; | ||
@@ -15,6 +20,13 @@ /** | ||
var branch = options.branch; | ||
var jdk = /^(0.90|1.0|1.1)/.test(options.branch) ? 'JDK6' : 'JDK7'; | ||
var url = 'http://s3-us-west-2.amazonaws.com/build.elasticsearch.org/origin/'+branch+'/nightly/'+jdk+'/elasticsearch-latest-SNAPSHOT.tar.gz'; | ||
log('INFO', 'Downloading & installing from "' + options.branch + '" branch.'); | ||
return downloadAndInstall(url, options.dest, log); | ||
// Grab the url from the properties file | ||
readFileAsync(join(__dirname, 'client_tests_urls.properties')).then(function (buffer) { | ||
var urls = pp.parse(buffer.toString('utf8')); | ||
var key = 'URL_' + branch.replace(/[^\dx]+/g, ''); // version numbers are 0-9 and x | ||
// We only allow installing of branches available in the properties file | ||
if (!urls[key]) throw new Error('Branch ' + branch + ' is not available for install.'); | ||
// Change from zip to tgz since zip files are a pain to handle in node.js | ||
var url = urls[key].replace(/\.zip$/, '.tar.gz'); | ||
log('INFO', 'Downloading & installing from "' + options.branch + '" branch.'); | ||
return downloadAndInstall(url, options.dest, log).nodeify(cb); | ||
}); | ||
}; |
@@ -39,4 +39,4 @@ var child_process = require('child_process'); | ||
var parseLog = _.bindKey(self, 'parseLog'); | ||
self.process.stderr.on('data', parseLog); | ||
self.process.stdout.on('data', parseLog); | ||
self.process.stderr.on('data', _.partial(parseLog, 'stderr')); | ||
self.process.stdout.on('data', _.partial(parseLog, 'stdout')); | ||
self.process.once('error', reject); | ||
@@ -48,3 +48,3 @@ self.once('start', resolve); | ||
Node.prototype.parseLog = function (data) { | ||
Node.prototype.parseLog = function (level, data) { | ||
var message = data.toString('utf8'); | ||
@@ -71,3 +71,7 @@ var matches = message.match(/^\[([^\]]+)\]\[([^\]]+)\]\[([^\]]+)\]\s*\[([^\]]+)\](.+)/); | ||
this.emit('log', msgObj); | ||
} | ||
if (level === 'stderr') { | ||
var errorMessage = data.toString('utf8').trim(); | ||
if (errorMessage) this.emit('error', new Error(errorMessage)); | ||
} | ||
@@ -74,0 +78,0 @@ }; |
{ | ||
"name": "libesvm", | ||
"version": "0.0.7", | ||
"version": "0.0.8", | ||
"description": "libesvm is a library for managning an Elasticsearch process for development and testing.", | ||
@@ -26,2 +26,3 @@ "main": "index.js", | ||
"mkdirp": "~0.5.0", | ||
"properties-parser": "^0.2.3", | ||
"request": "~2.36.0", | ||
@@ -28,0 +29,0 @@ "rimraf": "~2.2.8", |
40097
37
1001
9
8
+ Addedproperties-parser@^0.2.3
+ Addedproperties-parser@0.2.3(transitive)