mirror of https://github.com/Chocobozzz/PeerTube
Update clean script
parent
0b10407e46
commit
82221ac920
|
@ -24,7 +24,8 @@
|
||||||
"clean:client": "scripty",
|
"clean:client": "scripty",
|
||||||
"clean:server:test": "scripty",
|
"clean:server:test": "scripty",
|
||||||
"watch:client": "SCRIPTY_PARALLEL=true scripty",
|
"watch:client": "SCRIPTY_PARALLEL=true scripty",
|
||||||
"danger:clean:server": "scripty",
|
"danger:clean:dev": "scripty",
|
||||||
|
"danger:clean:prod": "scripty",
|
||||||
"danger:clean:modules": "scripty",
|
"danger:clean:modules": "scripty",
|
||||||
"play": "scripty",
|
"play": "scripty",
|
||||||
"dev": "scripty",
|
"dev": "scripty",
|
||||||
|
@ -60,6 +61,7 @@
|
||||||
"password-generator": "^2.0.2",
|
"password-generator": "^2.0.2",
|
||||||
"request": "^2.57.0",
|
"request": "^2.57.0",
|
||||||
"request-replay": "^1.0.2",
|
"request-replay": "^1.0.2",
|
||||||
|
"rimraf": "^2.5.4",
|
||||||
"scripty": "^1.5.0",
|
"scripty": "^1.5.0",
|
||||||
"ursa": "^0.9.1",
|
"ursa": "^0.9.1",
|
||||||
"winston": "^2.1.1",
|
"winston": "^2.1.1",
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
const rimraf = require('rimraf')
|
||||||
|
const mongoose = require('mongoose')
|
||||||
|
|
||||||
|
const constants = require('../../../server/initializers/constants')
|
||||||
|
|
||||||
|
const mongodbUrl = 'mongodb://' + constants.CONFIG.DATABASE.HOST + ':' + constants.CONFIG.DATABASE.PORT + '/' + constants.CONFIG.DATABASE.DBNAME
|
||||||
|
mongoose.connect(mongodbUrl, function () {
|
||||||
|
console.info('Deleting MongoDB %s database.', constants.CONFIG.DATABASE.DBNAME)
|
||||||
|
mongoose.connection.db.dropDatabase(function () {
|
||||||
|
mongoose.connection.close()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
const STORAGE = constants.CONFIG.STORAGE
|
||||||
|
Object.keys(STORAGE).forEach(function (storage) {
|
||||||
|
const storageDir = STORAGE[storage]
|
||||||
|
|
||||||
|
rimraf(storageDir, function (err) {
|
||||||
|
if (err) throw err
|
||||||
|
|
||||||
|
console.info('Deleting %s.', storageDir)
|
||||||
|
})
|
||||||
|
})
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
read -p "This will remove all directories and Mongo database. Are you sure? " -n 1 -r
|
||||||
|
|
||||||
|
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
|
||||||
|
NODE_ENV=test node "./scripts/danger/clean/cleaner"
|
||||||
|
fi
|
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
read -p "This will remove all node and typescript modules. Are you sure? " -n 1 -r
|
read -p "This will remove all node server and client modules. Are you sure? " -n 1 -r
|
||||||
|
|
||||||
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
|
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
|
||||||
rm -rf node_modules client/node_modules
|
rm -rf node_modules client/node_modules
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
read -p "This will remove all directories and Mongo database. Are you sure? " -n 1 -r
|
||||||
|
|
||||||
|
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
|
||||||
|
NODE_ENV=production node "./scripts/danger/clean/cleaner"
|
||||||
|
fi
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
read -p "This will remove certs, uploads, database (dev) and logs. Are you sure? " -n 1 -r
|
|
||||||
|
|
||||||
if [[ "$REPLY" =~ ^[Yy]$ ]]; then
|
|
||||||
rm -rf ./certs ./logs ./uploads
|
|
||||||
printf "use peertube-dev;\ndb.dropDatabase();" | mongo
|
|
||||||
fi
|
|
|
@ -9,7 +9,8 @@ printf " clean -> Clean the application\n"
|
||||||
printf " clean:client -> Clean the client build files (dist directory)\n"
|
printf " clean:client -> Clean the client build files (dist directory)\n"
|
||||||
printf " clean:server:test -> Clean certificates, logs, uploads and database of the test instances\n"
|
printf " clean:server:test -> Clean certificates, logs, uploads and database of the test instances\n"
|
||||||
printf " watch:client -> Watch the client files\n"
|
printf " watch:client -> Watch the client files\n"
|
||||||
printf " danger:clean:server -> /!\ Clean certificates, logs, uploads and database\n"
|
printf " danger:clean:dev -> /!\ Clean certificates, logs, uploads, thumbnails, torrents and database specified in the development environment\n"
|
||||||
|
printf " danger:clean:prod -> /!\ Clean certificates, logs, uploads, thumbnails, torrents and database specified by the production environment\n"
|
||||||
printf " danger:clean:modules -> /!\ Clean node and typescript modules\n"
|
printf " danger:clean:modules -> /!\ Clean node and typescript modules\n"
|
||||||
printf " play -> Run 3 fresh nodes so that you can test the communication between them\n"
|
printf " play -> Run 3 fresh nodes so that you can test the communication between them\n"
|
||||||
printf " dev -> Watch, run the livereload and run the server so that you can develop the application\n"
|
printf " dev -> Watch, run the livereload and run the server so that you can develop the application\n"
|
||||||
|
|
|
@ -116,9 +116,6 @@ function addVideo (req, res, next) {
|
||||||
|
|
||||||
], function andFinally (err) {
|
], function andFinally (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
// TODO unseed the video
|
|
||||||
// TODO remove thumbnail
|
|
||||||
// TODO delete from DB
|
|
||||||
logger.error('Cannot insert the video.')
|
logger.error('Cannot insert the video.')
|
||||||
return next(err)
|
return next(err)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue