pkg(*-*): Fix uninstall (#213)
This commit is contained in:
parent
81cdc766b6
commit
d2e05a4a7e
|
@ -136,10 +136,10 @@ class Package {
|
||||||
logger.info(`Uninstalling ${this.language}-${this.version.raw}`);
|
logger.info(`Uninstalling ${this.language}-${this.version.raw}`);
|
||||||
|
|
||||||
logger.debug("Finding runtime")
|
logger.debug("Finding runtime")
|
||||||
const runtime = runtime.get_latest_runtime_matching_language_version(this.language, this.version.raw);
|
const found_runtime = runtime.get_latest_runtime_matching_language_version(this.language, this.version.raw);
|
||||||
|
|
||||||
logger.debug("Unregistering runtime")
|
logger.debug("Unregistering runtime")
|
||||||
runtime.unregister();
|
found_runtime.unregister();
|
||||||
|
|
||||||
logger.debug("Cleaning files from disk")
|
logger.debug("Cleaning files from disk")
|
||||||
await fs.rmdir(this.install_path, {recursive: true})
|
await fs.rmdir(this.install_path, {recursive: true})
|
||||||
|
|
|
@ -91,7 +91,7 @@ module.exports = {
|
||||||
|
|
||||||
// DELETE /packages/:language/:version
|
// DELETE /packages/:language/:version
|
||||||
async package_uninstall(req, res) {
|
async package_uninstall(req, res) {
|
||||||
logger.debug('Request to install package');
|
logger.debug('Request to uninstall package');
|
||||||
|
|
||||||
const pkg = await get_package(req.params.language, req.params.version);
|
const pkg = await get_package(req.params.language, req.params.version);
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ const chalk = require('chalk');
|
||||||
|
|
||||||
exports.command = ['uninstall <language> <language-version>']
|
exports.command = ['uninstall <language> <language-version>']
|
||||||
exports.aliases = ['u']
|
exports.aliases = ['u']
|
||||||
exports.describe = 'Installs the named package'
|
exports.describe = 'Uninstalls the named package'
|
||||||
|
|
||||||
|
|
||||||
const msg_format = {
|
const msg_format = {
|
||||||
|
@ -14,9 +14,9 @@ const msg_format = {
|
||||||
|
|
||||||
exports.handler = async function({axios, language, languageVersion}){
|
exports.handler = async function({axios, language, languageVersion}){
|
||||||
try{
|
try{
|
||||||
const install = await axios.delete(`/packages/${language}/${languageVersion}`)
|
const uninstall = await axios.delete(`/packages/${language}/${languageVersion}`)
|
||||||
|
|
||||||
console.log(msg_format.color(install.data));
|
console.log(msg_format.color(uninstall.data));
|
||||||
}catch({response}){
|
}catch({response}){
|
||||||
console.error(response.data.message)
|
console.error(response.data.message)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue