Skip to content

Commit

Permalink
Merge pull request #21 from fiddur/develop
Browse files Browse the repository at this point in the history
Release 0.4.0
  • Loading branch information
fiddur committed Oct 28, 2015
2 parents 0f4292a + 05ccdcd commit 9d19983
Show file tree
Hide file tree
Showing 40 changed files with 1,718 additions and 952 deletions.
2 changes: 1 addition & 1 deletion .jscs.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"preset": "google",
"preset": "google",
"maximumLineLength": 100
}
11 changes: 8 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
language: node_js
node_js:
- "0.10"
- "0.12"
- "v4.0.0"
- "iojs"
env:
- CXX=g++-4.8
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
before_install: npm install -g grunt-cli
35 changes: 10 additions & 25 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,14 @@
var orm = require('orm')
var MigrationTask = require('migrate-orm2')

var async = require('asyncawait/async')
var await = require('asyncawait/await')

var Knex = require('knex')
var config

runMigration = function (operation, grunt, done) {
orm.settings.set('connection.debug', true)
orm.connect(config.database, function (err, connection) {
if (err) throw(err)

console.log('Running on db:', config.database)
var migrationTask = new MigrationTask(connection.driver, {dir: 'data/migrations'})
migrationTask[operation](grunt.option('file'), done)
})
}
runMigration = async(function(done) {
var knex = Knex(config.database)
await(knex.migrate.latest())
done()
})

module.exports = function(grunt) {

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

grunt.registerTask('migrate:generate', '', function () {
var done = this.async()
runMigration('generate', grunt, done)
})

grunt.registerTask('migrate:up', '', function () {
var done = this.async()
runMigration('up', grunt, done)
})

grunt.registerTask('migrate:down', '', function () {
grunt.registerTask('migrate', '', function () {
var done = this.async()
runMigration('down', grunt, done)
runMigration(done)
})
}
1 change: 0 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ node_modules:
test-prepare:
rm -fr build
mkdir build
grunt --config ./config.js.test migrate:up

test: test-prepare
@./node_modules/.bin/mocha
Expand Down
65 changes: 51 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
Some comments
=============

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

Aims to become a free standing commenting system that you attach by including javascript. I need
this because Ghost has no commenting function and I don't want ads funded commenting, nor tie it to
one specific social platform.
**Some comments** is stand-alone commenting microservice that you could attach by including
javascript.

This was initially constructed because Ghost has no built in commenting functionality and I don't
want ads funded commenting, nor tie it to one specific social platform.

Commenters can authenticate via 3rd party authentication like openid, google, facebook etc, or
comment anonymously.

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


Features
Expand Down Expand Up @@ -53,7 +56,8 @@ And, add the css:
Install (server)
----------------

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

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

### Database

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

To use a backend, simply install it:

Expand All @@ -181,17 +185,19 @@ npm install sqlite3

…and use it in your config:
```javascript
database: 'sqlite:///var/lib/some-comments.db'
database: {
client: 'sqlite3',
connection: {
filename: "/var/lib/some-comments.db"
}
}
```

…and run the migrations:
```
DB_URL=sqlite:///var/lib/some-comments.db ./node_modules/.bin/migrate up
grunt migrate:up
```

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


### E-mail notifications

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


Contributing
------------

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


Changelog
---------

### 0.4.0

**Upgrade from 0.3**:

1. Update config (`database` format changed to [Knex](http://knexjs.org/))
2. `node migrate0.3.0-0.4.0.js`

* #19: Edit/delete own comments.
* Changing ORM again (using objection.js, but thinking about ditching that and only using knex).
* Using Bluebird for promises.
* **Required node >= 4** - This is a microservice, does not need to be compatible with old
interpreters!

Use with caution; I haven't tested the Dynamic OpenID Connect authentication in this version.


### 0.3.0

**Upgrade from 0.2**: `grunt migrate:up`
Expand Down
12 changes: 11 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
Todo
====

* Display error message when trying to add site as "Anonymous".
General
-------

* Get nicer looking edit/delete icons?
* Auto-test oidc dynamic auth.
* Move authentication.js to routes.
* Use express router consistently.
* Reasonable logging.
* Error handling.
Expand All @@ -12,3 +17,8 @@ Todo
* User page where you can add or merge authorization accounts.
* I18N
* Validate config for easier setup/upgrade.
* Switch from supertest to request-promise.
* Consistent ES6 usage: const, let, arrow-lambdas…
* Remove Q from test/routes.
* Remove Q from frontend.
* Use `request-promise` in test, rather than `supertest`.
Loading

0 comments on commit 9d19983

Please sign in to comment.