Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Framasoft
PeerTube
PeerTube
Commits
0e4ffb4b
Commit
0e4ffb4b
authored
Mar 27, 2018
by
Léo Andrès
Committed by
Chocobozzz
Mar 27, 2018
Browse files
Clean shell scripts (#398)
parent
d5b7d911
Changes
22
Hide whitespace changes
Inline
Side-by-side
scripts/build/client.sh
View file @
0e4ffb4b
#!/bin/
ba
sh
#!/bin/sh
cd
client
||
exit
-1
set
-eu
cd
client
rm
-rf
./dist ./compiled
...
...
scripts/build/server.sh
View file @
0e4ffb4b
#!/usr/bin/env sh
#!/bin/sh
set
-eu
rm
-rf
./dist
...
...
scripts/clean/client/dist.sh
View file @
0e4ffb4b
#!/
usr/bin/env
sh
#!/
bin/
sh
cd
client
||
exit
-1
set
-eu
cd
client
rm
-rf
compiled/ dist/ dll/
scripts/clean/server/dist.sh
View file @
0e4ffb4b
#!/usr/bin/env sh
#!/bin/sh
set
-eu
rm
-rf
dist/
scripts/clean/server/test.sh
View file @
0e4ffb4b
#!/usr/bin/env sh
#!/bin/sh
set
-eu
for
i
in
$(
seq
1 6
)
;
do
dropdb
"peertube_test
$i
"
...
...
scripts/client-report.sh
View file @
0e4ffb4b
#!/bin/
ba
sh
#!/bin/sh
cd
client
||
exit
-1
set
-eu
cd
client
npm run webpack-bundle-analyzer ./dist/stats.json
scripts/danger/clean/dev.sh
View file @
0e4ffb4b
#!/bin/bash
set
-eu
read
-p
"This will remove all directories and SQL tables. Are you sure? (y/*) "
-n
1
-r
echo
if
[[
"
$REPLY
"
=
~ ^[Yy]
$
]]
;
then
NODE_ENV
=
test
npm run ts-node
--
--type-check
"
./
scripts/danger/clean/cleaner"
NODE_ENV
=
test
npm run ts-node
--
--type-check
"scripts/danger/clean/cleaner"
fi
scripts/danger/clean/modules.sh
View file @
0e4ffb4b
#!/bin/bash
set
-eu
read
-p
"This will remove all node server and client modules. Are you sure? "
-n
1
-r
if
[[
"
$REPLY
"
=
~ ^[Yy]
$
]]
;
then
...
...
scripts/danger/clean/prod.sh
View file @
0e4ffb4b
#!/bin/bash
set
-eu
read
-p
"This will remove all directories and SQL tables. Are you sure? (y/*) "
-n
1
-r
echo
...
...
scripts/dev/client.sh
View file @
0e4ffb4b
#!/usr/bin/env sh
#!/bin/sh
set
-eu
NODE_ENV
=
test
concurrently
-k
\
"npm run watch:client"
\
...
...
scripts/dev/index.sh
View file @
0e4ffb4b
#!/usr/bin/env sh
#!/bin/sh
set
-eu
NODE_ENV
=
test
concurrently
-k
\
"npm run watch:client"
\
...
...
scripts/dev/server.sh
View file @
0e4ffb4b
#!/usr/bin/env sh
#!/bin/sh
set
-eu
if
[
!
-f
"./client/dist/index.html"
]
;
then
echo
"client/dist/index.html does not exist, compile client files..."
...
...
scripts/generate-api-doc.sh
View file @
0e4ffb4b
#!/usr/bin/env sh
#!/bin/sh
set
-eu
npm run spectacle-docs
--
-t
support/doc/api/html support/doc/api/openapi.yaml
scripts/generate-code-contributors.sh
View file @
0e4ffb4b
#!/usr/bin/env bash
#!/bin/sh
set
-eu
curl
-s
https://api.github.com/repos/chocobozzz/peertube/contributors |
\
jq
-r
'map("\\\n * [" + .login + "](" + .url + ")") | .[]'
|
\
...
...
scripts/help.sh
View file @
0e4ffb4b
#!/usr/bin/env sh
#!/bin/sh
set
-eu
printf
"############# PeerTube help #############
\n\n
"
printf
"npm run ...
\n
"
...
...
scripts/play.sh
View file @
0e4ffb4b
#!/usr/bin/env sh
#!/bin/sh
set
-eu
if
[
!
-f
"dist/server.js"
]
;
then
echo
"Missing server file (server.js)."
...
...
@@ -7,7 +9,7 @@ fi
max
=
${
1
:-
3
}
for
i
in
$(
seq
1
$max
)
;
do
for
i
in
$(
seq
1
"
$max
"
)
;
do
NODE_ENV
=
test
NODE_APP_INSTANCE
=
$i
node dist/server.js &
sleep
1
done
scripts/release.sh
View file @
0e4ffb4b
#!/bin/bash
set
-eu
shutdown
()
{
# Get our process group id
PGID
=
$(
ps
-o
pgid
=
$$
|
grep
-o
[
0-9]
*
)
PGID
=
$(
ps
-o
pgid
=
$$
|
grep
-o
"
[0-9]*
"
)
# Kill it in a new new process group
setsid
kill
--
-
$PGID
setsid
kill
--
-
"
$PGID
"
exit
0
}
...
...
@@ -16,7 +18,7 @@ if [ -z "$1" ]; then
exit
-1
fi
if
[
-z
$GITHUB_TOKEN
]
;
then
if
[
-z
"
$GITHUB_TOKEN
"
]
;
then
echo
"Need GITHUB_TOKEN env set."
exit
-1
fi
...
...
@@ -33,43 +35,41 @@ zip_name="peertube-$version.zip"
changelog
=
$(
awk
-v
version
=
"
$version
"
'/## v/ { printit = $2 == version }; printit;'
CHANGELOG.md |
grep
-v
"
$version
"
|
sed
'1{/^$/d}'
)
echo
-e
"Changelog will be:
\n
"
echo
"
$changelog
"
echo
printf
"Changelog will be:
\n
%s
\n
"
"
$changelog
"
read
-p
"Are you sure to release? "
-n
1
-r
echo
if
[[
!
$REPLY
=
~ ^[Yy]
$
]]
then
[[
"
$0
"
=
"
$BASH_SOURCE
"
]]
&&
exit
0
exit
0
fi
cd
./client
||
exit
-1
npm version
--no-git-tag-version
--no-commit-hooks
$1
||
exit
-1
(
cd
client
npm version
--no-git-tag-version
--no-commit-hooks
"
$1
"
)
cd
../
||
exit
-1
npm version
-f
--no-git-tag-version
--no-commit-hooks
$1
||
exit
-1
npm version
-f
--no-git-tag-version
--no-commit-hooks
"
$1
"
git commit package.json client/package.json
-m
"Bumped to version
$version
"
||
exit
-1
git commit package.json client/package.json
-m
"Bumped to version
$version
"
git tag
-s
-a
"
$version
"
-m
"
$version
"
npm run build
||
exit
-1
rm
"./client/dist/stats.json"
||
exit
-1
npm run build
rm
"./client/dist/stats.json"
cd
..
/
||
exit
-1
cd
..
ln
-s
"PeerTube"
"
$directory_name
"
||
exit
-1
ln
-s
"PeerTube"
"
$directory_name
"
zip
-r
"PeerTube/
$zip_name
"
"
$directory_name
/CREDITS.md"
"
$directory_name
/FAQ.md"
\
"
$directory_name
/LICENSE"
"
$directory_name
/README.md"
\
"
$directory_name
/client/dist/"
"
$directory_name
/client/yarn.lock"
\
"
$directory_name
/client/package.json"
"
$directory_name
/config"
\
"
$directory_name
/dist"
"
$directory_name
/package.json"
\
"
$directory_name
/scripts"
"
$directory_name
/support"
\
"
$directory_name
/tsconfig.json"
"
$directory_name
/yarn.lock"
\
||
exit
-1
rm
"
$directory_name
"
||
exit
-1
"
$directory_name
/tsconfig.json"
"
$directory_name
/yarn.lock"
rm
"
$directory_name
"
cd
"PeerTube"
||
exit
-1
cd
"PeerTube"
git push origin
--tag
...
...
scripts/test.sh
View file @
0e4ffb4b
#!/bin/
ba
sh
#!/bin/sh
npm run build:server
||
exit
-1
npm run travis
--
lint
||
exit
-1
set
-eu
npm run build:server
npm run travis
--
lint
mocha
--exit
--require
ts-node/register/type-check
--bail
server/tests/index.ts
scripts/travis.sh
View file @
0e4ffb4b
#!/bin/bash
#!/bin/sh
set
-eu
if
[
$#
-eq
0
]
;
then
echo
"Need test suite argument."
...
...
@@ -21,9 +23,9 @@ elif [ "$1" = "api-slow" ]; then
npm run build:server
mocha
--timeout
5000
--exit
--require
ts-node/register/type-check
--bail
server/tests/api/index-slow.ts
elif
[
"
$1
"
=
"lint"
]
;
then
cd
client
||
exit
-1
npm run lint
||
exit
-1
(
cd
client
npm run lint
)
cd
..
||
exit
-1
npm run tslint
--
--project
./tsconfig.json
-c
./tslint.json server.ts
"server/**/*.ts"
"shared/**/*.ts"
||
exit
-1
npm run tslint
--
--project
./tsconfig.json
-c
./tslint.json server.ts
"server/**/*.ts"
"shared/**/*.ts"
fi
scripts/upgrade.sh
View file @
0e4ffb4b
#!/
usr/bin/env ba
sh
#!/
bin/
sh
# Strict mode
set
-e
set
-eu
# Backup database
SQL_BACKUP_PATH
=
"/var/www/peertube/backup/sql-peertube_prod-
$(
date
+
\"
%Y%m%d-%H%M
\"
)
.bak"
...
...
@@ -11,19 +10,18 @@ pg_dump -U peertube -W -h localhost -F c peertube_prod -f "$SQL_BACKUP_PATH"
# Get and Display the Latest Version
VERSION
=
$(
curl
-s
https://api.github.com/repos/chocobozzz/peertube/releases/latest |
grep
tag_name |
cut
-d
'"'
-f
4
)
echo
"Latest Peertube version is
$VERSION
"
wget
-q
"https://github.com/Chocobozzz/PeerTube/releases/download/
${
VERSION
}
/peertube-
${
VERSION
}
.zip"
-O
/var/www/peertube/versions/peertube-
${
VERSION
}
.zip
wget
-q
"https://github.com/Chocobozzz/PeerTube/releases/download/
${
VERSION
}
/peertube-
${
VERSION
}
.zip"
-O
"
/var/www/peertube/versions/peertube-
${
VERSION
}
.zip
"
cd
/var/www/peertube/versions
unzip
-o
peertube-
${
VERSION
}
.zip
rm
-f
peertube-
${
VERSION
}
.zip
unzip
-o
"
peertube-
${
VERSION
}
.zip
"
rm
-f
"
peertube-
${
VERSION
}
.zip
"
# Upgrade Scripts
rm
-rf
/var/www/peertube/peertube-latest
ln
-s
/var/www/peertube/versions/peertube-
${
VERSION
}
/var/www/peertube/peertube-latest
cd
/var/www/peertube/peertube-latest
ln
-s
"
/var/www/peertube/versions/peertube-
${
VERSION
}
"
/var/www/peertube/peertube-latest
cd
/var/www/peertube/peertube-latest
yarn
install
--production
--pure-lockfile
cp
/var/www/peertube/peertube-latest/config/default.yaml /var/www/peertube/config/default.yaml
echo
"Differences in configuration files..."
diff /var/www/peertube/versions/peertube-
${
VERSION
}
/config/production.yaml.example /var/www/peertube/config/production.yaml
diff
"
/var/www/peertube/versions/peertube-
${
VERSION
}
/config/production.yaml.example
"
/var/www/peertube/config/production.yaml
exit
0
Prev
1
2
Next
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment