From 3e08d34017bfc7eb81c28e7a9b2b6081113f9390 Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Tue, 29 Sep 2015 12:01:05 -0700 Subject: [PATCH 01/15] Begin to migrate to soundtrack blog. --- config/index.js | 6 +++++- soundtrack:blog.js | 3 +++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 soundtrack:blog.js diff --git a/config/index.js b/config/index.js index 79b86d2..fec3d26 100644 --- a/config/index.js +++ b/config/index.js @@ -1,6 +1,10 @@ module.exports = { service: { - name: 'melody', + name: 'melodies', + synopsis: 'thoughts from soundtrack.io', icon: 'music' + }, + database: { + name: 'blog:soundtrack' } }; diff --git a/soundtrack:blog.js b/soundtrack:blog.js new file mode 100644 index 0000000..674097a --- /dev/null +++ b/soundtrack:blog.js @@ -0,0 +1,3 @@ +var melody = require('./'); + +melody.start(); From 6e9b84b55bd1fe7c5e5b7b114767584728a5925c Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Tue, 29 Sep 2015 12:02:24 -0700 Subject: [PATCH 02/15] Change port number for production. --- config/index.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/config/index.js b/config/index.js index fec3d26..87d43c0 100644 --- a/config/index.js +++ b/config/index.js @@ -6,5 +6,10 @@ module.exports = { }, database: { name: 'blog:soundtrack' + }, + services: { + http: { + port: 13005 + } } }; From 50e9158ee354347a4473b8af7f8b448057acb90b Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Tue, 29 Sep 2015 12:08:20 -0700 Subject: [PATCH 03/15] Switch database to soundtrack. --- config/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/index.js b/config/index.js index 87d43c0..2b20c3e 100644 --- a/config/index.js +++ b/config/index.js @@ -5,7 +5,7 @@ module.exports = { icon: 'music' }, database: { - name: 'blog:soundtrack' + name: 'soundtrack' }, services: { http: { From fd12028bb0dd07abbe4e8e0f86030f1e7c2972ce Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Tue, 29 Sep 2015 23:57:00 -0700 Subject: [PATCH 04/15] Add editing capabilities. --- lib/melody.js | 5 ++++- views/index.jade | 6 +++--- views/layouts/default.jade | 36 ++++++++++++++++++++++++++++++++++++ views/partials/post.jade | 13 ++++++++++--- 4 files changed, 53 insertions(+), 7 deletions(-) diff --git a/lib/melody.js b/lib/melody.js index a507f19..488a459 100644 --- a/lib/melody.js +++ b/lib/melody.js @@ -10,7 +10,10 @@ var passport = new Passport({ var Auth = require('maki-auth-simple'); var auth = new Auth({ - resource: 'People' + resource: 'People', + capabilities: { + 'write': ['admin'] + } }); melody.use(passport); diff --git a/views/index.jade b/views/index.jade index 27ea468..6689e67 100644 --- a/views/index.jade +++ b/views/index.jade @@ -3,9 +3,9 @@ extends layouts/default block content .ui.fluid.column .ui.grid - .row - .column - if (user) + if (user && user.capabilities && ~user.capabilities.indexOf('write')) + .row + .column include forms/post-create .row diff --git a/views/layouts/default.jade b/views/layouts/default.jade index d2dd590..4f1837a 100644 --- a/views/layouts/default.jade +++ b/views/layouts/default.jade @@ -45,4 +45,40 @@ html.no-js p small Built with Maki. + script. + $(document).on('click', '*[data-intent=edit]', function(e) { + e.preventDefault(); + + var $self = $(this); + + $.getJSON('/posts/'+$self.data('id'), function(post) { + var editFunction = _.debounce(submitEdits, 250); + + var $form = $('
'); + $form.find('textarea').val(post.content).on('keyup', editFunction); + + $('*[data-bind='+$self.data('target')+'][data-id='+$self.data('id')+']').replaceWith($form); + + function submitEdits() { + var content = $form.find('textarea').val(); + console.log('val:', content); + + $.ajax({ + type: 'patch', + url: '/posts/'+$self.data('id'), + dataType: 'json', + headers: { + Accept: 'application/json' + }, + data: { + content: content + } + }); + } + }); + + + return false; + }); + block scripts diff --git a/views/partials/post.jade b/views/partials/post.jade index 5f3bbcf..e51cec3 100644 --- a/views/partials/post.jade +++ b/views/partials/post.jade @@ -1,7 +1,14 @@ .ui.card.fluid .content - a.right.floated(href="/people/#{post._author.slug}") #{post._author.username} - h3.header #{post.title} + .right.floated + .ui.buttons + if (user && user.capabilities && ~user.capabilities.indexOf('write')) + a.ui.mini.button(href="#", data-intent="edit", data-target="post-description", data-id="#{post.slug}") + i.icon.edit + | edit + a.ui.mini.button(href="/people/#{post._author.slug}") #{post._author.username} + h3.header + a(href="/posts/#{post.slug}") #{post.title} .meta a(href="/posts/#{post.slug}") #{moment(post.created).fromNow()} - .description !{markdown(post.content)} + .description(data-bind="post-description", data-id="#{post.slug}") !{markdown(post.content)} From 3a7896539dac290a8762f1770c4d7ba9793eef14 Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Wed, 30 Sep 2015 00:04:27 -0700 Subject: [PATCH 05/15] General tidying. --- config/index.js | 1 + views/layouts/default.jade | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/config/index.js b/config/index.js index 2b20c3e..d1bc9e6 100644 --- a/config/index.js +++ b/config/index.js @@ -2,6 +2,7 @@ module.exports = { service: { name: 'melodies', synopsis: 'thoughts from soundtrack.io', + mission: 'thoughts from the soundtrack.io team.', icon: 'music' }, database: { diff --git a/views/layouts/default.jade b/views/layouts/default.jade index 4f1837a..40c417d 100644 --- a/views/layouts/default.jade +++ b/views/layouts/default.jade @@ -61,8 +61,7 @@ html.no-js function submitEdits() { var content = $form.find('textarea').val(); - console.log('val:', content); - + $.ajax({ type: 'patch', url: '/posts/'+$self.data('id'), From 50961e26fa1f265e75cd84f73d58ba910ee42704 Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Wed, 30 Sep 2015 00:53:58 -0700 Subject: [PATCH 06/15] Add analytics. --- views/layouts/default.jade | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/views/layouts/default.jade b/views/layouts/default.jade index 40c417d..f5ebd5e 100644 --- a/views/layouts/default.jade +++ b/views/layouts/default.jade @@ -79,5 +79,13 @@ html.no-js return false; }); + + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + + ga('create', 'UA-61803390-2', 'auto'); + ga('send', 'pageview'); block scripts From 6195a604d67816de230fc896fcc8fb4dddf6c49f Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Wed, 30 Sep 2015 00:56:40 -0700 Subject: [PATCH 07/15] Remove extras. --- views/partials/navbar.jade | 6 ------ 1 file changed, 6 deletions(-) diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade index 8b2e13a..7da5603 100644 --- a/views/partials/navbar.jade +++ b/views/partials/navbar.jade @@ -23,9 +23,3 @@ a.item(href="/", title="#{config.service.name} Homepage", ng-class="{ active: isActive('/')}") i.home.icon | Home - each resource in resources - if (!resource.internal) - a.item(href="#{resource.routes.query}") - if (resource.options.icon) - i.icon(class="#{resource.options.icon}") - | #{resource.plural} From 0459bebdd492594d961e7b2271a09b94a78a91fd Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Wed, 30 Sep 2015 17:22:26 -0700 Subject: [PATCH 08/15] Add navigation to main site from blog. --- views/partials/navbar.jade | 3 +++ 1 file changed, 3 insertions(+) diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade index 7da5603..bda7918 100644 --- a/views/partials/navbar.jade +++ b/views/partials/navbar.jade @@ -23,3 +23,6 @@ a.item(href="/", title="#{config.service.name} Homepage", ng-class="{ active: isActive('/')}") i.home.icon | Home + a.item(href="https://soundtrack.io/") + i.music.icon + | Music From 0bbf1db4e3996de526f4bc191af01975502afeb9 Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Wed, 30 Sep 2015 17:39:53 -0700 Subject: [PATCH 09/15] Add contact form. --- package.json | 3 ++- soundtrack:blog.js | 17 ++++++++++++++++- views/layouts/default.jade | 11 +++++++++++ 3 files changed, 29 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 2e8f58f..7d18b18 100644 --- a/package.json +++ b/package.json @@ -31,6 +31,7 @@ "dependencies": { "maki": "git://github.com/martindale/maki", "maki-auth-simple": "0.0.1", - "maki-passport-local": "0.0.4" + "maki-passport-local": "0.0.4", + "maki-remote": "0.0.1" } } diff --git a/soundtrack:blog.js b/soundtrack:blog.js index 674097a..931a95b 100644 --- a/soundtrack:blog.js +++ b/soundtrack:blog.js @@ -1,3 +1,18 @@ var melody = require('./'); +var Remote = require('maki-remote'); -melody.start(); +var MailPimpTask = new Remote('http://localhost:2525/tasks'); + +melody.start(function(err) { + melody.app.post('/contact', function(req, res, next) { + MailPimpTask.create({ + subject: 'soundtrack.io Contact Form', + recipient: 'eric@decentralize.fm', + sender: req.param('from'), + content: req.param('message') + }, function(err, task) { + req.flash('info', 'Mail sent successfully! We\'ll get in touch shortly.'); + res.redirect('/'); + }); + }); +}); diff --git a/views/layouts/default.jade b/views/layouts/default.jade index f5ebd5e..18690bf 100644 --- a/views/layouts/default.jade +++ b/views/layouts/default.jade @@ -39,6 +39,17 @@ html.no-js include ../partials/flash block content + + .row + form.ui.form(action="/contact", method="post") + .field + label Your Email Address + input(type="text", placeholder="you@example.com", name="from") + .field + label Your Message + textarea(name="message") + + button.ui.submit.button Send » .row .ui.one.column.stackable.center.aligned From 45d0b0cb2bbfeceb166fae019c65c5a0d9058a56 Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Wed, 30 Sep 2015 17:54:39 -0700 Subject: [PATCH 10/15] Add links, balance form. --- views/layouts/default.jade | 36 +++++++++++++++++++++++++++--------- 1 file changed, 27 insertions(+), 9 deletions(-) diff --git a/views/layouts/default.jade b/views/layouts/default.jade index 18690bf..ec8f1b6 100644 --- a/views/layouts/default.jade +++ b/views/layouts/default.jade @@ -41,15 +41,33 @@ html.no-js block content .row - form.ui.form(action="/contact", method="post") - .field - label Your Email Address - input(type="text", placeholder="you@example.com", name="from") - .field - label Your Message - textarea(name="message") - - button.ui.submit.button Send » + .column.eight.wide + h3 Get Connected + + h4 + i.icon.twitter + | Twitter + a(href="https://twitter.com/soundtrackio") @soundtrackio + + h4 + i.icon.github + | GitHub + a(href="https://github.com/martindale/soundtrack.io") martindale/soundtrack.io + + h4 ChangeTip + a(href="http://soundtrack.tip.me") soundtrack.tip.me + + .column.eight.wide + h3 Contact Us + form.ui.form(action="/contact", method="post") + .field + label Your Email Address + input(type="text", placeholder="you@example.com", name="from") + .field + label Your Message + textarea(name="message", rows="3") + + button.ui.submit.button.primary.right.floated Send » .row .ui.one.column.stackable.center.aligned From b2a60be25e96500ff84e12a1e2f50d91dafe3b91 Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Mon, 5 Oct 2015 16:43:43 -0700 Subject: [PATCH 11/15] Allow hoverable timestamps. --- views/partials/person.jade | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/views/partials/person.jade b/views/partials/person.jade index 39bde30..d6500b9 100644 --- a/views/partials/person.jade +++ b/views/partials/person.jade @@ -1,4 +1,5 @@ a.ui.card(href="/people/#{person.slug}") .content .header #{person.username} - .meta joined #{moment(person.created).fromNow()} + .meta joined + abbr.tooltipped(title="#{person.created}") #{moment(person.created).fromNow()} From 1b44354c367455fe5a538c0c6026f761eb79a2d8 Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Fri, 9 Oct 2015 20:44:46 -0700 Subject: [PATCH 12/15] Migrate to new version of maki-auth-simple. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 7d18b18..b93d378 100644 --- a/package.json +++ b/package.json @@ -30,7 +30,7 @@ "homepage": "https://github.com/martindale/melody", "dependencies": { "maki": "git://github.com/martindale/maki", - "maki-auth-simple": "0.0.1", + "maki-auth-simple": "0.1.1", "maki-passport-local": "0.0.4", "maki-remote": "0.0.1" } From 7e75338cefcfade6a6b030f81915bcded0f84a02 Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Sat, 10 Oct 2015 18:22:03 -0700 Subject: [PATCH 13/15] Actually fix Person resource. --- lib/melody.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/melody.js b/lib/melody.js index 488a459..4d01eaa 100644 --- a/lib/melody.js +++ b/lib/melody.js @@ -10,7 +10,10 @@ var passport = new Passport({ var Auth = require('maki-auth-simple'); var auth = new Auth({ - resource: 'People', + resource: 'Person', + // capabilities are named arrays of the roles that inherit them + // for example, `'write': ['admin']` indicates that anyone with the 'admin' + // role will inherit the 'write' capability, whatever you decide that means. capabilities: { 'write': ['admin'] } @@ -20,7 +23,9 @@ melody.use(passport); melody.use(auth); var Post = melody.define('Post', { - auth: ['admin'], + auth: { + 'create': 'admin' + }, attributes: { title: { type: String , max: 240 , slug: true }, content: { type: String }, From 35d27d6c7fd310c0b20f6977abbed6940edc8210 Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Tue, 29 Dec 2015 10:30:31 -0500 Subject: [PATCH 14/15] Package up and simplify initial setup. --- config/index.js | 21 +++++++++++++------ lib/melody.js | 28 +++++++++++++++---------- melody.js | 27 ++++++++++++++++++++++++ package.json | 8 ++++---- soundtrack:blog.js | 18 ---------------- views/layouts/default.jade | 42 ++------------------------------------ views/partials/navbar.jade | 3 --- 7 files changed, 65 insertions(+), 82 deletions(-) create mode 100644 melody.js delete mode 100644 soundtrack:blog.js diff --git a/config/index.js b/config/index.js index d1bc9e6..7e42327 100644 --- a/config/index.js +++ b/config/index.js @@ -1,16 +1,25 @@ module.exports = { service: { - name: 'melodies', - synopsis: 'thoughts from soundtrack.io', - mission: 'thoughts from the soundtrack.io team.', - icon: 'music' + name: 'Your Stream Name', // change this! + synopsis: 'Thoughts and musings from me.', // and this... + mission: 'Self-hosted writing and content sharing, powered by Maki', // also + icon: 'write' // pick from: http://semantic-ui.com/elements/icon.html + }, + config: { + allowPublicRegistration: false, // let other people register + characterLimit: false // set to a number, such as 140. + }, + users: { // users will be created on startup, password logged to console + 'admin': { // admin username will be 'admin', change if you'd like + roles: ['admin'] // what roles this user will have + } }, database: { - name: 'soundtrack' + name: 'melody' // only change if you know what you're doing }, services: { http: { - port: 13005 + port: 13005 // you might want this to be 80, or 3000 } } }; diff --git a/lib/melody.js b/lib/melody.js index 4d01eaa..3075f41 100644 --- a/lib/melody.js +++ b/lib/melody.js @@ -22,21 +22,27 @@ var auth = new Auth({ melody.use(passport); melody.use(auth); +var PostSchema = { + title: { type: String , max: 240 , slug: true }, + content: { type: String }, + created: { type: Date , default: Date.now }, + _author: { + type: melody.mongoose.SchemaTypes.ObjectId, + ref: 'Person', + populate: ['query', 'get'], + required: true + } +}; + +if (config.config.characterLimit) { + PostSchema.content.max = config.config.characterLimit; +} + var Post = melody.define('Post', { auth: { 'create': 'admin' }, - attributes: { - title: { type: String , max: 240 , slug: true }, - content: { type: String }, - created: { type: Date , default: Date.now }, - _author: { - type: melody.mongoose.SchemaTypes.ObjectId, - ref: 'Person', - populate: ['query', 'get'], - required: true - } - }, + attributes: PostSchema, icon: 'file text' }); diff --git a/melody.js b/melody.js new file mode 100644 index 0000000..a5aaf37 --- /dev/null +++ b/melody.js @@ -0,0 +1,27 @@ +var config = require('./config'); +var crypto = require('crypto'); +var melody = require('./lib/melody'); + +melody.start(function(err) { + var Person = melody.resources.Person; + var usernames = Object.keys(config.users); + + usernames.forEach(function(username) { + Person.get({ + username: username + }, function(err, person) { + if (err || person) return; + var user = config.users[username]; + var password = crypto.randomBytes(12).toString('base64'); + + user.username = username; + user.password = password; + + Person.create(user, function(err, person) { + if (err) return console.error(err); + console.log('Created user "'+person.username+'", password:', password); + }); + + }); + }); +}); diff --git a/package.json b/package.json index b93d378..904ffac 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "melody", - "version": "0.0.0", + "version": "0.1.0", "description": "simple publishing platform", - "main": "index.js", + "main": "lib/melody.js", "scripts": { "test": "mocha", "start": "node -e \"require('./').start()\"" @@ -29,9 +29,9 @@ }, "homepage": "https://github.com/martindale/melody", "dependencies": { + "async": "^1.5.0", "maki": "git://github.com/martindale/maki", "maki-auth-simple": "0.1.1", - "maki-passport-local": "0.0.4", - "maki-remote": "0.0.1" + "maki-passport-local": "0.0.4" } } diff --git a/soundtrack:blog.js b/soundtrack:blog.js deleted file mode 100644 index 931a95b..0000000 --- a/soundtrack:blog.js +++ /dev/null @@ -1,18 +0,0 @@ -var melody = require('./'); -var Remote = require('maki-remote'); - -var MailPimpTask = new Remote('http://localhost:2525/tasks'); - -melody.start(function(err) { - melody.app.post('/contact', function(req, res, next) { - MailPimpTask.create({ - subject: 'soundtrack.io Contact Form', - recipient: 'eric@decentralize.fm', - sender: req.param('from'), - content: req.param('message') - }, function(err, task) { - req.flash('info', 'Mail sent successfully! We\'ll get in touch shortly.'); - res.redirect('/'); - }); - }); -}); diff --git a/views/layouts/default.jade b/views/layouts/default.jade index ec8f1b6..c6c4c58 100644 --- a/views/layouts/default.jade +++ b/views/layouts/default.jade @@ -35,44 +35,14 @@ html.no-js .row .column.content(data-for="viewport") - include ../partials/flash - - block content - - .row - .column.eight.wide - h3 Get Connected - - h4 - i.icon.twitter - | Twitter - a(href="https://twitter.com/soundtrackio") @soundtrackio - - h4 - i.icon.github - | GitHub - a(href="https://github.com/martindale/soundtrack.io") martindale/soundtrack.io - - h4 ChangeTip - a(href="http://soundtrack.tip.me") soundtrack.tip.me - - .column.eight.wide - h3 Contact Us - form.ui.form(action="/contact", method="post") - .field - label Your Email Address - input(type="text", placeholder="you@example.com", name="from") - .field - label Your Message - textarea(name="message", rows="3") - button.ui.submit.button.primary.right.floated Send » + block content .row .ui.one.column.stackable.center.aligned p - small Built with Maki. + small powered by melody. script. $(document).on('click', '*[data-intent=edit]', function(e) { @@ -108,13 +78,5 @@ html.no-js return false; }); - - (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ - (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), - m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) - })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); - - ga('create', 'UA-61803390-2', 'auto'); - ga('send', 'pageview'); block scripts diff --git a/views/partials/navbar.jade b/views/partials/navbar.jade index bda7918..7da5603 100644 --- a/views/partials/navbar.jade +++ b/views/partials/navbar.jade @@ -23,6 +23,3 @@ a.item(href="/", title="#{config.service.name} Homepage", ng-class="{ active: isActive('/')}") i.home.icon | Home - a.item(href="https://soundtrack.io/") - i.music.icon - | Music From 007043727a75a98751c8c5ee9fc51ba5e3630ea3 Mon Sep 17 00:00:00 2001 From: Eric Martindale Date: Tue, 29 Dec 2015 10:49:03 -0500 Subject: [PATCH 15/15] Add tests, coverage, instructions. --- .coveralls.yml | 1 + .travis.yml | 6 ++++++ README.md | 19 +++++++++++++++++-- package.json | 10 ++++++++-- test/Melody.integration.js | 9 +++++++++ 5 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 .coveralls.yml create mode 100644 .travis.yml create mode 100644 test/Melody.integration.js diff --git a/.coveralls.yml b/.coveralls.yml new file mode 100644 index 0000000..9160059 --- /dev/null +++ b/.coveralls.yml @@ -0,0 +1 @@ +service_name: travis-ci diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..0f53bc1 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,6 @@ +language: node_js +node_js: +- '0.12' +services: + - mongodb +after_script: istanbul cover ./node_modules/mocha/bin/_mocha --report lcovonly -- -R spec && cat ./coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js && rm -rf ./coverage diff --git a/README.md b/README.md index 3d6e98d..0a39c9b 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,17 @@ -# blog.soundtrack.io -Simple blog for the soundtrack.io website. +melody +====== +[![Build Status](https://img.shields.io/travis/martindale/melody.svg?branch=master&style=flat-square)](https://travis-ci.org/martindale/melody) +[![Coverage Status](https://img.shields.io/coveralls/martindale/melody.svg?style=flat-square)](https://coveralls.io/r/martindale/melody) +[![Community](https://chat.maki.io/badge.svg)](https://chat.maki.io/) + +simple, self-hosted publishing platform. + +## Quick Start +After running `npm install`, simply type `npm start`. If it's your first time, +melody will automatically create an admin user and generate a random password. + +Extra config values, such as character limit and allowing public registrations, +are available in `config/index.js` for your convenience. + +## Hosting +We strongly recommend using `pm2` to manage melody in production. diff --git a/package.json b/package.json index 904ffac..6e59fb7 100644 --- a/package.json +++ b/package.json @@ -4,8 +4,9 @@ "description": "simple publishing platform", "main": "lib/melody.js", "scripts": { - "test": "mocha", - "start": "node -e \"require('./').start()\"" + "test": "NODE_ENV=test mocha --recursive", + "coverage": "NODE_ENV=test istanbul cover _mocha -- --recursive", + "start": "node melody.js" }, "repository": { "type": "git", @@ -33,5 +34,10 @@ "maki": "git://github.com/martindale/maki", "maki-auth-simple": "0.1.1", "maki-passport-local": "0.0.4" + }, + "devDependencies": { + "coveralls": "^2.11.6", + "istanbul": "^0.4.1", + "mocha": "^2.3.4" } } diff --git a/test/Melody.integration.js b/test/Melody.integration.js new file mode 100644 index 0000000..0925b89 --- /dev/null +++ b/test/Melody.integration.js @@ -0,0 +1,9 @@ +describe('Melody', function() { + this.timeout(5000); + describe('web server', function() { + it('should run', function(done) { + var melody = require('../lib/melody'); + melody.start(done); + }); + }); +});