Skip to content

Commit ee979c4

Browse files
committed
Initial Release.
Stable Version 0.1.0.
1 parent 3294271 commit ee979c4

19 files changed

+658
-5
lines changed

.bowerrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"directory": "bower_components"
3+
}

.gitignore

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,13 @@ build/Release
2222
# Dependency directory
2323
# Commenting this out is preferred by some people, see
2424
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git-
25-
node_modules
25+
node_modules/
26+
bower_components/
2627

2728
# Users Environment Variables
2829
.lock-wscript
30+
31+
.idea/
32+
*.iml
33+
34+
rethinkdb_data/

.jshintrc

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"node": false,
3+
"browser": true,
4+
"es5": true,
5+
"esnext": true,
6+
"bitwise": true,
7+
"camelcase": true,
8+
"curly": true,
9+
"eqeqeq": true,
10+
"immed": true,
11+
"indent": 2,
12+
"latedef": true,
13+
"newcap": true,
14+
"undef": true,
15+
"unused": true,
16+
"noarg": true,
17+
"quotmark": "single",
18+
"regexp": true,
19+
"strict": false,
20+
"trailing": true,
21+
"smarttabs": true,
22+
"globals": {
23+
"describe": true,
24+
"it": true,
25+
"beforeEach": true,
26+
"afterEach": true,
27+
"assert": true,
28+
"fail": true,
29+
"console": true,
30+
"require": true,
31+
"module": true,
32+
"exports": true
33+
}
34+
}

.travis.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
language: node_js
2+
node_js:
3+
- "0.10"
4+
before_install:
5+
- sudo add-apt-repository ppa:rethinkdb/ppa -y
6+
- sudo apt-get update -qq
7+
- sudo apt-get install rethinkdb -y
8+
- npm install -g grunt-cli
9+
before_script:
10+
- sudo rethinkdb --io-threads 2048 --daemon
11+
- ulimit -S -n 2048
12+
- sleep 10
13+
script:
14+
- grunt test
15+
- grunt coveralls || true
16+
after_script:
17+
- killall rethinkdb

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
##### 0.1.0 - 03 October 2014
2+
3+
- Initial Release

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Contributing Guide
2+
3+
First, feel free to contact me with questions. [Mailing List](https://groups.io/org/groupsio/jsdata). [Issues](https://github.com/js-data/js-data-rethinkdb/issues).
4+
5+
1. Contribute to the issue that is the reason you'll be developing in the first place
6+
1. Fork js-data-rethinkdb
7+
1. `git clone https://github.com/<you>/js-data-rethinkdb.git`
8+
1. `cd js-data-rethinkdb; npm install; bower install;`
9+
1. `grunt go` (builds and starts a watch)
10+
1. (in another terminal) `grunt karma:dev` (runs the tests)
11+
1. Write your code, including relevant documentation and tests
12+
1. Submit a PR and we'll review

Gruntfile.js

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*
2+
* js-data-rethinkdb
3+
* http://github.com/js-data/js-data-rethinkdb
4+
*
5+
* Copyright (c) 2014 Jason Dobry <http://www.js-data.io/js-data-rethinkdb>
6+
* Licensed under the MIT license. <https://github.com/js-data/js-data-rethinkdb/blob/master/LICENSE>
7+
*/
8+
module.exports = function (grunt) {
9+
'use strict';
10+
11+
require('jit-grunt')(grunt, {
12+
coveralls: 'grunt-karma-coveralls'
13+
});
14+
require('time-grunt')(grunt);
15+
16+
var pkg = grunt.file.readJSON('package.json');
17+
18+
// Project configuration.
19+
grunt.initConfig({
20+
pkg: pkg,
21+
jshint: {
22+
all: ['Gruntfile.js', 'src/**/*.js', 'test/*.js'],
23+
jshintrc: '.jshintrc'
24+
},
25+
watch: {
26+
dist: {
27+
files: ['src/**/*.js'],
28+
tasks: ['build']
29+
}
30+
},
31+
coveralls: {
32+
options: {
33+
coverage_dir: 'coverage'
34+
}
35+
},
36+
mochaTest: {
37+
all: {
38+
options: {
39+
reporter: 'spec'
40+
},
41+
src: ['mocha.start.js', 'test/**/*.js']
42+
}
43+
}
44+
});
45+
46+
grunt.registerTask('n', ['mochaTest']);
47+
48+
grunt.registerTask('test', ['build', 'n']);
49+
grunt.registerTask('build', [
50+
'jshint'
51+
]);
52+
grunt.registerTask('go', ['build', 'watch:dist']);
53+
grunt.registerTask('default', ['build']);
54+
};

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2014 js-data
3+
Copyright (c) 2014 Jason Dobry
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 83 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,84 @@
1-
js-data-rethinkdb
2-
=================
1+
<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" />
32

4-
RethinkDB adapter for js-data
3+
## js-data-rethinkdb
4+
5+
RethinkDB adapter for [js-data](http://www.js-data.io/js-data).
6+
7+
## API Documentation
8+
[DSRethinkDBAdapter](https://github.com/js-data/js-data/wiki/DSRethinkDBAdapter)
9+
10+
## Demo
11+
[https://js-data-rethinkdb.firebaseapp.com/](https://js-data-rethinkdb.firebaseapp.com/)
12+
13+
## Project Status
14+
15+
| Branch | Master |
16+
| ------ | ------ |
17+
| Bower | [![Bower version](https://badge.fury.io/bo/js-data-rethinkdb.png)](http://badge.fury.io/bo/js-data-rethinkdb) |
18+
| NPM | [![NPM version](https://badge.fury.io/js/js-data-rethinkdb.png)](http://badge.fury.io/js/js-data-rethinkdb) |
19+
| Build Status | [![Build Status](https://travis-ci.org/js-data/js-data-rethinkdb.png?branch=master)](https://travis-ci.org/js-data/js-data-rethinkdb) |
20+
| Code Climate | [![Code Climate](https://codeclimate.com/github/js-data/js-data-rethinkdb.png)](https://codeclimate.com/github/js-data/js-data-rethinkdb) |
21+
| Dependency Status | [![Dependency Status](https://gemnasium.com/js-data/js-data-rethinkdb.png)](https://gemnasium.com/js-data/js-data-rethinkdb) |
22+
| Coverage | [![Coverage Status](https://coveralls.io/repos/js-data/js-data-rethinkdb/badge.png?branch=master)](https://coveralls.io/r/js-data/js-data-rethinkdb?branch=master) |
23+
24+
## Quick Start
25+
`bower install --save rethinkdbdash js-data js-data-rethinkdb` or `npm install --save rethinkdbdash js-data js-data-rethinkdb`.
26+
27+
Load Mozilla's `rethinkdbdash.js`.
28+
29+
Load `js-data-rethinkdb.js` after `js-data.js`.
30+
31+
```js
32+
var adapter = new DSRethinkDBAdapter();
33+
34+
var store = new JSData.DS();
35+
store.registerAdapter('rethinkdb', adapter, { default: true });
36+
37+
// "store" will now use the RethinkDB adapter for all async operations
38+
```
39+
40+
## Changelog
41+
[CHANGELOG.md](https://github.com/js-data/js-data-rethinkdb/blob/master/CHANGELOG.md)
42+
43+
## Community
44+
- [Mailing List](https://groups.io/org/groupsio/jsdata) - Ask your questions!
45+
- [Issues](https://github.com/js-data/js-data-rethinkdb/issues) - Found a bug? Feature request? Submit an issue!
46+
- [GitHub](https://github.com/js-data/js-data-rethinkdb) - View the source code for js-data.
47+
- [Contributing Guide](https://github.com/js-data/js-data-rethinkdb/blob/master/CONTRIBUTING.md)
48+
49+
## Contributing
50+
51+
First, feel free to contact me with questions. [Mailing List](https://groups.io/org/groupsio/jsdata). [Issues](https://github.com/js-data/js-data-rethinkdb/issues).
52+
53+
1. Contribute to the issue that is the reason you'll be developing in the first place
54+
1. Fork js-data-rethinkdb
55+
1. `git clone https://github.com/<you>/js-data-rethinkdb.git`
56+
1. `cd js-data-rethinkdb; npm install; bower install;`
57+
1. `grunt go` (builds and starts a watch)
58+
1. (in another terminal) `grunt karma:dev` (runs the tests)
59+
1. Write your code, including relevant documentation and tests
60+
1. Submit a PR and we'll review
61+
62+
## License
63+
64+
The MIT License (MIT)
65+
66+
Copyright (c) 2014 Jason Dobry
67+
68+
Permission is hereby granted, free of charge, to any person obtaining a copy
69+
of this software and associated documentation files (the "Software"), to deal
70+
in the Software without restriction, including without limitation the rights
71+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
72+
copies of the Software, and to permit persons to whom the Software is
73+
furnished to do so, subject to the following conditions:
74+
75+
The above copyright notice and this permission notice shall be included in all
76+
copies or substantial portions of the Software.
77+
78+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
79+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
80+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
81+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
82+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
83+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
84+
SOFTWARE.

mocha.start.js

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*global assert:true */
2+
'use strict';
3+
4+
var assert = require('chai').assert;
5+
var mocha = require('mocha');
6+
var sinon = require('sinon');
7+
var DSRethinkDBAdapter = require('./');
8+
var JSData = require('js-data');
9+
10+
var adapter, store, DSUtils, DSErrors, User;
11+
12+
var globals = module.exports = {
13+
fail: function (msg) {
14+
assert.equal('should not reach this!: ' + msg, 'failure');
15+
},
16+
TYPES_EXCEPT_STRING: [123, 123.123, null, undefined, {}, [], true, false, function () {
17+
}],
18+
TYPES_EXCEPT_STRING_OR_ARRAY: [123, 123.123, null, undefined, {}, true, false, function () {
19+
}],
20+
TYPES_EXCEPT_STRING_OR_NUMBER: [null, undefined, {}, [], true, false, function () {
21+
}],
22+
TYPES_EXCEPT_STRING_OR_OBJECT: [123, 123.123, null, undefined, [], true, false, function () {
23+
}],
24+
TYPES_EXCEPT_STRING_OR_NUMBER_OBJECT: [null, undefined, [], true, false, function () {
25+
}],
26+
TYPES_EXCEPT_STRING_OR_ARRAY_OR_NUMBER: [null, undefined, {}, true, false, function () {
27+
}],
28+
TYPES_EXCEPT_NUMBER: ['string', null, undefined, {}, [], true, false, function () {
29+
}],
30+
TYPES_EXCEPT_OBJECT: ['string', 123, 123.123, null, undefined, true, false, function () {
31+
}],
32+
TYPES_EXCEPT_BOOLEAN: ['string', 123, 123.123, null, undefined, {}, [], function () {
33+
}],
34+
TYPES_EXCEPT_FUNCTION: ['string', 123, 123.123, null, undefined, {}, [], true, false],
35+
assert: assert,
36+
sinon: sinon,
37+
adapter: undefined
38+
};
39+
40+
var test = new mocha();
41+
42+
var testGlobals = [];
43+
44+
for (var key in globals) {
45+
global[key] = globals[key];
46+
testGlobals.push(globals[key]);
47+
}
48+
test.globals(testGlobals);
49+
50+
beforeEach(function () {
51+
store = new JSData.DS();
52+
adapter = new DSRethinkDBAdapter({
53+
min: 10,
54+
max: 50,
55+
bufferSize: 10
56+
});
57+
DSUtils = JSData.DSUtils;
58+
DSErrors = JSData.DSErrors;
59+
globals.User = global.User = User = store.defineResource('user');
60+
61+
globals.adapter = adapter;
62+
global.adapter = globals.adapter;
63+
64+
globals.DSUtils = DSUtils;
65+
global.DSUtils = globals.DSUtils;
66+
67+
globals.DSErrors = DSErrors;
68+
global.DSErrors = globals.DSErrors;
69+
});
70+
71+
afterEach(function (done) {
72+
globals.adapter = null;
73+
global.adapter = null;
74+
75+
adapter.destroyAll(User, {}).then(function () {
76+
done();
77+
}, done);
78+
});

0 commit comments

Comments
 (0)