0.2.0 • Published 8 years ago

sourcejs-comments v0.2.0

Weekly downloads
29
License
-
Repository
github
Last release
8 years ago

Comments plugin

Comments plugin for SourceJS for commenting Spec examples.

image

Compatible with SourceJS v.0.5.6+.


To install, run npm in sourcejs/user folder:

npm install sourcejs-comments --save

Then run build command in SourceJS root:

cd sourcejs
npm run build

After installation, all your Specs pages will have "Add description" tumbler in inner menu, that will active the plugin.

Dependencies

MongoDB

As MongoDB is not essential dependency for SourceJS, you must install it separately, to work with plugins that expect data storage.

Install MongoDB locally or get it from MongoLab and configure your SourceJS in sourcejs/user/options.js:

core: {
  "production": {
    "host": "localhost",
    "dbName": "sourcejs"
  }
}

Host could point to remote service. Database name could be custom as well.

Connect to DB from app

Then prepare mongoose dependency - as it must be common for every plugins, install it in sourcejs/user

npm install mongoose --save

And edit /sourcejs/user/core/app.js, that extends main SourceJS application. Just add this code snippet, for connection to database:

/* Connect to DB */
var mongoose = require('mongoose');

var dbAdress = 'mongodb://' + global.opts.core.production.host + '/' + global.opts.core.production.dbName;

mongoose.connection.on("connecting", function() {
    return console.log("Started connection on " + (dbAdress).cyan + ", waiting for it to open...".grey);
});
mongoose.connection.on("open", function() {
    return console.log("MongoDB connection opened!".green);
});
mongoose.connection.on("error", function(err) {
    console.log("Could not connect to mongo server!".red);
    return console.log(err.message.red);
});

mongoose.connect(dbAdress);
/* /Connect to DB */

Legacy versions

For SourceJS v0.3.* use older plugin version 0.0.x.

0.2.0

8 years ago

0.1.8

9 years ago

0.1.7

9 years ago

0.1.6

9 years ago

0.1.5

9 years ago

0.1.4

9 years ago