rename project to esqueue

This commit is contained in:
2016-05-03 16:30:54 -07:00
parent 9b31859eed
commit 5efccc4435
4 changed files with 27 additions and 17 deletions

View File

@@ -1,5 +1,5 @@
{
"name": "elastique",
"name": "esqueue",
"version": "0.1.0",
"description": "",
"main": "lib/index.js",
@@ -10,7 +10,11 @@
"test": "npm run build && npm run unit",
"unit": "nyc --require babel-core/register mocha test/src/**"
},
"author": "",
"author": "Joe Fleming (https://github.com/w33ble)",
"repository": {
"type": "git",
"url": "https://github.com/w33ble/esqueue.git"
},
"license": "Apache-2.0",
"engines": {
"node": ">=4.3.0"

View File

@@ -1,12 +1,18 @@
[![Build Status](https://travis-ci.org/w33ble/elastique.svg?branch=master)](https://travis-ci.org/w33ble/elastique) [![codecov](https://codecov.io/gh/w33ble/elastique/branch/master/graph/badge.svg)](https://codecov.io/gh/w33ble/elastique)
[![Build Status](https://travis-ci.org/w33ble/esqueue.svg?branch=master)](https://travis-ci.org/w33ble/esqueue) [![codecov](https://codecov.io/gh/w33ble/esqueue/branch/master/graph/badge.svg)](https://codecov.io/gh/w33ble/esqueue)
# Elasticsearch-powered job queue
# esqueue
WIP, working title
`esqueue` is an Elasticsearch-powered job queue
## Installation
`npm install esqueue`
## Usage
Still not ready for publishing to npm...
Simply include the module in your application.
`var Esqueue = require('esqueue');`
### Creating a queue
@@ -16,7 +22,7 @@ The first step is to create a new Queue instance. This is your point of entry, i
var index = 'my-index';
var options = {};
var queue = new Elastique(index, options);
var queue = new Esqueue(index, options);
```
The queue instance is an event emitter, so you can listen for `error` events as you would any other event emitter.

View File

@@ -8,7 +8,7 @@ import { omit } from 'lodash';
const debug = logger('queue');
export default class Elastique extends events.EventEmitter {
export default class Esqueue extends events.EventEmitter {
constructor(index, options = {}) {
if (!index) throw new Error('Must specify an index to write to');

View File

@@ -3,9 +3,9 @@ import expect from 'expect.js';
import sinon from 'sinon';
import { noop, times } from 'lodash';
import elasticsearchMock from '../fixtures/elasticsearch';
import Elastique from '../../lib/index';
import Esqueue from '../../lib/index';
describe('Elastique class', function () {
describe('Esqueue class', function () {
let client;
beforeEach(function () {
@@ -13,18 +13,18 @@ describe('Elastique class', function () {
});
it('should be an event emitter', function () {
const queue = new Elastique('elastique', { client });
const queue = new Esqueue('esqueue', { client });
expect(queue).to.be.an(events.EventEmitter);
});
describe('Option validation', function () {
it('should throw without an index', function () {
const init = () => new Elastique();
const init = () => new Esqueue();
expect(init).to.throwException(/must.+specify.+index/i);
});
it('should throw with an invalid host', function () {
const init = () => new Elastique('elastique', {
const init = () => new Esqueue('esqueue', {
client: { host: 'nope://nope' }
});
@@ -32,7 +32,7 @@ describe('Elastique class', function () {
});
it('should throw with invalid hosts', function () {
const init = () => new Elastique('elastique', {
const init = () => new Esqueue('esqueue', {
client: { hosts: [{ host: 'localhost', protocol: 'nope' }] }
});
@@ -43,14 +43,14 @@ describe('Elastique class', function () {
describe('Queue construction', function () {
it('should ping the ES server', function () {
const pingSpy = sinon.spy(client, 'ping');
new Elastique('elastique', { client });
new Esqueue('esqueue', { client });
sinon.assert.calledOnce(pingSpy);
});
});
describe('Registering workers', function () {
it('should keep track of workers', function () {
const queue = new Elastique('elastique', { client });
const queue = new Esqueue('esqueue', { client });
expect(queue.getWorkers()).to.eql([]);
expect(queue.getWorkers()).to.have.length(0);
@@ -63,7 +63,7 @@ describe('Elastique class', function () {
describe('Destroy', function () {
it('should destroy workers', function () {
const queue = new Elastique('elastique', { client });
const queue = new Esqueue('esqueue', { client });
const stubs = times(3, () => { return { destroy: sinon.stub() }; });
stubs.forEach((stub) => queue._workers.push(stub));
expect(queue.getWorkers()).to.have.length(3);