diff options
-rwxr-xr-x | bin/clean_test.sh | 8 | ||||
-rwxr-xr-x | bin/run_servers.sh | 12 | ||||
-rw-r--r-- | config/default.yaml | 2 | ||||
-rw-r--r-- | package.json | 37 | ||||
-rwxr-xr-x | scripts/build/client/sass.sh | 9 | ||||
-rwxr-xr-x | scripts/build/client/tsc.sh | 5 | ||||
-rwxr-xr-x | scripts/clean/client/sass.sh | 5 | ||||
-rwxr-xr-x | scripts/clean/client/tsc.sh | 4 | ||||
-rwxr-xr-x | scripts/clean/server/test.sh | 6 | ||||
-rwxr-xr-x | scripts/danger/clean/modules.sh | 7 | ||||
-rwxr-xr-x | scripts/danger/clean/server.sh | 8 | ||||
-rwxr-xr-x | scripts/dev.sh | 7 | ||||
-rwxr-xr-x | scripts/help.sh | 24 | ||||
-rwxr-xr-x | scripts/play.sh | 11 | ||||
-rwxr-xr-x | scripts/test.sh | 8 | ||||
-rwxr-xr-x | scripts/watch/client/sass.sh | 7 | ||||
-rwxr-xr-x | scripts/watch/client/tsc.sh | 5 | ||||
-rw-r--r-- | server/tests/api/utils.js | 2 |
18 files changed, 128 insertions, 39 deletions
diff --git a/bin/clean_test.sh b/bin/clean_test.sh deleted file mode 100755 index ef146e091..000000000 --- a/bin/clean_test.sh +++ /dev/null | |||
@@ -1,8 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | basePath=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) | ||
4 | |||
5 | for i in $(seq 1 6); do | ||
6 | printf "use peertube-test%s;\ndb.dropDatabase();" "$i" | mongo | ||
7 | rm -rf "$basePath/../test$i" | ||
8 | done | ||
diff --git a/bin/run_servers.sh b/bin/run_servers.sh deleted file mode 100755 index 83768178c..000000000 --- a/bin/run_servers.sh +++ /dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | if [ ! -f server.js ]; then | ||
4 | echo "The script has to be executed at the root of the project." | ||
5 | exit -1 | ||
6 | fi | ||
7 | |||
8 | NODE_ENV=test NODE_APP_INSTANCE=1 node server.js & | ||
9 | sleep 1 | ||
10 | NODE_ENV=test NODE_APP_INSTANCE=2 node server.js & | ||
11 | sleep 1 | ||
12 | NODE_ENV=test NODE_APP_INSTANCE=3 node server.js & | ||
diff --git a/config/default.yaml b/config/default.yaml index 646113da4..be161640c 100644 --- a/config/default.yaml +++ b/config/default.yaml | |||
@@ -9,7 +9,7 @@ webserver: | |||
9 | database: | 9 | database: |
10 | host: 'localhost' | 10 | host: 'localhost' |
11 | port: 27017 | 11 | port: 27017 |
12 | suffix: '-suffix' | 12 | suffix: '-dev' |
13 | 13 | ||
14 | # From the project root directory | 14 | # From the project root directory |
15 | storage: | 15 | storage: |
diff --git a/package.json b/package.json index a9d053f6e..32c0d31f6 100644 --- a/package.json +++ b/package.json | |||
@@ -1,6 +1,6 @@ | |||
1 | { | 1 | { |
2 | "name": "peertube", | 2 | "name": "peertube", |
3 | "description": "Prototype of a decentralized video streaming platform using P2P (bittorent) directly in the web browser with webtorrent.", | 3 | "description": "Prototype of a decentralized video streaming platform using P2P (bittorent) directly in the web browser with WebTorrent and Angular 2.", |
4 | "version": "0.0.1", | 4 | "version": "0.0.1", |
5 | "private": true, | 5 | "private": true, |
6 | "licence": "GPLv3", | 6 | "licence": "GPLv3", |
@@ -17,24 +17,26 @@ | |||
17 | "url": "git://github.com/Chocobozzz/PeerTube.git" | 17 | "url": "git://github.com/Chocobozzz/PeerTube.git" |
18 | }, | 18 | }, |
19 | "scripts": { | 19 | "scripts": { |
20 | "build": "concurrently \"npm run client:sass\" \"npm run client:tsc\"", | 20 | "build": "npm run build:client", |
21 | "client:clean": "concurrently \"npm run client:tsc:clean\" \"npm run client:sass:clean\"", | 21 | "build:client": "SCRIPTY_PARALLEL=true scripty", |
22 | "client:sass:index": "npm run client:sass:index:clean && cd client && node-sass --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css", | 22 | "build:client:sass": "scripty", |
23 | "client:sass:index:watch": "cd client && node-sass -w --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css client/angular/**/ client/angular/**/**", | 23 | "build:client:tsc": "scripty", |
24 | "client:sass:index:clean": "cd client && rm -f stylesheets/index.css", | 24 | "clean": "SCRIPTY_PARALLEL=true scripty", |
25 | "client:sass:angular": "cd client && node-sass angular/ --output angular/", | 25 | "clean:client": "SCRIPTY_PARALLEL=true scripty", |
26 | "client:sass:angular:watch": "cd client && node-sass -w angular/ --output angular/", | 26 | "clean:client:sass": "scripty", |
27 | "client:sass:angular:clean": "cd client && rm -f angular/**/*.css", | 27 | "clean:client:tsc": "scripty", |
28 | "client:sass": "concurrently \"npm run client:sass:index\" \"npm run client:sass:angular\"", | 28 | "clean:server:test": "scripty", |
29 | "client:sass:watch": "concurrently \"npm run client:sass:index:watch\" \"npm run client:sass:angular:watch\"", | 29 | "watch:client": "SCRIPTY_PARALLEL=true scripty", |
30 | "client:sass:clean": "concurrently \"npm run client:sass:index:clean\" \"npm run client:sass:angular:clean\"", | 30 | "watch:client:sass": "scripty", |
31 | "client:tsc": "cd client && npm run tsc", | 31 | "watch:client:tsc": "scripty", |
32 | "client:tsc:watch": "cd client && npm run tsc:w", | 32 | "danger:clean:server": "scripty", |
33 | "client:tsc:clean": "cd client && find angular -regextype posix-egrep -regex \".*\\.(js|map)$\" -exec rm -f {} \\;", | 33 | "danger:clean:modules": "scripty", |
34 | "dev": "npm run build && NODE_ENV=test concurrently \"npm run livereload\" \"npm run client:tsc:watch\" \"npm run client:sass:watch\" \"npm start\"", | 34 | "play": "scripty", |
35 | "dev": "scripty", | ||
35 | "livereload": "livereload ./client", | 36 | "livereload": "livereload ./client", |
36 | "start": "node server", | 37 | "start": "node server", |
37 | "test": "cd client && npm test && cd .. && standard && mocha server/tests", | 38 | "test": "scripty", |
39 | "help": "scripty", | ||
38 | "postinstall": "cd client && npm install" | 40 | "postinstall": "cd client && npm install" |
39 | }, | 41 | }, |
40 | "dependencies": { | 42 | "dependencies": { |
@@ -73,6 +75,7 @@ | |||
73 | "mocha": "^2.3.3", | 75 | "mocha": "^2.3.3", |
74 | "node-livereload": "^0.6.0", | 76 | "node-livereload": "^0.6.0", |
75 | "node-sass": "^3.4.2", | 77 | "node-sass": "^3.4.2", |
78 | "scripty": "^1.5.0", | ||
76 | "standard": "^6.0.1", | 79 | "standard": "^6.0.1", |
77 | "supertest": "^1.1.0" | 80 | "supertest": "^1.1.0" |
78 | }, | 81 | }, |
diff --git a/scripts/build/client/sass.sh b/scripts/build/client/sass.sh new file mode 100755 index 000000000..0caa0df20 --- /dev/null +++ b/scripts/build/client/sass.sh | |||
@@ -0,0 +1,9 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | npm run clean:client:sass | ||
4 | cd client || exit -1 | ||
5 | |||
6 | # Compile index and angular files | ||
7 | concurrently \ | ||
8 | "node-sass --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css" \ | ||
9 | "node-sass angular/ --output angular/" | ||
diff --git a/scripts/build/client/tsc.sh b/scripts/build/client/tsc.sh new file mode 100755 index 000000000..ec06b643a --- /dev/null +++ b/scripts/build/client/tsc.sh | |||
@@ -0,0 +1,5 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | cd client || exit -1 | ||
4 | |||
5 | npm run tsc | ||
diff --git a/scripts/clean/client/sass.sh b/scripts/clean/client/sass.sh new file mode 100755 index 000000000..82c079f28 --- /dev/null +++ b/scripts/clean/client/sass.sh | |||
@@ -0,0 +1,5 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | cd client || exit -1 | ||
4 | rm -f stylesheets/index.css | ||
5 | find angular -regextype posix-egrep -regex ".*\.(css)$" -exec rm -f {} \; | ||
diff --git a/scripts/clean/client/tsc.sh b/scripts/clean/client/tsc.sh new file mode 100755 index 000000000..775157a54 --- /dev/null +++ b/scripts/clean/client/tsc.sh | |||
@@ -0,0 +1,4 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | cd client || exit -1 | ||
4 | find angular -regextype posix-egrep -regex ".*\.(js|map)$" -exec rm -f {} \; | ||
diff --git a/scripts/clean/server/test.sh b/scripts/clean/server/test.sh new file mode 100755 index 000000000..927671dd4 --- /dev/null +++ b/scripts/clean/server/test.sh | |||
@@ -0,0 +1,6 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | for i in $(seq 1 6); do | ||
4 | printf "use peertube-test%s;\ndb.dropDatabase();" "$i" | mongo | ||
5 | rm -rf "./test$i" | ||
6 | done | ||
diff --git a/scripts/danger/clean/modules.sh b/scripts/danger/clean/modules.sh new file mode 100755 index 000000000..1aa6c732b --- /dev/null +++ b/scripts/danger/clean/modules.sh | |||
@@ -0,0 +1,7 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | read -p "This will remove all node and typescript modules. Are you sure? " -n 1 -r | ||
4 | |||
5 | if [[ "$REPLY" =~ ^[Yy]$ ]]; then | ||
6 | rm -rf node_modules client/node_modules client/typings | ||
7 | fi | ||
diff --git a/scripts/danger/clean/server.sh b/scripts/danger/clean/server.sh new file mode 100755 index 000000000..0a85eb249 --- /dev/null +++ b/scripts/danger/clean/server.sh | |||
@@ -0,0 +1,8 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | read -p "This will remove certs, uploads, database (dev) and logs. Are you sure? " -n 1 -r | ||
4 | |||
5 | if [[ "$REPLY" =~ ^[Yy]$ ]]; then | ||
6 | rm -rf ./certs ./logs ./uploads | ||
7 | printf "use peertube-dev;\ndb.dropDatabase();" | mongo | ||
8 | fi | ||
diff --git a/scripts/dev.sh b/scripts/dev.sh new file mode 100755 index 000000000..d617cd511 --- /dev/null +++ b/scripts/dev.sh | |||
@@ -0,0 +1,7 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | npm run build | ||
4 | NODE_ENV=test concurrently \ | ||
5 | "npm run livereload" \ | ||
6 | "npm run watch:client" \ | ||
7 | "npm start" | ||
diff --git a/scripts/help.sh b/scripts/help.sh new file mode 100755 index 000000000..3ed9f15cc --- /dev/null +++ b/scripts/help.sh | |||
@@ -0,0 +1,24 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | printf "############# PeerTube help #############\n\n" | ||
4 | printf "npm run ...\n" | ||
5 | printf " build -> Build the application\n" | ||
6 | printf " build:client -> Build the client (css, js files)\n" | ||
7 | printf " build:client:sass -> Build the sass files\n" | ||
8 | printf " build:client:tsc -> Build the javascript files\n" | ||
9 | printf " clean -> Clean the application\n" | ||
10 | printf " clean:client -> Clean the client (css, js files)\n" | ||
11 | printf " clean:client:sass -> Clean the sass build files\n" | ||
12 | printf " clean:client:tsc -> Clean the javascript files\n" | ||
13 | printf " clean:server:test -> Clean certificates, logs, uploads and database of the test instances\n" | ||
14 | printf " watch:client -> Watch the client files\n" | ||
15 | printf " watch:client:sass -> Watch the sass client files\n" | ||
16 | printf " watch:client:tsc -> Watch the typescript files\n" | ||
17 | printf " danger:clean:server -> /!\ Clean certificates, logs, uploads and database\n" | ||
18 | printf " danger:clean:modules -> /!\ Clean node and typescript modules\n" | ||
19 | printf " play -> Run 3 fresh nodes so that you can test the communication between them\n" | ||
20 | printf " dev -> Watch, run the livereload and run the server so that you can develop the application\n" | ||
21 | printf " livereload -> Run the livereload on the client\n" | ||
22 | printf " start -> Run the server\n" | ||
23 | printf " test -> Run the tests\n" | ||
24 | printf " help -> Print this help\n" | ||
diff --git a/scripts/play.sh b/scripts/play.sh new file mode 100755 index 000000000..33dc1a545 --- /dev/null +++ b/scripts/play.sh | |||
@@ -0,0 +1,11 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | if [ ! -f server.js ]; then | ||
4 | echo "Missing server file (server.js)." | ||
5 | exit -1 | ||
6 | fi | ||
7 | |||
8 | for i in 1 2 3; do | ||
9 | NODE_ENV=test NODE_APP_INSTANCE=$i node server.js & | ||
10 | sleep 1 | ||
11 | done | ||
diff --git a/scripts/test.sh b/scripts/test.sh new file mode 100755 index 000000000..93dbd8200 --- /dev/null +++ b/scripts/test.sh | |||
@@ -0,0 +1,8 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | cd client || exit -1 | ||
4 | npm test | ||
5 | |||
6 | cd .. || exit -1 | ||
7 | standard | ||
8 | mocha server/tests | ||
diff --git a/scripts/watch/client/sass.sh b/scripts/watch/client/sass.sh new file mode 100755 index 000000000..7d716cb7c --- /dev/null +++ b/scripts/watch/client/sass.sh | |||
@@ -0,0 +1,7 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | cd client || exit -1 | ||
4 | |||
5 | concurrently \ | ||
6 | "node-sass -w --include-path node_modules/bootstrap-sass/assets/stylesheets/ stylesheets/application.scss stylesheets/index.css client/angular/**/ client/angular/**/**" \ | ||
7 | "node-sass -w angular/ --output angular/" | ||
diff --git a/scripts/watch/client/tsc.sh b/scripts/watch/client/tsc.sh new file mode 100755 index 000000000..f00656d2e --- /dev/null +++ b/scripts/watch/client/tsc.sh | |||
@@ -0,0 +1,5 @@ | |||
1 | #!/usr/bin/env sh | ||
2 | |||
3 | cd client || exit -1 | ||
4 | |||
5 | npm run tsc:w | ||
diff --git a/server/tests/api/utils.js b/server/tests/api/utils.js index d37e12cb2..c1a01ef37 100644 --- a/server/tests/api/utils.js +++ b/server/tests/api/utils.js | |||
@@ -25,7 +25,7 @@ const testUtils = { | |||
25 | // ---------------------- Export functions -------------------- | 25 | // ---------------------- Export functions -------------------- |
26 | 26 | ||
27 | function flushTests (callback) { | 27 | function flushTests (callback) { |
28 | exec(pathUtils.join(__dirname, '../../../bin/clean_test.sh'), callback) | 28 | exec('npm run clean:server:test', callback) |
29 | } | 29 | } |
30 | 30 | ||
31 | function getFriendsList (url, end) { | 31 | function getFriendsList (url, end) { |