Skip to content

Commit 1c73cb6

Browse files
author
☮ elf Pavlik ☮
committed
Merge pull request #2 from elf-pavlik/feature/browserify
* [x] testing with zuul * [x] testing Travis + Sauce Labs * [x] browserified version in `./build/` * [x] register with bower and add bower.json * [x] update README
2 parents 40f39e1 + 7f1b719 commit 1c73cb6

File tree

9 files changed

+9839
-11
lines changed

9 files changed

+9839
-11
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ npm-debug.log
1717
docs
1818
.DS_Store
1919
coverage/
20+
bower_components

.travis.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
language: node_js
22
node_js:
3-
- 0.10
3+
- 0.10
44
script:
55
- npm run coverage
66
- npm run publish-coverage
7+
- test $SAUCE_USERNAME && npm run zuul || echo 'not running on saucelabs'
8+
env:
9+
global:
10+
- secure: TXxHtCdOAk9AQRyntLTCRLP968OVX3V25bkAKmJvIDbppvuqwftQ+HbsyeuWY/QiTXSpDIis6yoq+3JVtP344IVMHn9gZg22n4idVfHL9TKzcJn0C6Sio49SKFbxKXL7PXIBiceGCyPHO0l8ljA7lt6PFLYpgHmKVYMsotpi+v4=
11+
- secure: n4I3ob/P48gYkjgFx8MtRRH0LaxySd6kjviTQgf7nd/H7bIolpyPcbiaATiaZMGHM7t91qUDEb7ovVK85jX4gO1p2RtKNEEGIGTsGTtiZCCGi14chgsMlAmYrYeBPhfsiv496kmqwTeV2KExnSi+XN6cwvIOfY+g4JYnVd2s7LM=

.zuul.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
ui: mocha-bdd
2+
browsers:
3+
- name: chrome
4+
version: 27..latest
5+
- name: firefox
6+
version: 21..latest
7+
- name: opera
8+
version: 15..latest

README.md

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,61 @@ LevelGraph-N3
66
[![Build Status](https://travis-ci.org/mcollina/levelgraph-n3.png)](https://travis-ci.org/mcollina/levelgraph-n3)
77
[![Coverage Status](https://coveralls.io/repos/mcollina/levelgraph-n3/badge.png)](https://coveralls.io/r/mcollina/levelgraph-n3)
88
[![Dependency Status](https://david-dm.org/mcollina/levelgraph-n3.png?theme=shields.io)](https://david-dm.org/mcollina/levelgraph-n3)
9+
[![Sauce Labs
10+
Tests](https://saucelabs.com/browser-matrix/levelgraph-n3.svg)](https://saucelabs.com/u/levelgraph-n3)
911

1012
__LevelGraph-N3__ is a plugin for
1113
[LevelGraph](http://github.com/mcollina/levelgraph) that adds the
1214
ability to store, fetch and process N3 and turtle files.
1315

14-
## Install on Node.js
16+
## Install
1517

18+
### Node.js
19+
20+
Adding support for N3 to LevelGraph is easy:
1621
```shell
1722
$ npm install levelgraph levelgraph-n3 --save
1823
```
24+
Then in your code:
25+
```js
26+
var levelgraph = require('levelgraph'),
27+
levelgraphN3 = require('levelgraph-n3'),
28+
db = levelgraphN3(levelgraph('yourdb'));
29+
```
30+
1931

2032
At the moment it requires node v0.10.x, but the port to node v0.8.x
2133
should be straighforward.
2234
If you need it, just open a pull request.
2335

24-
## Install in the Browser
36+
### Browser
37+
38+
If you use [browserify](http://browserify.org/) you can use this package
39+
in a browser just as in node.js. Please also take a look at [Browserify
40+
section in LevelGraph package](https://github.com/mcollina/levelgraph#browserify)
2541

26-
TO BE DONE!
42+
You can also use standalone browserified version from `./build`
43+
directory or use [bower](http://bower.io)
44+
45+
```shell
46+
$ bower install levelgraph-n3 --save
47+
```
48+
It will also install its dependency levelgraph! Now you can simply:
49+
50+
```html
51+
<script src="bower_components/levelgraph/build/levelgraph.js"></script>
52+
<script src="bower_components/levelgraph-n3/build/levelgraph-n3.js"></script>
53+
<script>
54+
var db = levelgraphN3(levelgraph('yourdb'));
55+
</script>
56+
```
2757

2858
## Usage
2959

30-
Adding support for N3 to LevelGraph is easy:
60+
We assume in following examples that you created database as explained
61+
above!
3162
```js
32-
var levelgraph = require("levelgraph"),
33-
n3 = require("levelgraph-n3"),
34-
db = n3(levelgraph("yourdb"));
63+
var db = levelgraphN3(levelgraph("yourdb"));
3564
```
3665

3766
### Importing n3 files

bower.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"name": "levelgraph-n3",
3+
"version": "0.3.1",
4+
"main": "build/levelgraph-n3.js",
5+
"dependencies": {
6+
"levelgraph": "~0.8.2"
7+
}
8+
}

browserify.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#! /bin/sh
2+
3+
rm -rf build
4+
mkdir build
5+
./node_modules/.bin/browserify -s levelgraphN3 index.js > build/levelgraph-n3.js
6+
./node_modules/.bin/uglifyjs build/levelgraph-n3.js > build/levelgraph-n3.min.js
7+
du -h build/*

0 commit comments

Comments
 (0)