Skip to content

Commit 5c53b77

Browse files
committed
feat(update): add option to disable restart on update
closes TryGhost#481 - add a --no-restart option to the update command that skips the restart task
1 parent d8b6e0f commit 5c53b77

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

lib/commands/update.js

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class UpdateCommand extends Command {
6969
task: migrate
7070
}, {
7171
title: 'Restarting Ghost',
72+
skip: () => !argv.restart,
7273
task: this.restart.bind(this)
7374
}, {
7475
title: 'Removing old Ghost versions',
@@ -192,6 +193,11 @@ UpdateCommand.options = {
192193
alias: 'f',
193194
description: 'Force Ghost to update',
194195
type: 'boolean'
196+
},
197+
restart: {
198+
description: '[--no-restart] Enable/Disable restarting Ghost after updating',
199+
type: 'boolean',
200+
default: true
195201
}
196202
};
197203

test/unit/commands/update-spec.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ describe('Unit: Commands > Update', function () {
169169
const removeOldVersionsStub = sinon.stub(cmdInstance, 'removeOldVersions');
170170
const runCommandStub = sinon.stub(cmdInstance, 'runCommand').resolves();
171171

172-
return cmdInstance.run({version: '1.1.0', rollback: false, force: false}).then(() => {
172+
return cmdInstance.run({version: '1.1.0', rollback: false, force: false, restart: true}).then(() => {
173173
cwdStub.restore();
174174

175175
expect(runCommandStub.calledOnce).to.be.true;
@@ -225,7 +225,7 @@ describe('Unit: Commands > Update', function () {
225225
const removeOldVersionsStub = sinon.stub(cmdInstance, 'removeOldVersions');
226226
const runCommandStub = sinon.stub(cmdInstance, 'runCommand').resolves();
227227

228-
return cmdInstance.run({rollback: true, force: false, zip: ''}).then(() => {
228+
return cmdInstance.run({rollback: true, force: false, zip: '', restart: true}).then(() => {
229229
cwdStub.restore();
230230

231231
const expectedCtx = {
@@ -290,7 +290,7 @@ describe('Unit: Commands > Update', function () {
290290
const runCommandStub = sinon.stub(cmdInstance, 'runCommand').resolves();
291291

292292

293-
return cmdInstance.run({rollback: true, force: false, zip: ''}).then(() => {
293+
return cmdInstance.run({rollback: true, force: false, zip: '', restart: true}).then(() => {
294294
cwdStub.restore();
295295
const expectedCtx = {
296296
version: '1.0.0',

0 commit comments

Comments
 (0)