tests
This commit is contained in:
parent
588debfaa0
commit
7a464f7d36
5 changed files with 85 additions and 68 deletions
20
Makefile
20
Makefile
|
@ -22,7 +22,7 @@ MODULES="php"
|
|||
pageList = $(shell $(CURDIR)/$(NODEJQ) -r ".pages[]" $(CURDIR)/$(CONF))
|
||||
noExt = $(shell echo $(i) | cut -d '.' -f1)
|
||||
|
||||
all: builddirs npm_dependencies composer ejs minify-all copy-img copy-php
|
||||
all: builddirs npm_dependencies ejs minify-all copy-img copy-php
|
||||
|
||||
ejs:
|
||||
$(foreach i,$(pageList), \
|
||||
|
@ -43,12 +43,11 @@ copy-img:
|
|||
|
||||
copy-php:
|
||||
cp -v $(CURDIR)/src/static/php/*.php $(CURDIR)/build/php/
|
||||
cp -v $(CURDIR)/src/Classes/*.php $(CURDIR)/build/php/classes/
|
||||
cp -v $(CURDIR)/src/Classes/*.php $(CURDIR)/build/php/includes/Classes/
|
||||
|
||||
install: installdirs
|
||||
cp -rv $(CURDIR)/build/* $(DESTDIR)/
|
||||
cp -rv $(CURDIR)/vendor $(DESTDIR)/
|
||||
cp $(CURDIR)/src/config.json $(DESTDIR)/
|
||||
cp $(CURDIR)/src/*.json $(DESTDIR)/
|
||||
mv $(DESTDIR)/html/min/* $(DESTDIR)/public/
|
||||
mv $(DESTDIR)/js/* $(DESTDIR)/public/
|
||||
mv $(DESTDIR)/css/* $(DESTDIR)/public/
|
||||
|
@ -62,6 +61,10 @@ install: installdirs
|
|||
mv $(DESTDIR)/img $(DESTDIR)/public/
|
||||
mv $(DESTDIR)/grill.php $(DESTDIR)/public/
|
||||
mv $(DESTDIR)/upload.php $(DESTDIR)/public/
|
||||
cd $(DESTDIR)/ && $(CURL) -o composer-setup.php https://raw.githubusercontent.com/composer/getcomposer.org/main/web/installer
|
||||
cd $(DESTDIR)/ && $(PHP) composer-setup.php --quiet
|
||||
cd $(DESTDIR)/ && rm composer-setup.php
|
||||
cd $(DESTDIR)/ && php composer.phar update && php composer.phar install && php composer.phar dump-autoload
|
||||
|
||||
dist:
|
||||
DESTDIR=$(TMPDIR)/uguu-$(PKGVERSION)
|
||||
|
@ -83,13 +86,6 @@ uninstall:
|
|||
npm_dependencies:
|
||||
$(NPM) install
|
||||
|
||||
composer:
|
||||
$(CURL) -o composer-setup.php https://raw.githubusercontent.com/composer/getcomposer.org/main/web/installer
|
||||
$(PHP) composer-setup.php --quiet
|
||||
rm composer-setup.php
|
||||
php composer.phar update
|
||||
php composer.phar install
|
||||
|
||||
build-image:
|
||||
tar --exclude='./uguuForDocker.tar.gz' --exclude='./vendor' --exclude='./node_modules' -czf uguuForDocker.tar.gz .
|
||||
mv uguuForDocker.tar.gz docker/
|
||||
|
@ -104,5 +100,5 @@ purge-container:
|
|||
fi;
|
||||
|
||||
builddirs:
|
||||
mkdir -p $(CURDIR)/build $(CURDIR)/build/img $(CURDIR)/build/html $(CURDIR)/build/html/min $(CURDIR)/build/html/unmin $(CURDIR)/build/js $(CURDIR)/build/css $(CURDIR)/build/php $(CURDIR)/build/php/classes $(CURDIR)/build/public
|
||||
mkdir -p $(CURDIR)/build $(CURDIR)/build/img $(CURDIR)/build/html $(CURDIR)/build/html/min $(CURDIR)/build/html/unmin $(CURDIR)/build/js $(CURDIR)/build/css $(CURDIR)/build/php $(CURDIR)/build/php/includes $(CURDIR)/build/php/includes/Classes $(CURDIR)/build/public
|
||||
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
{
|
||||
"name": "pomf/uguu",
|
||||
"description": "Uguu is a simple lightweight temporary file host with support for drop, paste, click and API uploading.",
|
||||
"type": "library",
|
||||
"license": "GPL-3.0",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Pomf\\Uguu\\": "src/",
|
||||
"Pomf\\Uguu\\Classes\\": "src/Classes"
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Go Johansson (neku)",
|
||||
"email": "neku@pomf.se"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "stable",
|
||||
"require": {
|
||||
"ext-fileinfo": "*",
|
||||
"ext-pdo": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5.27",
|
||||
"squizlabs/php_codesniffer": "^3.7.1",
|
||||
"phpmd/phpmd": "^2.13.0",
|
||||
"friendsofphp/php-cs-fixer": "^v2.19.3",
|
||||
"phpstan/phpstan": "^1.9.3",
|
||||
"vimeo/psalm": "^5.2.0"
|
||||
}
|
||||
}
|
31
src/composer.json
Normal file
31
src/composer.json
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "pomf/uguu",
|
||||
"description": "Uguu is a simple lightweight temporary file host with support for drop, paste, click and API uploading.",
|
||||
"type": "library",
|
||||
"license": "GPL-3.0",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Pomf\\Uguu\\": "/",
|
||||
"Pomf\\Uguu\\Classes\\": "includes/Classes"
|
||||
}
|
||||
},
|
||||
"authors": [
|
||||
{
|
||||
"name": "Go Johansson (neku)",
|
||||
"email": "neku@pomf.se"
|
||||
}
|
||||
],
|
||||
"minimum-stability": "stable",
|
||||
"require": {
|
||||
"ext-fileinfo": "*",
|
||||
"ext-pdo": "*"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpunit/phpunit": "^9.5.27",
|
||||
"squizlabs/php_codesniffer": "^3.7.1",
|
||||
"phpmd/phpmd": "^2.13.0",
|
||||
"friendsofphp/php-cs-fixer": "^v2.19.3",
|
||||
"phpstan/phpstan": "^1.9.3",
|
||||
"vimeo/psalm": "^5.2.0"
|
||||
}
|
||||
}
|
|
@ -39,6 +39,7 @@
|
|||
"FILES_URL": "https://files.domain.com",
|
||||
"NAME_LENGTH": 8,
|
||||
"ID_CHARSET": "abcdefghijklmnopqrstuvwxyzABCDEFGHJKLMNOPQRSTUVWXYZ",
|
||||
"PHP_ERRORS": true,
|
||||
"BLOCKED_EXTENSIONS": [
|
||||
"exe",
|
||||
"scr",
|
||||
|
|
|
@ -1,26 +1,46 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Uguu
|
||||
*
|
||||
* @copyright Copyright (c) 2022 Go Johansson (nokonoko) <neku@pomf.se>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use Pomf\Uguu\GrillLoader;
|
||||
|
||||
new GrillLoader();
|
||||
|
||||
function checkConfig()
|
||||
{
|
||||
if (!file_exists(__DIR__ . '../config.json')) {
|
||||
throw new Exception('Cant read settings file.', 500);
|
||||
}
|
||||
try {
|
||||
$settings = json_decode(
|
||||
file_get_contents(__DIR__ . '../config.json'),
|
||||
true,
|
||||
);
|
||||
if ($settings['PHP_ERRORS']) {
|
||||
error_reporting(E_ALL);
|
||||
ini_set('display_errors', 1);
|
||||
}
|
||||
}
|
||||
catch (Exception) {
|
||||
throw new Exception('Cant populate settings.', 500);
|
||||
}
|
||||
}
|
||||
|
||||
checkConfig();
|
||||
/**
|
||||
* Uguu
|
||||
*
|
||||
* @copyright Copyright (c) 2022 Go Johansson (nokonoko) <neku@pomf.se>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
require_once __DIR__ . '/../vendor/autoload.php';
|
||||
|
||||
use Pomf\Uguu\GrillLoader;
|
||||
|
||||
new GrillLoader();
|
||||
|
|
Loading…
Add table
Reference in a new issue