Skip to content

Commit

Permalink
defer loading of knex-migrator until it's needed
Browse files Browse the repository at this point in the history
  • Loading branch information
acburdine committed Oct 18, 2016
1 parent 89229ba commit 79fb9b5
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/commands/start.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var KnexMigrator = require('knex-migrator'),
BaseCommand = require('./base');
var BaseCommand = require('./base');

module.exports = BaseCommand.extend({
name: 'start',
Expand Down Expand Up @@ -29,7 +28,7 @@ module.exports = BaseCommand.extend({
Promise = require('bluebird'),
path = require('path'),
self = this,
environment, config, pm, cliConfig, knexMigrator;
environment, config, pm, cliConfig;

options = options || {};
environment = (options.production || !options.development) ? 'production' : 'development';
Expand All @@ -46,6 +45,8 @@ module.exports = BaseCommand.extend({
// TODO: rethink this
return this.runCommand('config', 'paths.contentPath', path.join(process.cwd(), 'content'), {environment: environment})
.then(function () {
var KnexMigrator = require('knex-migrator'),
knexMigrator;
/**
* If we require any JS file from Ghost source code (for example the config), then it's always env-less!
*
Expand All @@ -67,8 +68,7 @@ module.exports = BaseCommand.extend({
.catch(function () {
return knexMigrator.init();
});
})
.then(function () {
}).then(function () {
return self.ui.run(
Promise.resolve(pm.start(process.cwd(), environment)),
'Starting Ghost instance'
Expand Down

0 comments on commit 79fb9b5

Please sign in to comment.