mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-13 10:55:58 +03: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:
parent
511df8fde4
commit
d81d408eab
@ -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
2
app.js
@ -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..
|
||||
|
@ -63,6 +63,14 @@
|
||||
}
|
||||
},
|
||||
|
||||
travis: {
|
||||
client: 'sqlite3',
|
||||
connection: {
|
||||
filename: './core/shared/data/tests.db'
|
||||
},
|
||||
debug: true
|
||||
},
|
||||
|
||||
development: {
|
||||
client: 'sqlite3',
|
||||
connection: {
|
||||
|
@ -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();
|
||||
|
@ -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 = {
|
||||
|
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user