Add support for routines; state messages
This commit is contained in:
@@ -26,6 +26,14 @@ class DirectoryState extends State {
|
||||
async _path() {
|
||||
return this._host.get_path(this._config.path)
|
||||
}
|
||||
|
||||
failure_message() {
|
||||
return `The path "${this._config.path}" does not exist on host "${this._host.name}."`
|
||||
}
|
||||
|
||||
check_message() {
|
||||
return this.failure_message()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = DirectoryState
|
||||
|
||||
@@ -46,6 +46,14 @@ class DownloadState extends State {
|
||||
if ( !this._config.path ) throw new Error('Missing path config for DownloadState.')
|
||||
return this._host.get_path(this._config.path)
|
||||
}
|
||||
|
||||
failure_message() {
|
||||
return `The downloaded file "${this._config.path}" does not exist on host "${this._host.name}."`
|
||||
}
|
||||
|
||||
check_message() {
|
||||
return this.failure_message()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = DownloadState
|
||||
|
||||
@@ -31,6 +31,14 @@ class FileState extends State {
|
||||
if ( !this._config.path ) throw new Error('Missing path config for FileState.')
|
||||
return this._host.get_path(this._config.path)
|
||||
}
|
||||
|
||||
failure_message() {
|
||||
return `The file "${this._config.path}" does not exist on the host "${this._host.name}."`
|
||||
}
|
||||
|
||||
check_message() {
|
||||
return this.failure_message()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = FileState
|
||||
|
||||
@@ -39,6 +39,13 @@ class OwnerState extends State {
|
||||
return path
|
||||
}
|
||||
|
||||
failure_message() {
|
||||
return `The ownership state of the file "${this._config.path}" on host "${this._host.name}" is invalid.`
|
||||
}
|
||||
|
||||
check_message() {
|
||||
return this.failure_message()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = OwnerState
|
||||
|
||||
@@ -55,6 +55,14 @@ class PackState extends State {
|
||||
if ( !path.is_valid() ) throw new Error(`Invalid path for PathState: ${path}`)
|
||||
return path
|
||||
}
|
||||
|
||||
failure_message() {
|
||||
return `The archive "${this._config.destination}" does not exist on the host "${this._host.name}."`
|
||||
}
|
||||
|
||||
check_message() {
|
||||
return this.failure_message()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = PackState
|
||||
|
||||
@@ -34,6 +34,14 @@ class PermissionState extends State {
|
||||
if ( !path.is_valid() ) throw new Error(`Invalid path for PermissionState: ${path}`)
|
||||
return path
|
||||
}
|
||||
|
||||
failure_message() {
|
||||
return `The resource permissions for "${this._config.path}" on host "${this._host.name}" are invalid.`
|
||||
}
|
||||
|
||||
check_message() {
|
||||
return this.failure_message()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = PermissionState
|
||||
|
||||
@@ -58,6 +58,14 @@ class UnpackState extends State {
|
||||
if ( !path.is_directory() ) throw new Error(`Invalid extraction path. Must be a directory: ${path}`)
|
||||
return path
|
||||
}
|
||||
|
||||
failure_message() {
|
||||
return `The unpacked archive does not exist at the path "${this._config.destination}" on host "${this._host.name}."`
|
||||
}
|
||||
|
||||
check_message() {
|
||||
return this.failure_message()
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = exports = UnpackState
|
||||
|
||||
Reference in New Issue
Block a user