forked from TryGhost/Ghost-CLI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
restart.js
25 lines (20 loc) · 778 Bytes
/
restart.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
'use strict';
const Command = require('../command');
class RestartCommand extends Command {
run() {
const instance = this.system.getInstance();
const restart = (() => {
return instance.process.restart(process.cwd(), this.system.environment)
.then(() => {
return instance.process.ensureStarted(process.cwd(), this.system.environment);
});
});
if (!instance.running()) {
return Promise.reject(new Error('Ghost instance is not currently running.'));
}
instance.loadRunningEnvironment(true);
return this.ui.run(restart, 'Restarting Ghost');
}
}
RestartCommand.description = 'Restart the Ghost instance';
module.exports = RestartCommand;