Skip to content

Commit

Permalink
Fix Travis Errors
Browse files Browse the repository at this point in the history
- affects TryGhost#91
- Move dataProvider initialization outside constructor
- Add travis sqlite config that enables debug
- Add grunt-cli installation to travis before_script
  • Loading branch information
jgable committed May 29, 2013
1 parent 511df8f commit d81d408
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 18 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,6 @@ node_js:
- "0.10"
- "0.8"
git:
submodules: false
submodules: false
before_script:
- npm install -g grunt-cli

This comment has been minimized.

Copy link
@ErisDS

ErisDS May 29, 2013

nice :)

2 changes: 1 addition & 1 deletion app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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..
Expand Down
8 changes: 8 additions & 0 deletions config.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,14 @@
}
},

travis: {
client: 'sqlite3',
connection: {
filename: './core/shared/data/tests.db'
},
debug: true
},

development: {
client: 'sqlite3',
connection: {
Expand Down
39 changes: 26 additions & 13 deletions core/shared/models/dataProvider.bookshelf.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions core/test/ghost/helpers.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit d81d408

Please sign in to comment.