Skip to content

Instantly share code, notes, and snippets.

@richtera
Created November 6, 2012 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save richtera/4021763 to your computer and use it in GitHub Desktop.
Save richtera/4021763 to your computer and use it in GitHub Desktop.
Failure with jugglingdb...
.
.
.
function install(next) {
// Create the default content types
var Content = calipso.db.model('Content');
var defaults = {
status: 'published',
author: 'installation',
contentType: 'Block Content', // TO DO - this should be a helper function
layout: 'default',
ispublic: false,
created: new Date()
}
// Create all the default content
var welcome = JSON.parse(calipso.lib.fs.readFileSync(__dirname + '/defaults/welcome.json')),
about = JSON.parse(calipso.lib.fs.readFileSync(__dirname + '/defaults/about-me.json')),
article = JSON.parse(calipso.lib.fs.readFileSync(__dirname + '/defaults/article.json')),
wc = new Content(calipso.lib._.extend(defaults, welcome)),
ac = new Content(calipso.lib._.extend(defaults, about)),
art = new Content(calipso.lib._.extend(defaults, article));
calipso.lib.async.parallel([function(cb) { wc.save(cb) }, function(cb) { ac.save(cb) }, function(cb) { art.save(cb) }], function(err) {
// Allow event to fire
calipso.e.post_emit('CONTENT_UPDATE',art,function(artc) {});
// Done
calipso.info("Content module installed ... ");
next();
});
}
.
.
.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment