Merge pull request #96 from jgable/fixTravisSqlLiteErrors

Fix Travis Errors
This commit is contained in:
Hannah Wolfe 2013-05-29 12:12:05 -07:00
commit 4571d05c76
6 changed files with 39 additions and 17 deletions

View File

@ -4,4 +4,6 @@ node_js:
- "0.10"
- "0.8"
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
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..

View File

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

View File

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

View File

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

View File

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