From ef94f3b77833280d9d31300e862241f475c69cba Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Thu, 16 May 2013 22:16:09 +0100 Subject: [PATCH] closes #28 - reimplements posts with bookshelf This involves switching column names to snake_case which requires template updates in both the admin and in casper --- app.js | 22 +++-- config.js | 13 +++ core/admin/views/blog.hbs | 2 +- core/ghost.js | 9 +- core/shared/api.js | 2 - core/shared/data/fixtures/001.js | 67 +++++++++++++++ core/shared/data/migration/001.js | 75 +++++++++++++++++ core/shared/models/dataProvider.bookshelf.js | 86 ++++++++++++++++++++ core/shared/models/models.js | 86 ++++++++++++++++++++ package.json | 4 +- 10 files changed, 352 insertions(+), 14 deletions(-) create mode 100644 core/shared/data/fixtures/001.js create mode 100644 core/shared/data/migration/001.js create mode 100644 core/shared/models/dataProvider.bookshelf.js create mode 100644 core/shared/models/models.js diff --git a/app.js b/app.js index 96bf00053d..bf87e283f5 100644 --- a/app.js +++ b/app.js @@ -1,6 +1,6 @@ // # Ghost main app file -/*global require */ +/*global require, __dirname */ (function () { "use strict"; @@ -12,14 +12,17 @@ flash = require('connect-flash'), Ghost = require('./core/ghost'), I18n = require('./core/lang/i18n'), - helpers = require('./core/frontend/helpers'), - auth, + helpers = require('./core/frontend/helpers'); + + + + var auth, // ## Variables - /** - * Create new Ghost object - * @type {Ghost} - */ + /** + * Create new Ghost object + * @type {Ghost} + */ ghost = new Ghost(); ghost.app().configure('development', function () { @@ -78,4 +81,9 @@ ghost.app().listen(3333, function () { console.log("Express server listening on port " + 3333); }); +// }, function (e) { +// console.log(e.toString()); +// }).then(null, function (e) { +// console.log(e.stack); +// }); }()); \ No newline at end of file diff --git a/config.js b/config.js index 28875e22f6..1362072b76 100644 --- a/config.js +++ b/config.js @@ -55,6 +55,19 @@ */ config.homepage.posts = 4; + config.database = { + development: { + client: 'sqlite3', + connection: { + filename: './core/shared/data/testdb.db' + } + }, + + staging: {}, + + production: {} + }; + /** * @property {Object} exports */ diff --git a/core/admin/views/blog.hbs b/core/admin/views/blog.hbs index 39c36da632..f0aa9bbe0e 100644 --- a/core/admin/views/blog.hbs +++ b/core/admin/views/blog.hbs @@ -18,7 +18,7 @@
    {{#each posts}} {{! #if featured class="featured"{{/if}} -
  1. +