Comparing version 0.0.11 to 0.0.12
@@ -12,3 +12,3 @@ var cache = require('./cache'); | ||
var options = { | ||
url: 'https://api.github.com/repos/elasticsearch/elasticsearch/tags', | ||
url: 'https://api.github.com/repos/elastic/elasticsearch/tags', | ||
headers: { | ||
@@ -15,0 +15,0 @@ 'User-Agent': 'ccowan/elastic-loader', |
@@ -9,3 +9,3 @@ var _ = require('lodash'); | ||
* @param {function} cb The node style callback | ||
* @returns {Promise} | ||
* @returns {Promise} | ||
*/ | ||
@@ -15,3 +15,3 @@ var fetchTags = function (queryString, cb) { | ||
var options = { | ||
url: 'https://api.github.com/repos/elasticsearch/elasticsearch/tags', | ||
url: 'https://api.github.com/repos/elastic/elasticsearch/tags', | ||
json: true, | ||
@@ -25,3 +25,3 @@ headers: { | ||
return utils.request(options).then(function (res) { | ||
return res[1]; | ||
return res[1]; | ||
}).nodeify(cb); | ||
@@ -28,0 +28,0 @@ }; |
@@ -11,20 +11,22 @@ var cache = require('./cache'); | ||
* Get an updated version of the latest tags from Github | ||
* @param {function} cb The node style callback | ||
* @param {function} cb The node style callback | ||
* @returns {Promise} | ||
*/ | ||
module.exports = function (cb) { | ||
// return the tags if we have a fresh etag | ||
// return the tags if we have a fresh etag | ||
if (eTagFetched) return cache.get('tags'); | ||
return checkEtag().then(function (isFresh) { | ||
eTagFetched = true; | ||
if (isFresh === false) { | ||
return fetchAllTags().then(function (tags) { | ||
return cache.set('tags', tags).then(function () { | ||
return tags; | ||
return cache.get('tags').then(function (currentTags) { | ||
if (isFresh === false || !currentTags) { | ||
return fetchAllTags().then(function (tags) { | ||
return cache.set('tags', tags).then(function () { | ||
return tags; | ||
}); | ||
}); | ||
}); | ||
} | ||
return cache.get('tags'); | ||
} | ||
return currentTags; | ||
}); | ||
}); | ||
}; | ||
@@ -14,3 +14,3 @@ var _ = require('lodash'); | ||
tags = _.map(tags, function (tag) { | ||
tag.name = tag.name.replace(/\.(beta|rc)/i, '-$1'); | ||
if (tag.name) tag.name = tag.name.replace(/\.(beta|rc)/i, '-$1'); | ||
return tag; | ||
@@ -23,2 +23,3 @@ }); | ||
for (var i = 0; i<length; i++) { | ||
if (!tags[i].name) continue; | ||
var matches = tags[i].name.match(/^v(\d+\.\d+\.\d+)(\.(.+))?/); | ||
@@ -25,0 +26,0 @@ var name = matches[1]; |
{ | ||
"name": "libesvm", | ||
"version": "0.0.11", | ||
"version": "0.0.12", | ||
"description": "libesvm is a library for managning an Elasticsearch process for development and testing.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
44781
1218
4