diff options
author | Chocobozzz <florian.bigard@gmail.com> | 2017-09-07 15:27:35 +0200 |
---|---|---|
committer | Chocobozzz <florian.bigard@gmail.com> | 2017-09-07 15:54:34 +0200 |
commit | fdbda9e3d6564ec908733c7019305f6a3c363a9f (patch) | |
tree | c596034156f167e7cfafe41c4a3fc6adda488a0d /scripts | |
parent | 04de542abd940f9d2ca213fba3c68580c6c9b78a (diff) | |
download | PeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.tar.gz PeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.tar.zst PeerTube-fdbda9e3d6564ec908733c7019305f6a3c363a9f.zip |
Add tests for npm run scripts
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/danger/clean/cleaner.ts | 2 | ||||
-rwxr-xr-x | scripts/reset-password.ts | 2 | ||||
-rwxr-xr-x | scripts/update-host.ts | 14 |
3 files changed, 11 insertions, 7 deletions
diff --git a/scripts/danger/clean/cleaner.ts b/scripts/danger/clean/cleaner.ts index d80b8d323..428333528 100644 --- a/scripts/danger/clean/cleaner.ts +++ b/scripts/danger/clean/cleaner.ts | |||
@@ -16,7 +16,7 @@ db.init(true) | |||
16 | const storageDir = STORAGE[storage] | 16 | const storageDir = STORAGE[storage] |
17 | 17 | ||
18 | return new Promise((res, rej) => { | 18 | return new Promise((res, rej) => { |
19 | rimraf(storageDir, function (err) { | 19 | rimraf(storageDir, err => { |
20 | if (err) return rej(err) | 20 | if (err) return rej(err) |
21 | 21 | ||
22 | console.info('%s deleted.', storageDir) | 22 | console.info('%s deleted.', storageDir) |
diff --git a/scripts/reset-password.ts b/scripts/reset-password.ts index 5ab7d01e5..f0c06a7bf 100755 --- a/scripts/reset-password.ts +++ b/scripts/reset-password.ts | |||
@@ -18,7 +18,7 @@ db.init(true) | |||
18 | .then(user => { | 18 | .then(user => { |
19 | if (!user) { | 19 | if (!user) { |
20 | console.error('User unknown.') | 20 | console.error('User unknown.') |
21 | return | 21 | process.exit(-1) |
22 | } | 22 | } |
23 | 23 | ||
24 | const readline = require('readline') | 24 | const readline = require('readline') |
diff --git a/scripts/update-host.ts b/scripts/update-host.ts index 5e69e4172..06d84a658 100755 --- a/scripts/update-host.ts +++ b/scripts/update-host.ts | |||
@@ -1,8 +1,5 @@ | |||
1 | import { readFileSync, writeFileSync } from 'fs' | 1 | import * as Promise from 'bluebird' |
2 | import { join } from 'path' | ||
3 | import * as parseTorrent from 'parse-torrent' | ||
4 | 2 | ||
5 | import { CONFIG, STATIC_PATHS } from '../server/initializers/constants' | ||
6 | import { database as db } from '../server/initializers/database' | 3 | import { database as db } from '../server/initializers/database' |
7 | import { hasFriends } from '../server/lib/friends' | 4 | import { hasFriends } from '../server/lib/friends' |
8 | 5 | ||
@@ -20,11 +17,18 @@ db.init(true) | |||
20 | return db.Video.list() | 17 | return db.Video.list() |
21 | }) | 18 | }) |
22 | .then(videos => { | 19 | .then(videos => { |
20 | const tasks: Promise<any>[] = [] | ||
21 | |||
23 | videos.forEach(video => { | 22 | videos.forEach(video => { |
23 | console.log('Updating video ' + video.uuid) | ||
24 | |||
24 | video.VideoFiles.forEach(file => { | 25 | video.VideoFiles.forEach(file => { |
25 | video.createTorrentAndSetInfoHash(file) | 26 | tasks.push(video.createTorrentAndSetInfoHash(file)) |
26 | }) | 27 | }) |
27 | }) | 28 | }) |
28 | 29 | ||
30 | return Promise.all(tasks) | ||
31 | }) | ||
32 | .then(() => { | ||
29 | process.exit(0) | 33 | process.exit(0) |
30 | }) | 34 | }) |