WIP plugins: move plugin CLI in peertube script
Install/uninstall/list plugins remotely
This commit is contained in:
parent
dba85a1e9e
commit
8d2be0ed7b
26 changed files with 452 additions and 191 deletions
|
@ -1,39 +0,0 @@
|
|||
import { initDatabaseModels } from '../../server/initializers/database'
|
||||
import * as program from 'commander'
|
||||
import { PluginManager } from '../../server/lib/plugins/plugin-manager'
|
||||
import { isAbsolute } from 'path'
|
||||
|
||||
program
|
||||
.option('-n, --plugin-name [pluginName]', 'Plugin name to install')
|
||||
.option('-v, --plugin-version [pluginVersion]', 'Plugin version to install')
|
||||
.option('-p, --plugin-path [pluginPath]', 'Path of the plugin you want to install')
|
||||
.parse(process.argv)
|
||||
|
||||
if (!program['pluginName'] && !program['pluginPath']) {
|
||||
console.error('You need to specify a plugin name with the desired version, or a plugin path.')
|
||||
process.exit(-1)
|
||||
}
|
||||
|
||||
if (program['pluginName'] && !program['pluginVersion']) {
|
||||
console.error('You need to specify a the version of the plugin you want to install.')
|
||||
process.exit(-1)
|
||||
}
|
||||
|
||||
if (program['pluginPath'] && !isAbsolute(program['pluginPath'])) {
|
||||
console.error('Plugin path should be absolute.')
|
||||
process.exit(-1)
|
||||
}
|
||||
|
||||
run()
|
||||
.then(() => process.exit(0))
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
process.exit(-1)
|
||||
})
|
||||
|
||||
async function run () {
|
||||
await initDatabaseModels(true)
|
||||
|
||||
const toInstall = program['pluginName'] || program['pluginPath']
|
||||
await PluginManager.Instance.install(toInstall, program['pluginVersion'], !!program['pluginPath'])
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
import { initDatabaseModels } from '../../server/initializers/database'
|
||||
import * as program from 'commander'
|
||||
import { PluginManager } from '../../server/lib/plugins/plugin-manager'
|
||||
import { isAbsolute } from 'path'
|
||||
|
||||
program
|
||||
.option('-n, --package-name [packageName]', 'Package name to install')
|
||||
.parse(process.argv)
|
||||
|
||||
if (!program['packageName']) {
|
||||
console.error('You need to specify the plugin name.')
|
||||
process.exit(-1)
|
||||
}
|
||||
|
||||
run()
|
||||
.then(() => process.exit(0))
|
||||
.catch(err => {
|
||||
console.error(err)
|
||||
process.exit(-1)
|
||||
})
|
||||
|
||||
async function run () {
|
||||
await initDatabaseModels(true)
|
||||
|
||||
const toUninstall = program['packageName']
|
||||
await PluginManager.Instance.uninstall(toUninstall)
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue