0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Fix Travis Errors

- affects #91
- Move dataProvider initialization outside constructor
- Add travis sqlite config that enables debug
- Add grunt-cli installation to travis before_script
This commit is contained in:
Jacob Gable 2013-05-29 13:26:08 -05:00
parent 511df8fde4
commit d81d408eab
6 changed files with 39 additions and 17 deletions

View file

@ -5,3 +5,5 @@ node_js:
- "0.8" - "0.8"
git: git:
submodules: false submodules: false
before_script:
- npm install -g grunt-cli

2
app.js
View file

@ -94,7 +94,7 @@
// Expose the promise we will resolve after our pre-loading // Expose the promise we will resolve after our pre-loading
ghost.loaded = loading.promise; ghost.loaded = loading.promise;
when.all([filters.loadCoreFilters(ghost), helpers.loadCoreHelpers(ghost)]).then(function () { when.all([ghost.dataProvider().init(), filters.loadCoreFilters(ghost), helpers.loadCoreHelpers(ghost)]).then(function () {
/** /**
* API routes.. * API routes..

View file

@ -63,6 +63,14 @@
} }
}, },
travis: {
client: 'sqlite3',
connection: {
filename: './core/shared/data/tests.db'
},
debug: true
},
development: { development: {
client: 'sqlite3', client: 'sqlite3',
connection: { connection: {

View file

@ -6,17 +6,33 @@
(function () { (function () {
"use strict"; "use strict";
var knex = require('./knex_init'), var _ = require('underscore'),
knex = require('./knex_init'),
PostsProvider = require('./dataProvider.bookshelf.posts'), PostsProvider = require('./dataProvider.bookshelf.posts'),
UsersProvider = require('./dataProvider.bookshelf.users'), UsersProvider = require('./dataProvider.bookshelf.users'),
SettingsProvider = require('./dataProvider.bookshelf.settings'), SettingsProvider = require('./dataProvider.bookshelf.settings'),
DataProvider, DataProvider,
instance; instance,
defaultOptions = {
autoInit: false
};
DataProvider = function (options) {
options = _.defaults(options || {}, defaultOptions);
DataProvider = function () {
if (!instance) { if (!instance) {
instance = this; instance = this;
knex.Schema.hasTable('posts').then(null, function () {
if (options.autoInit) {
this.init();
}
}
return instance;
};
DataProvider.prototype.init = function () {
return knex.Schema.hasTable('posts').then(null, function () {
// Simple bootstraping of the data model for now. // Simple bootstraping of the data model for now.
var migration = require('../data/migration/001'); var migration = require('../data/migration/001');
@ -24,11 +40,8 @@
return migration.up(); return migration.up();
}); });
}).then(function () { }).then(function () {
console.log('all done....'); console.log('DataProvider ready');
}); });
}
return instance;
}; };
DataProvider.prototype.posts = new PostsProvider(); DataProvider.prototype.posts = new PostsProvider();

View file

@ -1,8 +1,8 @@
(function () { (function () {
"use strict"; "use strict";
// Use 'testing' Ghost config // Use 'testing' Ghost config; unless we are running on travis (then show queries for debugging)
process.env.NODE_ENV = 'testing'; process.env.NODE_ENV = process.env.TRAVIS ? 'travis' : 'testing';
var knex = require('knex'), var knex = require('knex'),
migrations = { migrations = {

View file

@ -23,7 +23,6 @@
}, },
"devDependencies": { "devDependencies": {
"grunt": "~0.4.1", "grunt": "~0.4.1",
"grunt-cli": "0.1.9",
"grunt-jslint": "0.2.x", "grunt-jslint": "0.2.x",
"should": "~1.2.2", "should": "~1.2.2",
"grunt-mocha-test": "~0.4.0", "grunt-mocha-test": "~0.4.0",