Skip to content

Commit 5b9e2e0

Browse files
committed
Stable Version 2.1.0
1 parent ada4db4 commit 5b9e2e0

19 files changed

+536
-512
lines changed

.jshintrc

Lines changed: 0 additions & 34 deletions
This file was deleted.

.npmignore

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# Logs
2+
logs
3+
*.log
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Directory for instrumented libs generated by jscoverage/JSCover
11+
lib-cov
12+
13+
# Coverage directory used by tools like istanbul
14+
coverage
15+
16+
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
17+
.grunt
18+
19+
# Compiled binary addons (http://nodejs.org/api/addons.html)
20+
build/Release
21+
22+
# Dependency directory
23+
# Commenting this out is preferred by some people, see
24+
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
25+
node_modules
26+
27+
# Users Environment Variables
28+
.lock-wscript
29+
30+
.idea/
31+
*.iml
32+
coverage/
33+
src/
34+
test/
35+
mocha.start.js
36+
webpack.config.js
37+
rethinkdb_data

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
##### 2.1.0 - 26 October 2015
2+
3+
###### Backwards compatible bug fixes
4+
- #16 - Handle cursor errors by @BBB
5+
6+
###### Other
7+
- Removed Grunt
8+
- Tests now use yield and generators
9+
110
##### 2.0.3 - 13 October 2015
211

312
###### Backwards compatible bug fixes

CONTRIBUTING.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Contributing Guide
22

3-
First, support is handled via the [Gitter Channel](https://gitter.im/js-data/js-data) and the [Mailing List](https://groups.io/org/groupsio/jsdata). Ask your questions there.
3+
First, support is handled via the [Slack Channel](http://slack.js-data.io) and the [Mailing List](https://groups.io/org/groupsio/jsdata). Ask your questions there.
44

55
When submitting issues on GitHub, please include as much detail as possible to make debugging quick and easy.
66

@@ -22,3 +22,17 @@ When submitting issues on GitHub, please include as much detail as possible to m
2222
1. The `dist/` folder & files will be generated, do NOT commit `dist/*`! They will be committed when a release is cut.
2323
1. Submit your PR and we'll review!
2424
1. Thanks!
25+
26+
#### Have write access?
27+
28+
Here's how to make a release on the `master` branch:
29+
30+
1. Bump `package.json` to the appropriate version.
31+
1. `npm test` must succeed.
32+
1. This time, the built `dist/js-data-rethinkdb.js` file _will_ be committed, so stage its changes.
33+
1. Mention the release version in the commit message, e.g. `Stable Version 1.2.3`
34+
1. Push to master.
35+
1. Create a git tag. Name it the version of the release, e.g. `1.2.3`
36+
- Easiest way is to just create a GitHub Release, which will create the tag for you. Name the Release and the git tag the same thing.
37+
1. `git fetch origin` if you tagged it via GitHub Release, so you can get the tag on your local machine.
38+
1. `npm publish .` (Make sure you got the version bumped correctly!)

Gruntfile.js

Lines changed: 0 additions & 88 deletions
This file was deleted.

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<img src="https://raw.githubusercontent.com/js-data/js-data/master/js-data.png" alt="js-data logo" title="js-data" align="right" width="64" height="64" />
22

3-
## js-data-rethinkdb [![npm version](https://img.shields.io/npm/v/js-data-rethinkdb.svg?style=flat-square)](https://www.npmjs.org/package/js-data-rethinkdb) [![Travis CI](https://img.shields.io/travis/js-data/js-data-rethinkdb.svg?style=flat-square)](https://travis-ci.org/js-data/js-data-rethinkdb) [![npm downloads](https://img.shields.io/npm/dm/js-data-rethinkdb.svg?style=flat-square)](https://www.npmjs.org/package/js-data-rethinkdb) [![License](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](https://github.com/js-data/js-data-rethinkdb/blob/master/LICENSE)
3+
## js-data-rethinkdb [![Slack Status][sl_b]][sl_l] [![npm version][npm_b]][npm_l] [![Circle CI][circle_b]][circle_l] [![npm downloads][dn_b]][dn_l] [![Coverage Status][cov_b]][cov_l] [![Codacy][cod_b]][cod_l]
44

55
RethinkDB adapter for [js-data](http://www.js-data.io/).
66

@@ -10,12 +10,8 @@ RethinkDB adapter for [js-data](http://www.js-data.io/).
1010
### Example App
1111
[js-data-examples/server/rethinkdb](https://github.com/js-data/js-data-examples/tree/master/server/rethinkdb)
1212

13-
### Project Status
14-
15-
__Latest Release:__ [![Latest Release](https://img.shields.io/github/release/js-data/js-data-rethinkdb.svg?style=flat-square)](https://github.com/js-data/js-data-rethinkdb/releases)
16-
1713
### Quick Start
18-
`npm install --save js-data js-data-rethinkdb`.
14+
`npm install --save js-data js-data-rethinkdb rethinkdbdash`.
1915

2016
```js
2117
var JSData = require('js-data');
@@ -44,7 +40,7 @@ store.registerAdapter('rethinkdb', adapter, { default: true });
4440

4541
### Contributing
4642

47-
First, support is handled via the [Gitter Channel](https://gitter.im/js-data/js-data) and the [Mailing List](https://groups.io/org/groupsio/jsdata). Ask your questions there.
43+
First, support is handled via the [Slack Channel](http://slack.js-data.io/) and the [Mailing List](https://groups.io/org/groupsio/jsdata). Ask your questions there.
4844

4945
When submitting issues on GitHub, please include as much detail as possible to make debugging quick and easy.
5046

@@ -90,3 +86,16 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
9086
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
9187
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
9288
SOFTWARE.
89+
90+
[sl_b]: http://slack.js-data.io/badge.svg
91+
[sl_l]: http://slack.js-data.io
92+
[npm_b]: https://img.shields.io/npm/v/js-data-rethinkdb.svg?style=flat
93+
[npm_l]: https://www.npmjs.org/package/js-data-rethinkdb
94+
[circle_b]: https://img.shields.io/circleci/project/js-data/js-data-rethinkdb/master.svg?style=flat
95+
[circle_l]: https://circleci.com/gh/js-data/js-data-rethinkdb/tree/master
96+
[dn_b]: https://img.shields.io/npm/dm/js-data-rethinkdb.svg?style=flat
97+
[dn_l]: https://www.npmjs.org/package/js-data-rethinkdb
98+
[cov_b]: https://img.shields.io/coveralls/js-data/js-data-rethinkdb/master.svg?style=flat
99+
[cov_l]: https://coveralls.io/github/js-data/js-data-rethinkdb?branch=master
100+
[cod_b]: https://img.shields.io/codacy/69206fcb0df6462ca559610af32fd1fb.svg
101+
[cod_l]: https://www.codacy.com/app/jasondobry/js-data-rethinkdb/dashboard

circle.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
machine:
2+
node:
3+
version: 4.1.0
4+
5+
dependencies:
6+
pre:
7+
- source /etc/lsb-release && echo "deb http://download.rethinkdb.com/apt $DISTRIB_CODENAME main" | sudo tee /etc/apt/sources.list.d/rethinkdb.list
8+
- wget -qO- http://download.rethinkdb.com/apt/pubkey.gpg | sudo apt-key add -
9+
- sudo apt-get update -qq
10+
- sudo apt-get install rethinkdb -y --force-yes
11+
post:
12+
- sudo rethinkdb --io-threads 2048 --daemon
13+
- ulimit -S -n 2048
14+
- sleep 10
15+
test:
16+
override:
17+
- npm run ci
18+
post:
19+
- killall rethinkdb

dist/js-data-rethinkdb.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -430,6 +430,7 @@ module.exports =
430430
return this.waitForTable(resourceConfig.table || underscore(resourceConfig.name), options).then(function () {
431431
return _this5.r.db(options.db || _this5.defaults.db).table(resourceConfig.table || underscore(resourceConfig.name)).insert(attrs, { returnChanges: true }).run();
432432
}).then(function (cursor) {
433+
_this5._handleErrors(cursor);
433434
return cursor.changes[0].new_val;
434435
});
435436
}
@@ -443,6 +444,7 @@ module.exports =
443444
return this.waitForTable(resourceConfig.table || underscore(resourceConfig.name), options).then(function () {
444445
return _this6.r.db(options.db || _this6.defaults.db).table(resourceConfig.table || underscore(resourceConfig.name)).get(id).update(attrs, { returnChanges: true }).run();
445446
}).then(function (cursor) {
447+
_this6._handleErrors(cursor);
446448
if (cursor.changes && cursor.changes.length && cursor.changes[0].new_val) {
447449
return cursor.changes[0].new_val;
448450
} else {
@@ -461,6 +463,7 @@ module.exports =
461463
return this.waitForTable(resourceConfig.table || underscore(resourceConfig.name), options).then(function () {
462464
return _this7.filterSequence(_this7.selectTable(resourceConfig, options), params).update(attrs, { returnChanges: true }).run();
463465
}).then(function (cursor) {
466+
_this7._handleErrors(cursor);
464467
if (cursor && cursor.changes && cursor.changes.length) {
465468
var _ret = (function () {
466469
var items = [];
@@ -503,6 +506,16 @@ module.exports =
503506
return undefined;
504507
});
505508
}
509+
}, {
510+
key: '_handleErrors',
511+
value: function _handleErrors(cursor) {
512+
if (cursor && cursor.errors > 0) {
513+
if (cursor.first_error) {
514+
throw new Error(cursor.first_error);
515+
}
516+
throw new Error('Unknown RethinkDB Error');
517+
}
518+
}
506519
}]);
507520

508521
return DSRethinkDBAdapter;

mocha.start.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,12 @@
22
'use strict';
33

44
var assert = require('chai').assert;
5+
assert.equalObjects = function (a, b, m) {
6+
assert.deepEqual(JSON.parse(JSON.stringify(a)), JSON.parse(JSON.stringify(b)), m || 'Objects should be equal!');
7+
};
58
var mocha = require('mocha');
9+
var coMocha = require('co-mocha');
10+
coMocha(mocha);
611
var DSRethinkDBAdapter = require('./');
712
var JSData = require('js-data');
813
JSData.DSUtils.Promise = require('bluebird');
@@ -111,11 +116,11 @@ beforeEach(function () {
111116
global.DSErrors = globals.DSErrors;
112117
});
113118

114-
afterEach(function (done) {
119+
afterEach(function* () {
115120
globals.adapter = null;
116121
global.adapter = null;
117122

118-
adapter.destroyAll(User, {}).then(function () {
119-
done();
120-
}, done);
123+
yield adapter.destroyAll(Comment);
124+
yield adapter.destroyAll(Post);
125+
yield adapter.destroyAll(User);
121126
});

package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "js-data-rethinkdb",
33
"description": "RethinkDB adapter for js-data.",
4-
"version": "2.0.3",
4+
"version": "2.1.0",
55
"homepage": "http://www.js-data.io/docs/dsrethinkdbadapter",
66
"repository": {
77
"type": "git",
@@ -11,12 +11,7 @@
1111
"name": "Jason Dobry",
1212
"email": "[email protected]"
1313
},
14-
"licenses": [
15-
{
16-
"type": "MIT",
17-
"url": "https://github.com/js-data/js-data-rethinkdb/blob/master/LICENSE"
18-
}
19-
],
14+
"license": "MIT",
2015
"main": "./dist/js-data-rethinkdb.js",
2116
"keywords": [
2217
"data",
@@ -33,21 +28,26 @@
3328
"babel-loader": "5.3.2",
3429
"bluebird": "2.10.2",
3530
"chai": "3.3.0",
36-
"grunt": "0.4.5",
37-
"grunt-mocha-test": "0.12.7",
38-
"grunt-webpack": "1.0.11",
39-
"jit-grunt": "0.9.1",
40-
"jshint": "2.8.0",
41-
"jshint-loader": "0.8.3",
31+
"co": "4.6.0",
32+
"co-mocha": "1.1.2",
33+
"codacy-coverage": "1.1.3",
34+
"coveralls": "2.11.4",
35+
"istanbul": "0.4.0",
36+
"mocha": "2.3.3",
4237
"standard": "5.3.1",
43-
"time-grunt": "1.2.1"
38+
"webpack": "1.12.2"
39+
},
40+
"scripts": {
41+
"lint": "standard src/index.js",
42+
"build": "webpack --config webpack.config.js --colors",
43+
"mocha": "mocha --timeout 20000 --reporter dot mocha.start.js test/*.spec.js",
44+
"cover": "istanbul cover --hook-run-in-context node_modules/mocha/bin/_mocha -- --timeout 20000 --reporter dot mocha.start.js test/*.spec.js",
45+
"test": "npm run lint && npm run build && npm run cover",
46+
"ci": "npm run test && cat coverage/lcov.info | coveralls || true && cat ./coverage/lcov.info | codacy-coverage || true"
4447
},
4548
"standard": {
4649
"parser": "babel-eslint"
4750
},
48-
"scripts": {
49-
"test": "grunt test"
50-
},
5151
"dependencies": {
5252
"mout": "0.11.0"
5353
},

0 commit comments

Comments
 (0)