Created
November 6, 2012 01:08
-
-
Save richtera/4021763 to your computer and use it in GitHub Desktop.
Failure with jugglingdb...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
. | |
. | |
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