37 lines
930 B
JavaScript
37 lines
930 B
JavaScript
const State = require('../State')
|
|
|
|
class PackageCacheClearedState extends State {
|
|
static get services() {
|
|
return [...super.services, 'output']
|
|
}
|
|
|
|
constructor(host, config) {
|
|
if ( !host.packages ) {
|
|
throw new Error(`Cannot apply package state to host ${host.name}: missing package manager API.`)
|
|
}
|
|
super(host, config)
|
|
}
|
|
|
|
async apply() {
|
|
return this._host.packages.clear_cache()
|
|
}
|
|
|
|
async check() {
|
|
return false
|
|
}
|
|
|
|
async reverse() {
|
|
this.output.warn(`Package cache cleared state does not currently support reversal. (Host: ${this._host.name})`)
|
|
}
|
|
|
|
failure_message() {
|
|
return `Failed to clear package cache on host "${this._host.name}."`
|
|
}
|
|
|
|
check_message() {
|
|
return `The package cache on host "${this._host.name}" has not been cleared.`
|
|
}
|
|
}
|
|
|
|
module.exports = exports = PackageCacheClearedState
|