Skip to content

Commit 9d19983

Browse files
committed
Merge pull request #21 from fiddur/develop
Release 0.4.0
2 parents 0f4292a + 05ccdcd commit 9d19983

40 files changed

+1718
-952
lines changed

.jscs.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"preset": "google",
2+
"preset": "google",
33
"maximumLineLength": 100
44
}

.travis.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
language: node_js
22
node_js:
3-
- "0.10"
4-
- "0.12"
53
- "v4.0.0"
6-
- "iojs"
4+
env:
5+
- CXX=g++-4.8
6+
addons:
7+
apt:
8+
sources:
9+
- ubuntu-toolchain-r-test
10+
packages:
11+
- g++-4.8
712
before_install: npm install -g grunt-cli

Gruntfile.js

Lines changed: 10 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,14 @@
1-
var orm = require('orm')
2-
var MigrationTask = require('migrate-orm2')
3-
1+
var async = require('asyncawait/async')
2+
var await = require('asyncawait/await')
43

4+
var Knex = require('knex')
55
var config
66

7-
runMigration = function (operation, grunt, done) {
8-
orm.settings.set('connection.debug', true)
9-
orm.connect(config.database, function (err, connection) {
10-
if (err) throw(err)
11-
12-
console.log('Running on db:', config.database)
13-
var migrationTask = new MigrationTask(connection.driver, {dir: 'data/migrations'})
14-
migrationTask[operation](grunt.option('file'), done)
15-
})
16-
}
7+
runMigration = async(function(done) {
8+
var knex = Knex(config.database)
9+
await(knex.migrate.latest())
10+
done()
11+
})
1712

1813
module.exports = function(grunt) {
1914

@@ -24,18 +19,8 @@ module.exports = function(grunt) {
2419
config = require('./config.js')
2520
}
2621

27-
grunt.registerTask('migrate:generate', '', function () {
28-
var done = this.async()
29-
runMigration('generate', grunt, done)
30-
})
31-
32-
grunt.registerTask('migrate:up', '', function () {
33-
var done = this.async()
34-
runMigration('up', grunt, done)
35-
})
36-
37-
grunt.registerTask('migrate:down', '', function () {
22+
grunt.registerTask('migrate', '', function () {
3823
var done = this.async()
39-
runMigration('down', grunt, done)
24+
runMigration(done)
4025
})
4126
}

Makefile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ node_modules:
99
test-prepare:
1010
rm -fr build
1111
mkdir build
12-
grunt --config ./config.js.test migrate:up
1312

1413
test: test-prepare
1514
@./node_modules/.bin/mocha

README.md

Lines changed: 51 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
11
Some comments
22
=============
33

4-
[![Build Status](https://travis-ci.org/fiddur/some-comments.svg)](https://travis-ci.org/fiddur/some-comments)
5-
[![Coverage Status](https://coveralls.io/repos/fiddur/some-comments/badge.svg)](https://coveralls.io/r/fiddur/some-comments)
4+
[![Build Status](https://travis-ci.org/fiddur/some-comments.svg?branch=master)](https://travis-ci.org/fiddur/some-comments)
5+
[![Coverage Status](https://coveralls.io/repos/fiddur/some-comments/badge.svg?branch=master&service=github)](https://coveralls.io/r/fiddur/some-comments?branch=master)
66

7-
Aims to become a free standing commenting system that you attach by including javascript. I need
8-
this because Ghost has no commenting function and I don't want ads funded commenting, nor tie it to
9-
one specific social platform.
7+
**Some comments** is stand-alone commenting microservice that you could attach by including
8+
javascript.
9+
10+
This was initially constructed because Ghost has no built in commenting functionality and I don't
11+
want ads funded commenting, nor tie it to one specific social platform.
12+
13+
Commenters can authenticate via 3rd party authentication like openid, google, facebook etc, or
14+
comment anonymously.
1015

11-
All the commenters have to authenticate via 3rd party authentication like openid, google, facebook
12-
etc; currently anything that "passport" supports.
1316

1417

1518
Features
@@ -53,7 +56,8 @@ And, add the css:
5356
Install (server)
5457
----------------
5558

56-
This is tested on Node 0.10, 0.12, and v4.0.0, and io.js.
59+
**Some comments** requires Node v4 or higher! I suggest using
60+
[nvm](https://github.com/creationix/nvm).
5761

5862
```
5963
git clone https://github.com/fiddur/some-comments.git
@@ -171,7 +175,7 @@ Callback URI will be `http(s)://domain/auth/facebook/callback`.
171175

172176
### Database
173177

174-
Anything that [node-orm2](https://github.com/dresende/node-orm2) supports.
178+
Anything that [Knex](http://knexjs.org/) supports.
175179

176180
To use a backend, simply install it:
177181

@@ -181,17 +185,19 @@ npm install sqlite3
181185

182186
…and use it in your config:
183187
```javascript
184-
database: 'sqlite:///var/lib/some-comments.db'
188+
database: {
189+
client: 'sqlite3',
190+
connection: {
191+
filename: "/var/lib/some-comments.db"
192+
}
193+
}
185194
```
186195

187196
…and run the migrations:
188197
```
189-
DB_URL=sqlite:///var/lib/some-comments.db ./node_modules/.bin/migrate up
198+
grunt migrate:up
190199
```
191200

192-
Whatever is in `config.database` will be passed on to
193-
[orm.connect](https://github.com/dresende/node-orm2/wiki/Connecting-to-Database).
194-
195201

196202
### E-mail notifications
197203

@@ -218,9 +224,40 @@ could for example `npm install nodemailer-sendmail-transport` and in config put
218224
require('nodemailer-sendmail-transport')(options)`.
219225

220226

227+
Contributing
228+
------------
229+
230+
* Comment on issue to let others know you started implementing something. Discuss data & code
231+
design on the issue.
232+
* Use [gitflow](https://github.com/nvie/gitflow) branching model - make pull requests toward the
233+
`develop` branch.
234+
* Use jscs for code formatting.
235+
* Skip unnecessary semicolons.
236+
* Use ES6 `const`, `=>`, prefer `async/await` before explicit promises.
237+
* Make sure new code is tested both with relevant unit tests and integration tests.
238+
* Make sure there are working migrations from older versions.
239+
* See [TODO](TODO.md) for refactorings waiting to happen…
240+
241+
221242
Changelog
222243
---------
223244

245+
### 0.4.0
246+
247+
**Upgrade from 0.3**:
248+
249+
1. Update config (`database` format changed to [Knex](http://knexjs.org/))
250+
2. `node migrate0.3.0-0.4.0.js`
251+
252+
* #19: Edit/delete own comments.
253+
* Changing ORM again (using objection.js, but thinking about ditching that and only using knex).
254+
* Using Bluebird for promises.
255+
* **Required node >= 4** - This is a microservice, does not need to be compatible with old
256+
interpreters!
257+
258+
Use with caution; I haven't tested the Dynamic OpenID Connect authentication in this version.
259+
260+
224261
### 0.3.0
225262

226263
**Upgrade from 0.2**: `grunt migrate:up`

TODO.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
Todo
22
====
33

4-
* Display error message when trying to add site as "Anonymous".
4+
General
5+
-------
6+
7+
* Get nicer looking edit/delete icons?
8+
* Auto-test oidc dynamic auth.
9+
* Move authentication.js to routes.
510
* Use express router consistently.
611
* Reasonable logging.
712
* Error handling.
@@ -12,3 +17,8 @@ Todo
1217
* User page where you can add or merge authorization accounts.
1318
* I18N
1419
* Validate config for easier setup/upgrade.
20+
* Switch from supertest to request-promise.
21+
* Consistent ES6 usage: const, let, arrow-lambdas…
22+
* Remove Q from test/routes.
23+
* Remove Q from frontend.
24+
* Use `request-promise` in test, rather than `supertest`.

0 commit comments

Comments
 (0)