aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChocobozzz <florian.bigard@gmail.com>2016-01-30 17:05:22 +0100
committerChocobozzz <florian.bigard@gmail.com>2016-01-30 17:05:22 +0100
commitcda021079ff455cc0fd0eb95a5395fa808ab63d1 (patch)
tree056716de7460462b74b861051a5e9da6e2633fce
parent86435b9baedfe300a28ea4545511c1b50d4119f6 (diff)
downloadPeerTube-cda021079ff455cc0fd0eb95a5395fa808ab63d1.tar.gz
PeerTube-cda021079ff455cc0fd0eb95a5395fa808ab63d1.tar.zst
PeerTube-cda021079ff455cc0fd0eb95a5395fa808ab63d1.zip
New directory organization
-rw-r--r--Gruntfile.js3
-rw-r--r--controllers/api/v1/index.js (renamed from routes/api/v1/index.js)0
-rw-r--r--controllers/api/v1/pods.js (renamed from routes/api/v1/pods.js)2
-rw-r--r--controllers/api/v1/remoteVideos.js (renamed from routes/api/v1/remoteVideos.js)2
-rw-r--r--controllers/api/v1/videos.js (renamed from routes/api/v1/videos.js)2
-rw-r--r--controllers/index.js (renamed from routes/index.js)2
-rw-r--r--controllers/views.js (renamed from routes/views.js)0
-rw-r--r--helpers/customValidators.js (renamed from src/customValidators.js)0
-rw-r--r--helpers/logger.js (renamed from src/logger.js)0
-rw-r--r--helpers/utils.js (renamed from src/utils.js)2
-rw-r--r--initializers/checker.js (renamed from src/checker.js)0
-rw-r--r--initializers/constants.js (renamed from src/constants.js)0
-rw-r--r--initializers/database.js (renamed from src/database.js)2
-rw-r--r--lib/poolRequests.js (renamed from src/poolRequests.js)8
-rw-r--r--lib/webTorrentNode.js (renamed from src/webTorrentNode.js)2
-rw-r--r--lib/webtorrent.js (renamed from src/webtorrent.js)0
-rw-r--r--middlewares/misc.js6
-rw-r--r--middlewares/reqValidators/pods.js2
-rw-r--r--middlewares/reqValidators/remote.js2
-rw-r--r--middlewares/reqValidators/utils.js2
-rw-r--r--middlewares/reqValidators/videos.js4
-rw-r--r--models/pods.js (renamed from src/pods.js)10
-rw-r--r--models/videos.js (renamed from src/videos.js)6
-rw-r--r--package.json2
-rw-r--r--server.js18
-rw-r--r--tests/api/checkParams.js (renamed from test/api/checkParams.js)0
-rw-r--r--tests/api/fixtures/video_short.mp4 (renamed from test/api/fixtures/video_short.mp4)bin38783 -> 38783 bytes
-rw-r--r--tests/api/fixtures/video_short.ogv (renamed from test/api/fixtures/video_short.ogv)bin140849 -> 140849 bytes
-rw-r--r--tests/api/fixtures/video_short.webm (renamed from test/api/fixtures/video_short.webm)bin218910 -> 218910 bytes
-rw-r--r--tests/api/fixtures/video_short1.webm (renamed from test/api/fixtures/video_short1.webm)bin572456 -> 572456 bytes
-rw-r--r--tests/api/fixtures/video_short2.webm (renamed from test/api/fixtures/video_short2.webm)bin942961 -> 942961 bytes
-rw-r--r--tests/api/fixtures/video_short3.webm (renamed from test/api/fixtures/video_short3.webm)bin292677 -> 292677 bytes
-rw-r--r--tests/api/fixtures/video_short_fake.webm (renamed from test/api/fixtures/video_short_fake.webm)0
-rw-r--r--tests/api/friendsAdvanced.js (renamed from test/api/friendsAdvanced.js)0
-rw-r--r--tests/api/friendsBasic.js (renamed from test/api/friendsBasic.js)0
-rw-r--r--tests/api/index.js (renamed from test/api/index.js)0
-rw-r--r--tests/api/multiplePods.js (renamed from test/api/multiplePods.js)2
-rw-r--r--tests/api/singlePod.js (renamed from test/api/singlePod.js)2
-rw-r--r--tests/api/utils.js (renamed from test/api/utils.js)0
-rw-r--r--tests/index.js (renamed from test/index.js)0
40 files changed, 40 insertions, 41 deletions
diff --git a/Gruntfile.js b/Gruntfile.js
index a8fcbb609..6df0c023a 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -8,8 +8,7 @@ module.exports = function (grunt) {
8 scss: 'public/stylesheets/application.scss', 8 scss: 'public/stylesheets/application.scss',
9 vendor: 'public/stylesheets/vendor', 9 vendor: 'public/stylesheets/vendor',
10 js: 'public/javascripts/*.js', 10 js: 'public/javascripts/*.js',
11 src: 'src/*.js', 11 routes: 'controllers/**/*.js',
12 routes: 'routes/**/*.js',
13 main: './server.js', 12 main: './server.js',
14 browserified: 'public/javascripts/bundle.js', 13 browserified: 'public/javascripts/bundle.js',
15 img: 'public/images/*.{png,jpg,jpeg,gif,webp,svg}', 14 img: 'public/images/*.{png,jpg,jpeg,gif,webp,svg}',
diff --git a/routes/api/v1/index.js b/controllers/api/v1/index.js
index f5504ad85..f5504ad85 100644
--- a/routes/api/v1/index.js
+++ b/controllers/api/v1/index.js
diff --git a/routes/api/v1/pods.js b/controllers/api/v1/pods.js
index 2430b0d7e..30385bd5a 100644
--- a/routes/api/v1/pods.js
+++ b/controllers/api/v1/pods.js
@@ -7,7 +7,7 @@
7 var miscMiddleware = middleware.misc 7 var miscMiddleware = middleware.misc
8 var reqValidator = middleware.reqValidators.pods 8 var reqValidator = middleware.reqValidators.pods
9 var secureRequest = middleware.reqValidators.remote.secureRequest 9 var secureRequest = middleware.reqValidators.remote.secureRequest
10 var pods = require('../../../src/pods') 10 var pods = require('../../../models/pods')
11 11
12 function listPods (req, res, next) { 12 function listPods (req, res, next) {
13 pods.list(function (err, pods_list) { 13 pods.list(function (err, pods_list) {
diff --git a/routes/api/v1/remoteVideos.js b/controllers/api/v1/remoteVideos.js
index 6ba6ce17b..d534d6792 100644
--- a/routes/api/v1/remoteVideos.js
+++ b/controllers/api/v1/remoteVideos.js
@@ -8,7 +8,7 @@
8 var middleware = require('../../../middlewares') 8 var middleware = require('../../../middlewares')
9 var miscMiddleware = middleware.misc 9 var miscMiddleware = middleware.misc
10 var reqValidator = middleware.reqValidators.remote 10 var reqValidator = middleware.reqValidators.remote
11 var videos = require('../../../src/videos') 11 var videos = require('../../../models/videos')
12 12
13 function addRemoteVideos (req, res, next) { 13 function addRemoteVideos (req, res, next) {
14 videos.addRemotes(req.body.data, function (err, videos) { 14 videos.addRemotes(req.body.data, function (err, videos) {
diff --git a/routes/api/v1/videos.js b/controllers/api/v1/videos.js
index 95c1dffc7..aa8cb466b 100644
--- a/routes/api/v1/videos.js
+++ b/controllers/api/v1/videos.js
@@ -10,7 +10,7 @@
10 var middleware = require('../../../middlewares') 10 var middleware = require('../../../middlewares')
11 var miscMiddleware = middleware.misc 11 var miscMiddleware = middleware.misc
12 var reqValidator = middleware.reqValidators.videos 12 var reqValidator = middleware.reqValidators.videos
13 var videos = require('../../../src/videos') 13 var videos = require('../../../models/videos')
14 14
15 var uploads = config.get('storage.uploads') 15 var uploads = config.get('storage.uploads')
16 16
diff --git a/routes/index.js b/controllers/index.js
index f45aa7ba5..7dca002ff 100644
--- a/routes/index.js
+++ b/controllers/index.js
@@ -1,7 +1,7 @@
1;(function () { 1;(function () {
2 'use strict' 2 'use strict'
3 3
4 var constants = require('../src/constants') 4 var constants = require('../initializers/constants')
5 5
6 var routes = { 6 var routes = {
7 api: require('./api/' + constants.API_VERSION), 7 api: require('./api/' + constants.API_VERSION),
diff --git a/routes/views.js b/controllers/views.js
index ebd97380e..ebd97380e 100644
--- a/routes/views.js
+++ b/controllers/views.js
diff --git a/src/customValidators.js b/helpers/customValidators.js
index 73c2f8461..73c2f8461 100644
--- a/src/customValidators.js
+++ b/helpers/customValidators.js
diff --git a/src/logger.js b/helpers/logger.js
index 850af10cb..850af10cb 100644
--- a/src/logger.js
+++ b/helpers/logger.js
diff --git a/src/utils.js b/helpers/utils.js
index 176648a31..7cdb2600d 100644
--- a/src/utils.js
+++ b/helpers/utils.js
@@ -10,7 +10,7 @@
10 var replay = require('request-replay') 10 var replay = require('request-replay')
11 var ursa = require('ursa') 11 var ursa = require('ursa')
12 12
13 var constants = require('./constants') 13 var constants = require('../initializers/constants')
14 var logger = require('./logger') 14 var logger = require('./logger')
15 15
16 var utils = {} 16 var utils = {}
diff --git a/src/checker.js b/initializers/checker.js
index 7a3a53616..7a3a53616 100644
--- a/src/checker.js
+++ b/initializers/checker.js
diff --git a/src/constants.js b/initializers/constants.js
index 00b713961..00b713961 100644
--- a/src/constants.js
+++ b/initializers/constants.js
diff --git a/src/database.js b/initializers/database.js
index e03176b31..4570d3739 100644
--- a/src/database.js
+++ b/initializers/database.js
@@ -5,7 +5,7 @@
5 var mongoose = require('mongoose') 5 var mongoose = require('mongoose')
6 6
7 var constants = require('./constants') 7 var constants = require('./constants')
8 var logger = require('./logger') 8 var logger = require('../helpers/logger')
9 9
10 var dbname = 'peertube' + config.get('database.suffix') 10 var dbname = 'peertube' + config.get('database.suffix')
11 var host = config.get('database.host') 11 var host = config.get('database.host')
diff --git a/src/poolRequests.js b/lib/poolRequests.js
index 7f422f372..9c7f3238b 100644
--- a/src/poolRequests.js
+++ b/lib/poolRequests.js
@@ -3,13 +3,13 @@
3 3
4 var async = require('async') 4 var async = require('async')
5 5
6 var constants = require('./constants') 6 var constants = require('../initializers/constants')
7 var logger = require('./logger') 7 var logger = require('../helpers/logger')
8 var database = require('./database') 8 var database = require('../initializers/database')
9 var pluck = require('lodash-node/compat/collection/pluck') 9 var pluck = require('lodash-node/compat/collection/pluck')
10 var PoolRequestsDB = database.PoolRequestsDB 10 var PoolRequestsDB = database.PoolRequestsDB
11 var PodsDB = database.PodsDB 11 var PodsDB = database.PodsDB
12 var utils = require('./utils') 12 var utils = require('../helpers/utils')
13 var VideosDB = database.VideosDB 13 var VideosDB = database.VideosDB
14 14
15 var poolRequests = {} 15 var poolRequests = {}
diff --git a/src/webTorrentNode.js b/lib/webTorrentNode.js
index d6801d0fb..8827c68c5 100644
--- a/src/webTorrentNode.js
+++ b/lib/webTorrentNode.js
@@ -6,7 +6,7 @@
6 var pathUtils = require('path') 6 var pathUtils = require('path')
7 var spawn = require('electron-spawn') 7 var spawn = require('electron-spawn')
8 8
9 var logger = require('./logger') 9 var logger = require('../helpers/logger')
10 10
11 var host = config.get('webserver.host') 11 var host = config.get('webserver.host')
12 var port = config.get('webserver.port') 12 var port = config.get('webserver.port')
diff --git a/src/webtorrent.js b/lib/webtorrent.js
index b72bc500d..b72bc500d 100644
--- a/src/webtorrent.js
+++ b/lib/webtorrent.js
diff --git a/middlewares/misc.js b/middlewares/misc.js
index c10b0792a..f814acd9f 100644
--- a/middlewares/misc.js
+++ b/middlewares/misc.js
@@ -4,9 +4,9 @@
4 var ursa = require('ursa') 4 var ursa = require('ursa')
5 var fs = require('fs') 5 var fs = require('fs')
6 6
7 var logger = require('../src/logger') 7 var logger = require('../helpers/logger')
8 var utils = require('../src/utils') 8 var utils = require('../helpers/utils')
9 var PodsDB = require('../src/database').PodsDB 9 var PodsDB = require('../initializers/database').PodsDB
10 10
11 var misc = {} 11 var misc = {}
12 12
diff --git a/middlewares/reqValidators/pods.js b/middlewares/reqValidators/pods.js
index 31eaf8449..0d023842d 100644
--- a/middlewares/reqValidators/pods.js
+++ b/middlewares/reqValidators/pods.js
@@ -2,7 +2,7 @@
2 'use strict' 2 'use strict'
3 3
4 var checkErrors = require('./utils').checkErrors 4 var checkErrors = require('./utils').checkErrors
5 var logger = require('../../src/logger') 5 var logger = require('../../helpers/logger')
6 6
7 var pods = {} 7 var pods = {}
8 8
diff --git a/middlewares/reqValidators/remote.js b/middlewares/reqValidators/remote.js
index a9d2cdf20..4b161e292 100644
--- a/middlewares/reqValidators/remote.js
+++ b/middlewares/reqValidators/remote.js
@@ -2,7 +2,7 @@
2 'use strict' 2 'use strict'
3 3
4 var checkErrors = require('./utils').checkErrors 4 var checkErrors = require('./utils').checkErrors
5 var logger = require('../../src/logger') 5 var logger = require('../../helpers/logger')
6 6
7 var remote = {} 7 var remote = {}
8 8
diff --git a/middlewares/reqValidators/utils.js b/middlewares/reqValidators/utils.js
index 91ead27a5..5bc9f4f0b 100644
--- a/middlewares/reqValidators/utils.js
+++ b/middlewares/reqValidators/utils.js
@@ -2,7 +2,7 @@
2 'use strict' 2 'use strict'
3 3
4 var util = require('util') 4 var util = require('util')
5 var logger = require('../../src/logger') 5 var logger = require('../../helpers/logger')
6 6
7 var utils = {} 7 var utils = {}
8 8
diff --git a/middlewares/reqValidators/videos.js b/middlewares/reqValidators/videos.js
index 8c4e23b6b..a34445f7a 100644
--- a/middlewares/reqValidators/videos.js
+++ b/middlewares/reqValidators/videos.js
@@ -2,8 +2,8 @@
2 'use strict' 2 'use strict'
3 3
4 var checkErrors = require('./utils').checkErrors 4 var checkErrors = require('./utils').checkErrors
5 var VideosDB = require('../../src/database').VideosDB 5 var VideosDB = require('../../initializers/database').VideosDB
6 var logger = require('../../src/logger') 6 var logger = require('../../helpers/logger')
7 7
8 var videos = {} 8 var videos = {}
9 9
diff --git a/src/pods.js b/models/pods.js
index defa9b1c1..c8d08b26f 100644
--- a/src/pods.js
+++ b/models/pods.js
@@ -6,11 +6,11 @@
6 var fs = require('fs') 6 var fs = require('fs')
7 var request = require('request') 7 var request = require('request')
8 8
9 var constants = require('./constants') 9 var constants = require('../initializers/constants')
10 var logger = require('./logger') 10 var logger = require('../helpers/logger')
11 var PodsDB = require('./database').PodsDB 11 var PodsDB = require('../initializers/database').PodsDB
12 var poolRequests = require('./poolRequests') 12 var poolRequests = require('../lib/poolRequests')
13 var utils = require('./utils') 13 var utils = require('../helpers/utils')
14 14
15 var pods = {} 15 var pods = {}
16 16
diff --git a/src/videos.js b/models/videos.js
index 90821fdf6..626c55819 100644
--- a/src/videos.js
+++ b/models/videos.js
@@ -5,11 +5,11 @@
5 var config = require('config') 5 var config = require('config')
6 var dz = require('dezalgo') 6 var dz = require('dezalgo')
7 var fs = require('fs') 7 var fs = require('fs')
8 var webtorrent = require('./webTorrentNode') 8 var webtorrent = require('../lib/webTorrentNode')
9 9
10 var logger = require('./logger') 10 var logger = require('../helpers/logger')
11 var pods = require('./pods') 11 var pods = require('./pods')
12 var VideosDB = require('./database').VideosDB 12 var VideosDB = require('../initializers/database').VideosDB
13 13
14 var videos = {} 14 var videos = {}
15 15
diff --git a/package.json b/package.json
index f04d97423..cd6e36369 100644
--- a/package.json
+++ b/package.json
@@ -18,7 +18,7 @@
18 }, 18 },
19 "scripts": { 19 "scripts": {
20 "start": "grunt dev", 20 "start": "grunt dev",
21 "test": "grunt build && standard && mocha test" 21 "test": "grunt build && standard && mocha tests"
22 }, 22 },
23 "dependencies": { 23 "dependencies": {
24 "async": "^1.2.1", 24 "async": "^1.2.1",
diff --git a/server.js b/server.js
index ad57649b2..1e0222f4f 100644
--- a/server.js
+++ b/server.js
@@ -15,7 +15,7 @@
15 var app = express() 15 var app = express()
16 16
17 // ----------- Checker ----------- 17 // ----------- Checker -----------
18 var checker = require('./src/checker') 18 var checker = require('./initializers/checker')
19 19
20 var miss = checker.checkConfig() 20 var miss = checker.checkConfig()
21 if (miss.length !== 0) { 21 if (miss.length !== 0) {
@@ -28,14 +28,14 @@
28 28
29 // ----------- PeerTube modules ----------- 29 // ----------- PeerTube modules -----------
30 var config = require('config') 30 var config = require('config')
31 var constants = require('./src/constants') 31 var constants = require('./initializers/constants')
32 var customValidators = require('./src/customValidators') 32 var customValidators = require('./helpers/customValidators')
33 var logger = require('./src/logger') 33 var logger = require('./helpers/logger')
34 var poolRequests = require('./src/poolRequests') 34 var poolRequests = require('./lib/poolRequests')
35 var routes = require('./routes') 35 var routes = require('./controllers')
36 var utils = require('./src/utils') 36 var utils = require('./helpers/utils')
37 var videos = require('./src/videos') 37 var videos = require('./models/videos')
38 var webtorrent = require('./src/webTorrentNode') 38 var webtorrent = require('./lib/webTorrentNode')
39 39
40 // Get configurations 40 // Get configurations
41 var port = config.get('listen.port') 41 var port = config.get('listen.port')
diff --git a/test/api/checkParams.js b/tests/api/checkParams.js
index 11fc68ff9..11fc68ff9 100644
--- a/test/api/checkParams.js
+++ b/tests/api/checkParams.js
diff --git a/test/api/fixtures/video_short.mp4 b/tests/api/fixtures/video_short.mp4
index 35678362b..35678362b 100644
--- a/test/api/fixtures/video_short.mp4
+++ b/tests/api/fixtures/video_short.mp4
Binary files differ
diff --git a/test/api/fixtures/video_short.ogv b/tests/api/fixtures/video_short.ogv
index 9e253da82..9e253da82 100644
--- a/test/api/fixtures/video_short.ogv
+++ b/tests/api/fixtures/video_short.ogv
Binary files differ
diff --git a/test/api/fixtures/video_short.webm b/tests/api/fixtures/video_short.webm
index bf4b0ab6c..bf4b0ab6c 100644
--- a/test/api/fixtures/video_short.webm
+++ b/tests/api/fixtures/video_short.webm
Binary files differ
diff --git a/test/api/fixtures/video_short1.webm b/tests/api/fixtures/video_short1.webm
index 70ac0c644..70ac0c644 100644
--- a/test/api/fixtures/video_short1.webm
+++ b/tests/api/fixtures/video_short1.webm
Binary files differ
diff --git a/test/api/fixtures/video_short2.webm b/tests/api/fixtures/video_short2.webm
index 13d72dff7..13d72dff7 100644
--- a/test/api/fixtures/video_short2.webm
+++ b/tests/api/fixtures/video_short2.webm
Binary files differ
diff --git a/test/api/fixtures/video_short3.webm b/tests/api/fixtures/video_short3.webm
index cde5dcd58..cde5dcd58 100644
--- a/test/api/fixtures/video_short3.webm
+++ b/tests/api/fixtures/video_short3.webm
Binary files differ
diff --git a/test/api/fixtures/video_short_fake.webm b/tests/api/fixtures/video_short_fake.webm
index d85290ae5..d85290ae5 100644
--- a/test/api/fixtures/video_short_fake.webm
+++ b/tests/api/fixtures/video_short_fake.webm
diff --git a/test/api/friendsAdvanced.js b/tests/api/friendsAdvanced.js
index 61483bee6..61483bee6 100644
--- a/test/api/friendsAdvanced.js
+++ b/tests/api/friendsAdvanced.js
diff --git a/test/api/friendsBasic.js b/tests/api/friendsBasic.js
index dbc918383..dbc918383 100644
--- a/test/api/friendsBasic.js
+++ b/tests/api/friendsBasic.js
diff --git a/test/api/index.js b/tests/api/index.js
index 3bdcdae2d..3bdcdae2d 100644
--- a/test/api/index.js
+++ b/tests/api/index.js
diff --git a/test/api/multiplePods.js b/tests/api/multiplePods.js
index b579e5e32..c27f7121e 100644
--- a/test/api/multiplePods.js
+++ b/tests/api/multiplePods.js
@@ -6,7 +6,7 @@
6 var expect = chai.expect 6 var expect = chai.expect
7 7
8 var utils = require('./utils') 8 var utils = require('./utils')
9 var webtorrent = require(__dirname + '/../../src/webTorrentNode') 9 var webtorrent = require(__dirname + '/../../lib/webTorrentNode')
10 webtorrent.silent = true 10 webtorrent.silent = true
11 11
12 describe('Test multiple pods', function () { 12 describe('Test multiple pods', function () {
diff --git a/test/api/singlePod.js b/tests/api/singlePod.js
index a8ae43aee..ce3ca80f2 100644
--- a/test/api/singlePod.js
+++ b/tests/api/singlePod.js
@@ -6,7 +6,7 @@
6 var fs = require('fs') 6 var fs = require('fs')
7 var expect = chai.expect 7 var expect = chai.expect
8 8
9 var webtorrent = require(__dirname + '/../../src/webTorrentNode') 9 var webtorrent = require(__dirname + '/../../lib/webTorrentNode')
10 webtorrent.silent = true 10 webtorrent.silent = true
11 11
12 var utils = require('./utils') 12 var utils = require('./utils')
diff --git a/test/api/utils.js b/tests/api/utils.js
index afb0abb33..afb0abb33 100644
--- a/test/api/utils.js
+++ b/tests/api/utils.js
diff --git a/test/index.js b/tests/index.js
index ccebbfe51..ccebbfe51 100644
--- a/test/index.js
+++ b/tests/index.js