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:
parent
511df8fde4
commit
d81d408eab
@ -4,4 +4,6 @@ node_js:
|
|||||||
- "0.10"
|
- "0.10"
|
||||||
- "0.8"
|
- "0.8"
|
||||||
git:
|
git:
|
||||||
submodules: false
|
submodules: false
|
||||||
|
before_script:
|
||||||
|
- npm install -g grunt-cli
|
2
app.js
2
app.js
@ -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..
|
||||||
|
@ -63,6 +63,14 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
travis: {
|
||||||
|
client: 'sqlite3',
|
||||||
|
connection: {
|
||||||
|
filename: './core/shared/data/tests.db'
|
||||||
|
},
|
||||||
|
debug: true
|
||||||
|
},
|
||||||
|
|
||||||
development: {
|
development: {
|
||||||
client: 'sqlite3',
|
client: 'sqlite3',
|
||||||
connection: {
|
connection: {
|
||||||
|
@ -6,31 +6,44 @@
|
|||||||
(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 () {
|
|
||||||
// Simple bootstraping of the data model for now.
|
|
||||||
var migration = require('../data/migration/001');
|
|
||||||
|
|
||||||
return migration.down().then(function () {
|
if (options.autoInit) {
|
||||||
return migration.up();
|
this.init();
|
||||||
});
|
}
|
||||||
}).then(function () {
|
|
||||||
console.log('all done....');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return instance;
|
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.posts = new PostsProvider();
|
||||||
DataProvider.prototype.users = new UsersProvider();
|
DataProvider.prototype.users = new UsersProvider();
|
||||||
DataProvider.prototype.settings = new SettingsProvider();
|
DataProvider.prototype.settings = new SettingsProvider();
|
||||||
|
@ -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 = {
|
||||||
|
@ -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",
|
||||||
|
Loading…
Reference in New Issue
Block a user