Home Manual Reference Source Test
import UpdateCommand from 'atscm-cli/src/cli/commands/Update.js'
public class | source

UpdateCommand

Extends:

Command → UpdateCommand

The command invoked by running "update".

Test:

Constructor Summary

Public Constructor
public

constructor(name: string, description: string)

Creates a new UpdateCommand with the specified name and description.

Method Summary

Public Methods
public

getLatestVersion(useBetaRelease: boolean): Promise<string>

Checks atscm's dist-tags in the npm registry and resolves with the latest version available.

public

This command always needs to be run inside an existant atscm project.

public

run(cli: AtSCMCli): Promise<*>

Updates atscm if a newer version is available.

public

update(cli: AtSCMCli, useBetaRelease: boolean): Promise<string, Error>

Runs npm install --save-dev atscm@latest in a separate process.

public

updateNeeded(latestVersion: string, currentVersion: string): boolean | string

Checks if an update is required with the given latest and current version.

Inherited Summary

From class Command
public get

The minimum and maximum number of (non-option) arguments the command handles.

public get

The options available for the command.

public get

If an error should be thrown for unknown arguments.

public get

Returns the usage string for the command.

public

The command descriptions.

public

The command's name.

private

The command's raw options.

public

Returns true if the command requires a Liftoff.Environment before it can be run.

public

run(cli: AtSCMCli)

Runs the command with the current Cli instance.

Public Constructors

public constructor(name: string, description: string) source

Creates a new UpdateCommand with the specified name and description.

Override:

Command#constructor

Params:

NameTypeAttributeDescription
name string

The command's name.

description string

The command's description.

Public Methods

public getLatestVersion(useBetaRelease: boolean): Promise<string> source

Checks atscm's dist-tags in the npm registry and resolves with the latest version available.

Params:

NameTypeAttributeDescription
useBetaRelease boolean
  • optional
  • default: false

If beta versions should be used.

Return:

Promise<string>

Fulfilled with the latest atscm version available.

Test:

public requiresEnvironment(): boolean source

This command always needs to be run inside an existant atscm project.

Override:

Command#requiresEnvironment

Return:

boolean

Always true.

Test:

public run(cli: AtSCMCli): Promise<*> source

Updates atscm if a newer version is available.

Override:

Command#run

Params:

NameTypeAttributeDescription
cli AtSCMCli

The cli instance used.

Return:

Promise<*>

Resolved if the command completed suceessfully, rejected with the error that occurred otherwise.

Test:

public update(cli: AtSCMCli, useBetaRelease: boolean): Promise<string, Error> source

Runs npm install --save-dev atscm@latest in a separate process.

Params:

NameTypeAttributeDescription
cli AtSCMCli

The cli instance used.

useBetaRelease boolean
  • optional
  • default: false

If beta versions should be used.

Return:

Promise<string, Error>

Fulfilled with npm's stdout or rejected with a spawn error or error code.

Test:

public updateNeeded(latestVersion: string, currentVersion: string): boolean | string source

Checks if an update is required with the given latest and current version.

Params:

NameTypeAttributeDescription
latestVersion string

The latest version available.

currentVersion string

The current version to check against.

Return:

boolean | string

Returns false if no update is required or the version to install if an update is required.

Test: