chore: bump dependencies, fix StyleCI config, community docs (#91)

* chore: bump dependencies, fix StyleCI config, community docs

* style: fix StyleCI findings

* style: fix StyleCI findings

* style: fix StyleCI findings

* style: fix StyleCI findings
This commit is contained in:
paranarimasu
2020-12-10 23:11:41 -06:00
committed by GitHub
parent 084f393432
commit fc193fdf1d
29 changed files with 473 additions and 598 deletions
+97
View File
@@ -0,0 +1,97 @@
## Assignment
Unless otherwise specified, any issue that does not have an assignee can be claimed by any volunteer.
Please leave a comment in the issue indicating interest so that you can be designated as the assignee by a member. This is a requirement in Github to allow asssignment of contributors outside of the organization by members.
If further discussion is needed before work can be started, please make use of the `#design` channel on the discord.
## Development Environment
Ensure that you have a functional local instance of AnimeThemes forked from this repository by following the [Installation Guide](https://github.com/AnimeThemes/animethemes-server/wiki/Installation).
Enable your repository in [StyleCI](https://styleci.io/) so that code styling guidelines are followed. At the time of writing, analysis is run on push and merge.
Set this repository as upstream to your fork.
`git remote add upstream https://github.com/AnimeThemes/animethemes-server.git`
Checkout release branch.
`git checkout release-branch`
Pull upstream changes so that your local branch is even with upstream.
`git pull upstream release-branch`
Push upstream changes to your remote if needed.
`git push`
## Feature Branch Workflow
Once your release branch is even with upstream, create feature branch from release branch.
`git branch new-feature-branch`
Switch to feature branch.
`git checkout new-feature-branch`
Make changes in feature branch. Once completed, run tests.
`php artisan config:clear && php artisan test`
Execute static code analysis.
`./vendor/bin/phpstan analyse --memory-limit=2G`
Stage changes. Commit changes. Please include ticket ID's and use [Semantic Commit Messages](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716).
## Cleanup Before Pull Request
Fetch upstream master and merge with your repo's master branch
```
git fetch upstream release-branch
git checkout release-branch
git merge upstream/release-branch
```
If there were any new commits, rebase your development branch
```
git checkout new-feature-branch
git rebase release-branch
```
## Pull Request
Push changes to remote.
`git push --set-upstream origin new-feature-branch`
Confirm StyleCI passing status on push.
Create Pull Request from your new feature branch to upstream release branch.
## Pruning
Once the Pull Request is merged, delete the feature branch locally.
`git branch -d new-feature-branch`
Delete the remote feature branch.
`git push origin --delete new-feature-branch`
Pull upstream changes so that your local branch is even with upstream.
`git pull upstream release-branch`
Push upstream changes to your remote if needed.
`git push`
## References
* [Semantic Commit Messages](https://gist.github.com/joshbuchea/6f47e86d2510bce28f8e7f42ae84c716)
* [Github Forking](https://gist.github.com/Chaser324/ce0505fbed06b947d962)
+7 -13
View File
@@ -1,13 +1,7 @@
php:
preset: laravel
disabled:
- unused_use
finder:
not-name:
- index.php
- server.php
js:
finder:
not-name:
- webpack.mix.js
css: true
preset: laravel
disabled:
- unused_use
finder:
not-name:
- index.php
- server.php
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2017 paranarimasu
Copyright (c) 2020 AnimeThemes
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+9 -16
View File
@@ -1,4 +1,11 @@
[AnimeThemes.moe](https://animethemes.moe/) is a hosting solution for [/r/AnimeThemes](https://www.reddit.com/r/AnimeThemes/), a simple and consistent repository of anime opening and ending themes.
<p align="center">
<a href="https://github.styleci.io/repos/111264405"><img src="https://github.styleci.io/repos/111264405/shield" alt="StyleCI"></a>
<a href="https://discordapp.com/invite/m9zbVyQ"><img src="https://img.shields.io/discord/354388306580078594.svg?label=&logo=discord&logoColor=ffffff&color=7389D8&labelColor=6A7EC2"></a>
<a href="https://github.com/AnimeThemes/animethemes-server/blob/master/LICENSE"><img src="https://img.shields.io/github/license/AnimeThemes/animethemes-server"></a>
<a href="https://reddit.com/r/AnimeThemes"><img src="https://img.shields.io/reddit/subreddit-subscribers/AnimeThemes?style=social"></a>
</p>
This is the repository for the server application that is responsible for AnimeThemes.moe resource management, API, and other services related to serving the AnimeThemes database.
# Staff
@@ -6,20 +13,6 @@
* ProWeebDev ([Github](https://github.com/ProWeebDev))
* Gaporigo ([Github](https://github.com/Gaporigo))
# Requirements
AnimeThemes runs on Laravel 8.x and has the same requirements
* A web server
* `PHP >= 7.3.0`
* `composer`
* `npm`
# Installation
* Clone the repository
* Create/edit the `.env` file, providing database and S3 storage credentials
* Run `composer install` to download application packages
* Run `npm install` to download JavaScript packages
* Run `npm run dev` to install vendor JavaScript
* Run `php artisan migrate --seed` to initialize the database
Please review the [Installation Guide](https://github.com/AnimeThemes/animethemes-server/wiki/Installation) in the wiki for detailed instructions.
@@ -13,7 +13,7 @@ class AnnouncementCreateCommand extends Command
*
* @var string
*/
protected $signature = 'create:announcement
protected $signature = 'create:announcement
{--alias= : An internal identifier with which an announcement can be referred}
{--content= : The Announcement Text}';
@@ -46,6 +46,7 @@ class AnnouncementCreateCommand extends Command
if (empty($alias)) {
LOG::error('alias is required');
$this->error('alias is required');
return;
}
@@ -54,6 +55,7 @@ class AnnouncementCreateCommand extends Command
if (empty($content)) {
LOG::error('content is required');
$this->error('content is required');
return;
}
@@ -62,14 +64,15 @@ class AnnouncementCreateCommand extends Command
if ($announcement) {
LOG::error("Announcement '{$alias}' already exists");
$this->error("Announcement '{$alias}' already exists");
return;
}
// Create the Announcement
$result = Announcement::create(array(
$result = Announcement::create([
'alias' => $alias,
'content' => $content
));
'content' => $content,
]);
// Confirm if Announcement was created
if ($result->exists()) {
@@ -45,14 +45,16 @@ class AnnouncementDeleteCommand extends Command
if (empty($alias)) {
LOG::error('alias is required');
$this->error('alias is required');
return;
}
// Announcement must exist to be deleted
$announcement = Announcement::where('alias', $alias)->first();
if (!$announcement) {
if (! $announcement) {
LOG::error("Announcement '{$alias}' does not exist");
$this->error("Announcement '{$alias}' does not exist");
return;
}
@@ -45,14 +45,16 @@ class AnnouncementReadCommand extends Command
if (empty($alias)) {
LOG::error('alias is required');
$this->error('alias is required');
return;
}
// Announcement must exist to be read
$announcement = Announcement::where('alias', $alias)->first();
if (!$announcement) {
if (! $announcement) {
LOG::error("Announcement '{$alias}' does not exist");
$this->error("Announcement '{$alias}' does not exist");
return;
}
@@ -63,7 +65,7 @@ class AnnouncementReadCommand extends Command
[
'alias' => $announcement->alias,
'content' => $announcement->content,
]
],
];
$this->table($headers, $data);
@@ -46,6 +46,7 @@ class AnnouncementUpdateCommand extends Command
if (empty($alias)) {
LOG::error('alias is required');
$this->error('alias is required');
return;
}
@@ -54,14 +55,15 @@ class AnnouncementUpdateCommand extends Command
// Announcement must exist to be updated
$announcement = Announcement::where('alias', $alias)->first();
if (!$announcement) {
if (! $announcement) {
LOG::error("Announcement '{$alias}' does not exist");
$this->error("Announcement '{$alias}' does not exist");
return;
}
// Update Content if set
if (!empty($content)) {
if (! empty($content)) {
$announcement->content = $content;
}
+13 -7
View File
@@ -10,7 +10,6 @@ use Illuminate\Support\Facades\Storage;
class VideoReconcileCommand extends Command
{
// Result Counts
public $created = 0;
public $created_failed = 0;
@@ -63,6 +62,7 @@ class VideoReconcileCommand extends Command
$fs_videos = array_map(function ($file) {
$fs_video = new Video;
$fs_video->fill($file);
return $fs_video;
}, $files);
@@ -108,31 +108,37 @@ class VideoReconcileCommand extends Command
}
// Callback for video comparison in set operation
public static function compareVideos($a, $b) {
public static function compareVideos($a, $b)
{
return strcmp(VideoReconcileCommand::reconciliationString($a), VideoReconcileCommand::reconciliationString($b));
}
// Represent video with attributes that correspond to WebM metadata
// For reconciliation purposes, other attributes such as ID and timestamps do not apply
public static function reconciliationString($video) {
public static function reconciliationString($video)
{
return "basename:{$video->basename},filename:{$video->filename},path:{$video->path},size:{$video->size}";
}
// Reconciliation Results
public function hasResults() {
public function hasResults()
{
return $this->hasChanges() || $this->hasFailures();
}
public function hasChanges() {
public function hasChanges()
{
return $this->created > 0 || $this->deleted > 0;
}
public function hasFailures() {
public function hasFailures()
{
return $this->created_failed > 0 || $this->deleted_failed > 0;
}
public function printResults() {
public function printResults()
{
if ($this->hasResults()) {
if ($this->hasChanges()) {
Log::info("{$this->created} Videos created, {$this->deleted} Videos deleted");
+7 -5
View File
@@ -2,15 +2,17 @@
namespace App\Grills;
class Grill {
class Grill
{
private $path;
public function __construct($path) {
public function __construct($path)
{
$this->path = $path;
}
public function getPath() {
public function getPath()
{
return $this->path;
}
}
}
+6 -5
View File
@@ -6,9 +6,10 @@ use App\Grills\Grill;
use Faker\Factory;
use Illuminate\Support\Facades\Storage;
class GrillFactory {
public static function getGrill() {
class GrillFactory
{
public static function getGrill()
{
// Retrieve grills through Storage Facade [see config/filesystems.php]
$grill_disk = Storage::disk('grill');
$grills = $grill_disk->files();
@@ -20,5 +21,5 @@ class GrillFactory {
// Return Grill
return new Grill($grill_path);
}
}
}
}
+6 -5
View File
@@ -3,23 +3,24 @@
namespace App\Http\Controllers;
use App\Models\Video;
use Illuminate\Http\Request;
class SitemapController extends Controller
{
public function index() {
public function index()
{
$video = Video::orderBy('updated_at', 'desc')->first();
return response()->view('sitemap.index', [
'video' => $video
'video' => $video,
])->header('Content-Type', 'text/xml');
}
public function videos() {
public function videos()
{
$video = Video::orderBy('updated_at', 'desc')->first();
return response()->view('sitemap.videos', [
'video' => $video
'video' => $video,
])->header('Content-Type', 'text/xml');
}
}
+2 -1
View File
@@ -8,7 +8,8 @@ use Symfony\Component\HttpFoundation\StreamedResponse;
class VideosController extends Controller
{
public function show($alias) {
public function show($alias)
{
set_time_limit(0);
$video = Video::where('basename', $alias)->orWhere('filename', $alias)->first();
+3 -2
View File
@@ -9,7 +9,8 @@ use Illuminate\Http\Request;
class WelcomeController extends Controller
{
public function do() {
public function do()
{
// View Data
$grill = GrillFactory::getGrill();
$videoCount = Video::count();
@@ -18,7 +19,7 @@ class WelcomeController extends Controller
return view('welcome', [
'announcements' => $announcements,
'grill' => $grill->getPath(),
'videoCount' => $videoCount
'videoCount' => $videoCount,
]);
}
}
+1 -1
View File
@@ -20,7 +20,7 @@ class Kernel extends HttpKernel
\Illuminate\Foundation\Http\Middleware\ValidatePostSize::class,
//\App\Http\Middleware\TrimStrings::class,
//\Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class,
\App\Http\Middleware\LoggerMiddleware::class
\App\Http\Middleware\LoggerMiddleware::class,
];
/**
+2 -2
View File
@@ -16,11 +16,11 @@ class LoggerMiddleware
*/
public function handle($request, Closure $next)
{
Log::info("Request Info", [
Log::info('Request Info', [
'method' => $request->method(),
'full-url' => $request->fullUrl(),
'ip' => $request->ip(),
'headers' => $request->headers->all()
'headers' => $request->headers->all(),
]);
return $next($request);
+1 -1
View File
@@ -2,9 +2,9 @@
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
Generated
+249 -217
View File
File diff suppressed because it is too large Load Diff
@@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateVideosTable extends Migration
{
@@ -1,9 +1,7 @@
<?php
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
class CreateNaturalSort extends Migration
{
@@ -15,7 +13,7 @@ class CreateNaturalSort extends Migration
public function up()
{
DB::unprepared("DROP FUNCTION IF EXISTS `udf_FirstNumberPos`;
CREATE FUNCTION `udf_FirstNumberPos` (`instring` varchar(4000))
CREATE FUNCTION `udf_FirstNumberPos` (`instring` varchar(4000))
RETURNS int
LANGUAGE SQL
DETERMINISTIC
@@ -25,7 +23,7 @@ class CreateNaturalSort extends Migration
DECLARE position int;
DECLARE tmp_position int;
SET position = 5000;
SET tmp_position = LOCATE('0', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF;
SET tmp_position = LOCATE('0', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF;
SET tmp_position = LOCATE('1', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF;
SET tmp_position = LOCATE('2', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF;
SET tmp_position = LOCATE('3', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF;
@@ -35,13 +33,13 @@ class CreateNaturalSort extends Migration
SET tmp_position = LOCATE('7', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF;
SET tmp_position = LOCATE('8', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF;
SET tmp_position = LOCATE('9', instring); IF (tmp_position > 0 AND tmp_position < position) THEN SET position = tmp_position; END IF;
IF (position = 5000) THEN RETURN 0; END IF;
RETURN position;
END");
DB::unprepared("DROP FUNCTION IF EXISTS `udf_NaturalSortFormat`;
CREATE FUNCTION `udf_NaturalSortFormat` (`instring` varchar(4000), `numberLength` int, `sameOrderChars` char(50))
CREATE FUNCTION `udf_NaturalSortFormat` (`instring` varchar(4000), `numberLength` int, `sameOrderChars` char(50))
RETURNS varchar(4000)
LANGUAGE SQL
DETERMINISTIC
@@ -55,7 +53,7 @@ class CreateNaturalSort extends Migration
DECLARE totalPadLength int;
DECLARE i int;
DECLARE sameOrderCharsLen int;
SET totalPadLength = 0;
SET instring = TRIM(instring);
SET sortString = instring;
@@ -63,34 +61,34 @@ class CreateNaturalSort extends Migration
SET numEndIndex = 0;
SET i = 1;
SET sameOrderCharsLen = CHAR_LENGTH(sameOrderChars);
WHILE (i <= sameOrderCharsLen) DO
SET sortString = REPLACE(sortString, SUBSTRING(sameOrderChars, i, 1), ' ');
SET i = i + 1;
END WHILE;
WHILE (numStartIndex <> 0) DO
SET numStartIndex = numStartIndex + numEndIndex;
SET numEndIndex = numStartIndex;
WHILE (udf_FirstNumberPos(SUBSTRING(instring, numEndIndex, 1)) = 1) DO
SET numEndIndex = numEndIndex + 1;
END WHILE;
SET numEndIndex = numEndIndex - 1;
SET padLength = numberLength - (numEndIndex + 1 - numStartIndex);
IF padLength < 0 THEN
SET padLength = 0;
END IF;
SET sortString = INSERT(sortString, numStartIndex + totalPadLength, 0, REPEAT('0', padLength));
SET totalPadLength = totalPadLength + padLength;
SET numStartIndex = udf_FirstNumberPos(RIGHT(instring, CHAR_LENGTH(instring) - numEndIndex));
END WHILE;
RETURN sortString;
END");
}
@@ -102,7 +100,7 @@ class CreateNaturalSort extends Migration
*/
public function down()
{
DB::unprepared("DROP FUNCTION IF EXISTS `udf_FirstNumberPos`");
DB::unprepared("DROP FUNCTION IF EXISTS `udf_NaturalSortFormat`");
DB::unprepared('DROP FUNCTION IF EXISTS `udf_FirstNumberPos`');
DB::unprepared('DROP FUNCTION IF EXISTS `udf_NaturalSortFormat`');
}
}
@@ -1,8 +1,8 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class AddBasenameToVideosTable extends Migration
{
-1
View File
@@ -4,7 +4,6 @@ use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
public function run()
{
$this->call(VideosTableSeeder::class);
+2 -1
View File
@@ -7,7 +7,8 @@ use Illuminate\Support\Facades\Storage;
class VideosTableSeeder extends Seeder
{
public function run() {
public function run()
{
// Remove any existing rows in Videos table
// We want this table to match storage, avoiding the need for reconciliation
DB::table('videos')->delete();
+21 -176
View File
@@ -1035,11 +1035,6 @@
"integrity": "sha512-shAmDyaQC4H92APFoIaVDHCx5bStIocgvbwQyxPRrbUY20V1EYTbSDchWbuwlMG3V17cprZhA6+78JfB+3DTPw==",
"dev": true
},
"@types/color-name": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@types/color-name/-/color-name-1.1.1.tgz",
"integrity": "sha512-rr+OQyAjxze7GgWrSaJwydHStIhHq2lvY3BOC2Mj7KnzI7XK0Uw1TOOdI9lDoajEbSWLiYgoo4f1R51erQfhPQ=="
},
"@types/glob": {
"version": "7.1.3",
"resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.3.tgz",
@@ -2651,18 +2646,18 @@
}
},
"cross-env": {
"version": "7.0.2",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.2.tgz",
"integrity": "sha512-KZP/bMEOJEDCkDQAyRhu3RL2ZO/SUVrxQVI0G3YEQ+OLbRA3c6zgixe8Mq8a/z7+HKlNEjo8oiLUs8iRijY2Rw==",
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-env/-/cross-env-7.0.3.tgz",
"integrity": "sha512-+/HKd6EgcQCJGh2PSjZuUitQBQynKor4wrFbRg4DtAgS1aWO+gU52xpH7M9ScGgXSYmAVS9bIJ8EzuaGw0oNAw==",
"dev": true,
"requires": {
"cross-spawn": "^7.0.1"
}
},
"cross-spawn": {
"version": "7.0.1",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.1.tgz",
"integrity": "sha512-u7v4o84SwFpD32Z8IIcPZ6z1/ie24O6RU3RbtL5Y316l3KuHVPx9ItBgWQ6VlfAFnRnTtMUrsQ9MUUTuEZjogg==",
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
"integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==",
"dev": true,
"requires": {
"path-key": "^3.1.0",
@@ -4826,9 +4821,9 @@
"dev": true
},
"ini": {
"version": "1.3.5",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.5.tgz",
"integrity": "sha512-RZY5huIKCMRWDUqZlEi72f/lmXKMvuszcMBduliQ3nnWbx9X/ZBQO7DijMEYS9EhHBb2qacRUMtC7svLwe0lcw==",
"version": "1.3.7",
"resolved": "https://registry.npmjs.org/ini/-/ini-1.3.7.tgz",
"integrity": "sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ==",
"dev": true
},
"internal-ip": {
@@ -5712,151 +5707,17 @@
}
},
"modernizr": {
"version": "3.11.3",
"resolved": "https://registry.npmjs.org/modernizr/-/modernizr-3.11.3.tgz",
"integrity": "sha512-912QnDnkDxs1w1EbFD3btEGI67rssfjWwJsVXpyoLBvHUwr0r8x6KN0IUCZFH/5xnK0000YxI0N3qcqHVzWjcQ==",
"version": "3.11.4",
"resolved": "https://registry.npmjs.org/modernizr/-/modernizr-3.11.4.tgz",
"integrity": "sha512-xLtXwvuOqh4WJEKusCmtWLncNWyyjpWDwR7ak9c0oPkR+00tC/6s51Atxf51NKxmPhfVmtQNHU0gYfbIhzixFg==",
"requires": {
"doctrine": "^3.0.0",
"file": "^0.2.2",
"lodash": "^4.17.15",
"lodash": "^4.17.20",
"markdown-it": "^10.0.0",
"mkdirp": "0.5.5",
"requirejs": "^2.3.6",
"yargs": "^15.3.1"
},
"dependencies": {
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
},
"ansi-styles": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz",
"integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==",
"requires": {
"@types/color-name": "^1.1.1",
"color-convert": "^2.0.1"
}
},
"cliui": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
"requires": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
"wrap-ansi": "^6.2.0"
}
},
"color-convert": {
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"requires": {
"color-name": "~1.1.4"
}
},
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
},
"find-up": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
"requires": {
"locate-path": "^5.0.0",
"path-exists": "^4.0.0"
}
},
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
},
"locate-path": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
"requires": {
"p-locate": "^4.1.0"
}
},
"p-locate": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
"requires": {
"p-limit": "^2.2.0"
}
},
"path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="
},
"string-width": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
"integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
"strip-ansi": "^6.0.0"
}
},
"strip-ansi": {
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"requires": {
"ansi-regex": "^5.0.0"
}
},
"wrap-ansi": {
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
"requires": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
"strip-ansi": "^6.0.0"
}
},
"yargs": {
"version": "15.4.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
"requires": {
"cliui": "^6.0.0",
"decamelize": "^1.2.0",
"find-up": "^4.1.0",
"get-caller-file": "^2.0.1",
"require-directory": "^2.1.1",
"require-main-filename": "^2.0.0",
"set-blocking": "^2.0.0",
"string-width": "^4.2.0",
"which-module": "^2.0.0",
"y18n": "^4.0.0",
"yargs-parser": "^18.1.2"
}
},
"yargs-parser": {
"version": "18.1.3",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
}
}
}
},
"move-concurrently": {
@@ -7801,9 +7662,9 @@
"dev": true
},
"sass": {
"version": "1.29.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.29.0.tgz",
"integrity": "sha512-ZpwAUFgnvAUCdkjwPREny+17BpUj8nh5Yr6zKPGtLNTLrmtoRYIjm7njP24COhjJldjwW1dcv52Lpf4tNZVVRA==",
"version": "1.30.0",
"resolved": "https://registry.npmjs.org/sass/-/sass-1.30.0.tgz",
"integrity": "sha512-26EUhOXRLaUY7+mWuRFqGeGGNmhB1vblpTENO1Z7mAzzIZeVxZr9EZoaY1kyGLFWdSOZxRMAufiN2mkbO6dAlw==",
"dev": true,
"requires": {
"chokidar": ">=2.0.0 <4.0.0"
@@ -9949,7 +9810,6 @@
"version": "15.4.1",
"resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz",
"integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==",
"dev": true,
"requires": {
"cliui": "^6.0.0",
"decamelize": "^1.2.0",
@@ -9967,14 +9827,12 @@
"ansi-regex": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg==",
"dev": true
"integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
},
"ansi-styles": {
"version": "4.3.0",
"resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
"integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
"dev": true,
"requires": {
"color-convert": "^2.0.1"
}
@@ -9983,7 +9841,6 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz",
"integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==",
"dev": true,
"requires": {
"string-width": "^4.2.0",
"strip-ansi": "^6.0.0",
@@ -9994,7 +9851,6 @@
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
"integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
"dev": true,
"requires": {
"color-name": "~1.1.4"
}
@@ -10002,20 +9858,17 @@
"color-name": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==",
"dev": true
"integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
},
"emoji-regex": {
"version": "8.0.0",
"resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==",
"dev": true
"integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
},
"find-up": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz",
"integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==",
"dev": true,
"requires": {
"locate-path": "^5.0.0",
"path-exists": "^4.0.0"
@@ -10024,14 +9877,12 @@
"is-fullwidth-code-point": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==",
"dev": true
"integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
},
"locate-path": {
"version": "5.0.0",
"resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz",
"integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==",
"dev": true,
"requires": {
"p-locate": "^4.1.0"
}
@@ -10040,7 +9891,6 @@
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz",
"integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==",
"dev": true,
"requires": {
"p-limit": "^2.2.0"
}
@@ -10048,14 +9898,12 @@
"path-exists": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz",
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==",
"dev": true
"integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w=="
},
"string-width": {
"version": "4.2.0",
"resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
"integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
"dev": true,
"requires": {
"emoji-regex": "^8.0.0",
"is-fullwidth-code-point": "^3.0.0",
@@ -10066,7 +9914,6 @@
"version": "6.0.0",
"resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
"integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
"dev": true,
"requires": {
"ansi-regex": "^5.0.0"
}
@@ -10075,7 +9922,6 @@
"version": "6.2.0",
"resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
"integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
"dev": true,
"requires": {
"ansi-styles": "^4.0.0",
"string-width": "^4.1.0",
@@ -10086,7 +9932,6 @@
"version": "18.1.3",
"resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz",
"integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==",
"dev": true,
"requires": {
"camelcase": "^5.0.0",
"decamelize": "^1.2.0"
+3 -3
View File
@@ -11,15 +11,15 @@
},
"devDependencies": {
"axios": "^0.20",
"cross-env": "^7.0.2",
"cross-env": "^7.0.3",
"laravel-mix": "^5.0.9",
"lodash": "^4.17.20",
"resolve-url-loader": "^3.1.2",
"sass": "^1.29.0",
"sass": "^1.30.0",
"sass-loader": "^10.1.0"
},
"dependencies": {
"jquery": "^3.5.1",
"modernizr": "^3.11.3"
"modernizr": "^3.11.4"
}
}
+1 -1
View File
@@ -9,4 +9,4 @@
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/
*/
+1 -1
View File
@@ -9,4 +9,4 @@
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
*/
+1 -1
View File
@@ -9,4 +9,4 @@
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
*/
-105
View File
@@ -1,105 +0,0 @@
<?php
namespace Tests\Unit;
use App\Console\Commands\VideoReconcileCommand;
use App\Models\Video;
use Illuminate\Support\Str;
use Mockery;
use PHPUnit\Framework\TestCase;
class VideoReconcileTest extends TestCase
{
protected $command;
protected $video_a;
protected $video_b;
protected function setUp(): void {
parent::setUp();
$this->command = new VideoReconcileCommand;
$this->video_a = Mockery::mock(Video::class)->makePartial();
$this->video_b = Mockery::mock(Video::class)->makePartial();
}
public function testNoResults() {
$this->assertFalse($this->command->hasResults());
}
public function testNoResultsVideoCreated() {
$this->command->created++;
$this->assertTrue($this->command->hasResults());
}
public function testNoResultsVideoCreatedFailed() {
$this->command->created_failed++;
$this->assertTrue($this->command->hasResults());
}
public function testNoResultsVideoDeleted() {
$this->command->deleted++;
$this->assertTrue($this->command->hasResults());
}
public function testNoResultsVideoDeletedFailed() {
$this->command->deleted_failed++;
$this->assertTrue($this->command->hasResults());
}
public function testHasChanges() {
$this->assertFalse($this->command->hasChanges());
}
public function testHasChangesFailed() {
$this->command->deleted_failed++;
$this->command->created_failed++;
$this->assertFalse($this->command->hasChanges());
}
public function testHasChangesCreated() {
$this->command->created++;
$this->assertTrue($this->command->hasChanges());
}
public function testHasChangesDeleted() {
$this->command->deleted++;
$this->assertTrue($this->command->hasChanges());
}
public function testHasFailures() {
$this->assertFalse($this->command->hasFailures());
}
public function testHasFailuresSuccess() {
$this->command->created++;
$this->command->deleted++;
$this->assertFalse($this->command->hasFailures());
}
public function testHasFailuresCreated() {
$this->command->created_failed++;
$this->assertTrue($this->command->hasFailures());
}
public function testHasFailuresDeleted() {
$this->command->deleted_failed++;
$this->assertTrue($this->command->hasFailures());
}
public function testReconciliationString() {
$this->assertEquals(VideoReconcileCommand::reconciliationString($this->video_a), "basename:{$this->video_a->basename},filename:{$this->video_a->filename},path:{$this->video_a->path}");
}
public function testCompareVideosEquals() {
$this->assertEquals(VideoReconcileCommand::compareVideos($this->video_a, $this->video_a), 0);
}
public function testCompareVideosNotEquals() {
$this->assertEquals(VideoReconcileCommand::compareVideos($this->video_a, $this->video_b), 0);
}
public function tearDown(): void {
parent::tearDown();
Mockery::close();
}
}