Skip to content

Commit

Permalink
Merge pull request #74 from learnlinux/master
Browse files Browse the repository at this point in the history
Updates for Modern Versions of NodeJS
  • Loading branch information
stianeikeland committed Aug 3, 2017
2 parents 134cd53 + 0c383ae commit 44fddf5
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 30 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ lib/
node_modules/
.DS_Store
temp/
.nyc_output
coverage
3 changes: 3 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ npm-debug.log
.gitignore
.travis.yml
temp/
.nyc_output
coverage
lib
11 changes: 4 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,10 @@ language: node_js
sudo: false
node_js:
- "iojs"
- "5.1"
- "4.2"
- "4.1"
- "4.0"
- "0.12"
- "0.11"
- "0.10"
- "7"
- "6"
- "5"
- "4"
env:
- CXX="g++-4.8" CC="gcc-4.8"
addons:
Expand Down
19 changes: 15 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,26 +1,37 @@
# node-etcd

A nodejs library for [etcd](http://github.com/coreos/etcd), written in coffee-script.
A nodejs library for [ETCD v2](https://coreos.com/etcd/docs/latest/v2/api.html), written in coffee-script.

[![NPM](https://nodei.co/npm/node-etcd.png?downloads=true&stars=true)](https://nodei.co/npm/node-etcd/)
[![Travis](https://img.shields.io/travis/stianeikeland/node-etcd.svg)](https://travis-ci.org/stianeikeland/node-etcd)

Travis-CI: [![Build Status](https://travis-ci.org/stianeikeland/node-etcd.png?branch=master)](https://travis-ci.org/stianeikeland/node-etcd)
[![npm](https://img.shields.io/npm/v/node-etcd.svg)](https://www.npmjs.com/package/node-etcd)

## Install

For nodejs >= 0.10 and iojs:
For nodes >= 4.x:

```
$ npm install node-etcd
```

For 0.10.x <= nodejs <= 4.x and iojs:

```
$ npm install node-etcd@5.1.0
```

For nodejs == 0.8:

```
$ npm install node-etcd@3.0.2
```

## Changes
- 6.0.0
- Migrate from underscore to lodash for performance / @derektbrown
- Updated package versions / @derektbrown
- Update deasync call for newer node versions / @derektbrown
- Add istanbul coverage reporting / @derektbrown

- 5.1.0
- Upgrade deasync dep (caused build problems on newer node) #67 / @jefflembeck
Expand Down
59 changes: 44 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
{
"name": "node-etcd",
"version": "5.1.0",
"version": "6.0.0",
"description": "etcd library for node.js (etcd v2 api)",
"repository": {
"type": "git",
"url": "http://github.com/stianeikeland/node-etcd.git"
},
"licenses": [
{
"type": "BSD 3-Clause",
Expand All @@ -15,33 +19,58 @@
"web": "http://eikeland.se/"
}
],
"repository": {
"type": "git",
"url": "http://github.com/stianeikeland/node-etcd.git"
},
"contribuitors": [
{
"name": "Stian Eikeland",
"url": "https://github.com/stianeikeland"
},
{
"name": "Derek Brown",
"email": "mail@derektbrown.com",
"url": "derektbrown.com"
},
{
"name": "Jon Morehouse",
"email": "morehousej09@gmail.com",
"url": "https://github.com/jonmorehouse"
},
{
"name": "Bryan Rockwood",
"email": "bryan.rockwood@c2fo.com",
"url": "https://github.com/brockwood"
}
],
"engines": {
"node": ">= 0.10.0"
},
"main": "lib/index.js",
"scripts": {
"build": "node_modules/.bin/coffee --bare --compile --output lib/ src/*.coffee",
"prepublish": "node_modules/.bin/coffee --bare --compile --output lib/ src/*.coffee",
"postpublish": "rm -rf lib",
"test": "node_modules/.bin/mocha --compilers coffee:coffee-script/register test/",
"test": "node_modules/.bin/mocha --require coffee-coverage/register-istanbul --compilers coffee:coffee-script/register test/",
"coverage": "node_modules/.bin/nyc npm test",
"watch": "node_modules/.bin/mocha --compilers coffee:coffee-script/register --watch"
},
"nyc": {
"check-coverage": true,
"include": [
"src/**/*.js"
]
},
"dependencies": {
"deasync": "0.1.9",
"request": "^2.81.0",
"underscore": "1.8.2",
"deasync": "0.1.10",
"lodash": "4.17.4",
"request": "2.81.0",
"url-parse": "1.0.5"
},
"devDependencies": {
"coffee-script": "1.9.1",
"mocha": "2.1.0",
"nock": "2.17.0",
"should": "5.0.1",
"simple-mock": "0.5.0"
"coffee-coverage": "2.0.1",
"coffee-script": "1.12.7",
"mocha": "3.5.0",
"nock": "9.0.14",
"nyc": "11.1.0",
"should": "11.2.1",
"simple-mock": "0.8.0"
},
"keywords": [
"etcd",
Expand Down
7 changes: 4 additions & 3 deletions src/client.coffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
request = require 'request'
deasync = require 'deasync'
_ = require 'underscore'
_ = require 'lodash'


# Default options for request library
Expand Down Expand Up @@ -80,7 +80,7 @@ class Client
timestamp: new Date()

# Recurse:
return @_multiserverHelper _.rest(servers), options, token, callback
return @_multiserverHelper _.drop(servers), options, token, callback

# Deliver response
@_handleResponse err, resp, body, callback
Expand All @@ -98,7 +98,7 @@ class Client

if options.synchronous is true and options.syncdone is undefined
options.syncdone = false
deasync.runLoopOnce() while !options.syncdone
deasync.loopWhile(() => return !options.syncdone);
delete options.syncdone
return @syncmsg
else
Expand All @@ -119,6 +119,7 @@ class Client

_waitTime: (retries) ->
return 1 if process.env.RUNNING_UNIT_TESTS is 'true'
### !pragma no-coverage-next ###
return 100 * Math.pow 16, retries


Expand Down
2 changes: 1 addition & 1 deletion src/index.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
_ = require 'underscore'
_ = require 'lodash'
Watcher = require './watcher'
Client = require './client'
HttpsAgent = (require 'https').Agent
Expand Down

0 comments on commit 44fddf5

Please sign in to comment.