redeploy static method
Future<void>
redeploy(
- Client cloudApiClient, {
- required CommandLogger logger,
- required String projectId,
Implementation
static Future<void> redeploy(
final Client cloudApiClient, {
required final CommandLogger logger,
required final String projectId,
}) async {
logger.init('Redeploying Serverpod Cloud project "$projectId".');
try {
await logger.progress(
'Requesting redeploy',
successMessage: 'Redeploy requested.',
padRight: StatusCommands.progressMessagePadLength,
newParagraph: true,
() async {
await cloudApiClient.capsules.redeployCapsule(
cloudCapsuleId: projectId,
);
return true;
},
);
} on NoPriorDeploymentException {
throw FailureException(
error: "This project hasn't been deployed yet.",
hint: 'Deploy it first with: scloud deploy',
);
} on NotFoundException catch (e) {
throw FailureException(error: e.message);
} on Exception catch (e, stackTrace) {
throw FailureException.nested(
e,
stackTrace,
'Redeploy failed. Please try again.',
);
}
logger.success(
'Redeploy started.',
followUp: 'Your changes take effect once the deployment finishes.',
newParagraph: true,
);
logger.terminalCommand(
'scloud status',
message: 'To view the deployment status, run this command:',
newParagraph: true,
);
}