From f9203706f7d0d29079de1320ab755b7993e8d898 Mon Sep 17 00:00:00 2001 From: Pierre Rudloff Date: Mon, 15 May 2017 07:25:14 +0200 Subject: [PATCH] Cleanup root folder (fixes #110) --- .gitignore | 2 +- CONTRIBUTING.md | 2 +- Dockerfile | 2 +- Gruntfile.js | 4 ++-- README.md | 4 ++-- classes/Config.php | 4 ++-- composer.json | 2 +- config.example.yml => config/config.example.yml | 0 config_test.yml => config/config_test.yml | 0 FAQ.md => resources/FAQ.md | 2 +- error.html => resources/error.html | 0 maintenance.html => resources/maintenance.html | 0 manifest.json => resources/manifest.json | 0 nginx.conf => resources/nginx.conf | 0 php.ini => resources/php.ini | 0 sitemap.xml => resources/sitemap.xml | 0 robots.txt | 2 +- templates/inc/head.tpl | 2 +- tests/ConfigTest.php | 4 ++-- tests/FrontControllerTest.php | 2 +- tests/VideoDownloadTest.php | 2 +- 21 files changed, 17 insertions(+), 17 deletions(-) rename config.example.yml => config/config.example.yml (100%) rename config_test.yml => config/config_test.yml (100%) rename FAQ.md => resources/FAQ.md (98%) rename error.html => resources/error.html (100%) rename maintenance.html => resources/maintenance.html (100%) rename manifest.json => resources/manifest.json (100%) rename nginx.conf => resources/nginx.conf (100%) rename php.ini => resources/php.ini (100%) rename sitemap.xml => resources/sitemap.xml (100%) diff --git a/.gitignore b/.gitignore index 7a3db24..66be2e1 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,6 @@ ffmpeg-*/ alltube-*.zip coverage/ bower_components/ -config.yml +config/config.yml docs/ clover.xml diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 898a247..bdf974a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -2,5 +2,5 @@ Before opening a new issue, make sure that: * It has not already been [reported](https://github.com/Rudloff/alltube/issues). -* You read the [README](README.md) and the [FAQ](FAQ.md). +* You read the [README](README.md) and the [FAQ](resources/FAQ.md). * You can provide **logs**. diff --git a/Dockerfile b/Dockerfile index 211291d..209d2e7 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,7 +7,7 @@ RUN docker-php-ext-install intl RUN docker-php-ext-install zip RUN a2enmod rewrite RUN curl -sS https://getcomposer.org/installer | php -COPY php.ini /usr/local/etc/php/ +COPY resources/php.ini /usr/local/etc/php/ COPY . /var/www/html/ RUN php composer.phar install --prefer-dist RUN npm install diff --git a/Gruntfile.js b/Gruntfile.js index dcc42ff..8f75c48 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -68,7 +68,7 @@ module.exports = function (grunt) { options: { archive: 'alltube-<%= githash.main.tag %>.zip' }, - src: ['*.php', '!config.yml', 'dist/**', '.htaccess', 'img/**', 'LICENSE', 'README.md', 'robots.txt', 'sitemap.xml', 'templates/**', 'templates_c/', 'vendor/**', 'classes/**', 'controllers/**', 'bower_components/**', '!vendor/ffmpeg/**', '!vendor/bin/ffmpeg', '!vendor/phpunit/**', '!vendor/squizlabs/**'] + src: ['*.php', '!config/config.yml', 'dist/**', '.htaccess', 'img/**', 'LICENSE', 'README.md', 'robots.txt', 'resources/sitemap.xml', 'templates/**', 'templates_c/', 'vendor/**', 'classes/**', 'controllers/**', 'bower_components/**', '!vendor/ffmpeg/**', '!vendor/bin/ffmpeg', '!vendor/phpunit/**', '!vendor/squizlabs/**'] } }, phpdocumentor: { @@ -80,7 +80,7 @@ module.exports = function (grunt) { }, jsonlint: { manifests: { - src: ['*.json', '*.webapp'], + src: ['*.json', 'resources/*.json'], options: { format: true } diff --git a/README.md b/README.md index 776aca9..1781fcb 100644 --- a/README.md +++ b/README.md @@ -48,7 +48,7 @@ composer install If you want to use a custom config, you need to create a config file: ```bash -cp config.example.yml config.yml +cp config/config.example.yml config/config.yml ``` ## PHP requirements @@ -168,7 +168,7 @@ You can also have a look at this [example project](https://github.com/Rudloff/al ## FAQ -Please read the [FAQ](FAQ.md) before reporting any issue. +Please read the [FAQ](resources/FAQ.md) before reporting any issue. ## License diff --git a/classes/Config.php b/classes/Config.php index be22a3e..306c28e 100644 --- a/classes/Config.php +++ b/classes/Config.php @@ -126,13 +126,13 @@ class Config * * @return Config */ - public static function getInstance($yamlfile = 'config.yml') + public static function getInstance($yamlfile = 'config/config.yml') { $yamlPath = __DIR__.'/../'.$yamlfile; if (is_null(self::$instance) || self::$instance->file != $yamlfile) { if (is_file($yamlfile)) { $options = Yaml::parse(file_get_contents($yamlPath)); - } elseif ($yamlfile == 'config.yml' || empty($yamlfile)) { + } elseif ($yamlfile == 'config/config.yml' || empty($yamlfile)) { /* Allow for the default file to be missing in order to not surprise users that did not create a config file diff --git a/composer.json b/composer.json index f254ef0..18f4a7b 100644 --- a/composer.json +++ b/composer.json @@ -27,7 +27,7 @@ "extra": { "paas": { "nginx-includes": [ - "nginx.conf" + "resources/nginx.conf" ] } }, diff --git a/config.example.yml b/config/config.example.yml similarity index 100% rename from config.example.yml rename to config/config.example.yml diff --git a/config_test.yml b/config/config_test.yml similarity index 100% rename from config_test.yml rename to config/config_test.yml diff --git a/FAQ.md b/resources/FAQ.md similarity index 98% rename from FAQ.md rename to resources/FAQ.md index 90e10c7..b5f01bc 100644 --- a/FAQ.md +++ b/resources/FAQ.md @@ -9,7 +9,7 @@ You can ususally download the video by doing *File > Save to* or *ctrl + S*. ## How do I change config parameters? -You need to create a YAML file called `config.yml` at the root of your project. +You need to create a YAML file called `config.yml` in the `config/` folder. Here are the parameters that you can set: * `youtubedl`: path to your youtube-dl binary diff --git a/error.html b/resources/error.html similarity index 100% rename from error.html rename to resources/error.html diff --git a/maintenance.html b/resources/maintenance.html similarity index 100% rename from maintenance.html rename to resources/maintenance.html diff --git a/manifest.json b/resources/manifest.json similarity index 100% rename from manifest.json rename to resources/manifest.json diff --git a/nginx.conf b/resources/nginx.conf similarity index 100% rename from nginx.conf rename to resources/nginx.conf diff --git a/php.ini b/resources/php.ini similarity index 100% rename from php.ini rename to resources/php.ini diff --git a/sitemap.xml b/resources/sitemap.xml similarity index 100% rename from sitemap.xml rename to resources/sitemap.xml diff --git a/robots.txt b/robots.txt index 48fbc65..d645b36 100644 --- a/robots.txt +++ b/robots.txt @@ -1 +1 @@ -Sitemap: http://alltubedownload.net/sitemap.xml +Sitemap: http://alltubedownload.net/resources/sitemap.xml diff --git a/templates/inc/head.tpl b/templates/inc/head.tpl index f32f5bd..392c7c2 100644 --- a/templates/inc/head.tpl +++ b/templates/inc/head.tpl @@ -20,6 +20,6 @@ - + diff --git a/tests/ConfigTest.php b/tests/ConfigTest.php index f0ba659..f37935c 100644 --- a/tests/ConfigTest.php +++ b/tests/ConfigTest.php @@ -24,7 +24,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->config = Config::getInstance('config_test.yml'); + $this->config = Config::getInstance('config/config_test.yml'); } /** @@ -83,7 +83,7 @@ class ConfigTest extends \PHPUnit_Framework_TestCase Config::destroyInstance(); putenv('CONVERT=1'); putenv('PYTHON=foo'); - $config = Config::getInstance('config_test.yml'); + $config = Config::getInstance('config/config_test.yml'); $this->assertEquals($config->convert, true); $this->assertEquals($config->python, 'foo'); putenv('CONVERT'); diff --git a/tests/FrontControllerTest.php b/tests/FrontControllerTest.php index a307252..55d1440 100644 --- a/tests/FrontControllerTest.php +++ b/tests/FrontControllerTest.php @@ -55,7 +55,7 @@ class FrontControllerTest extends \PHPUnit_Framework_TestCase $this->request = Request::createFromEnvironment(Environment::mock()); $this->response = new Response(); $this->container['view'] = ViewFactory::create($this->container, $this->request); - $this->controller = new FrontController($this->container, Config::getInstance('config_test.yml')); + $this->controller = new FrontController($this->container, Config::getInstance('config/config_test.yml')); $this->container['router']->map(['GET'], '/', [$this->controller, 'index']) ->setName('index'); $this->container['router']->map(['GET'], '/video', [$this->controller, 'video']) diff --git a/tests/VideoDownloadTest.php b/tests/VideoDownloadTest.php index 60d7f0f..5227da1 100644 --- a/tests/VideoDownloadTest.php +++ b/tests/VideoDownloadTest.php @@ -25,7 +25,7 @@ class VideoDownloadTest extends \PHPUnit_Framework_TestCase */ protected function setUp() { - $this->download = new VideoDownload(Config::getInstance('config_test.yml')); + $this->download = new VideoDownload(Config::getInstance('config/config_test.yml')); } /**