From 7e742518bc6b16540836de5ee546eb8195284735 Mon Sep 17 00:00:00 2001 From: Nabeel S Date: Fri, 28 Feb 2020 16:06:45 -0500 Subject: [PATCH] Module/plugin installation working #593 (#594) * Remove the Sample module * 593-Fix-Modules-From-Composer * Fix pre/post install scripts in composer #593 * Formatting --- app/Console/Commands/ClearCaches.php | 41 +++ composer.json | 31 +- composer.lock | 346 ++++++++++++++---- config/modules.php | 1 + modules/.gitignore | 1 - modules/Sample/Awards/SampleAward.php | 27 -- modules/Sample/Config/config.php | 5 - .../Database/seeders/SampleDatabaseSeeder.php | 21 -- .../Controllers/Admin/AdminController.php | 65 ---- .../Http/Controllers/Api/SampleController.php | 38 -- .../Http/Controllers/SampleController.php | 67 ---- modules/Sample/Http/Routes/admin.php | 8 - modules/Sample/Http/Routes/api.php | 17 - modules/Sample/Http/Routes/web.php | 9 - .../Sample/Listeners/TestEventListener.php | 17 - modules/Sample/Models/SampleTable.php | 15 - .../Sample/Providers/EventServiceProvider.php | 25 -- .../Providers/SampleServiceProvider.php | 153 -------- .../Resources/views/admin/create.blade.php | 14 - .../Resources/views/admin/index.blade.php | 18 - .../Sample/Resources/views/index.blade.php | 9 - .../Resources/views/layouts/admin.blade.php | 5 - .../views/layouts/frontend.blade.php | 5 - modules/Sample/composer.json | 24 -- modules/Sample/module.json | 15 - resources/stubs/modules/composer.stub | 6 +- tests/AwardsTest.php | 2 + 27 files changed, 343 insertions(+), 642 deletions(-) create mode 100644 app/Console/Commands/ClearCaches.php delete mode 100644 modules/Sample/Awards/SampleAward.php delete mode 100644 modules/Sample/Config/config.php delete mode 100644 modules/Sample/Database/seeders/SampleDatabaseSeeder.php delete mode 100644 modules/Sample/Http/Controllers/Admin/AdminController.php delete mode 100644 modules/Sample/Http/Controllers/Api/SampleController.php delete mode 100644 modules/Sample/Http/Controllers/SampleController.php delete mode 100644 modules/Sample/Http/Routes/admin.php delete mode 100644 modules/Sample/Http/Routes/api.php delete mode 100644 modules/Sample/Http/Routes/web.php delete mode 100644 modules/Sample/Listeners/TestEventListener.php delete mode 100644 modules/Sample/Models/SampleTable.php delete mode 100644 modules/Sample/Providers/EventServiceProvider.php delete mode 100644 modules/Sample/Providers/SampleServiceProvider.php delete mode 100644 modules/Sample/Resources/views/admin/create.blade.php delete mode 100644 modules/Sample/Resources/views/admin/index.blade.php delete mode 100644 modules/Sample/Resources/views/index.blade.php delete mode 100644 modules/Sample/Resources/views/layouts/admin.blade.php delete mode 100644 modules/Sample/Resources/views/layouts/frontend.blade.php delete mode 100644 modules/Sample/composer.json delete mode 100644 modules/Sample/module.json diff --git a/app/Console/Commands/ClearCaches.php b/app/Console/Commands/ClearCaches.php new file mode 100644 index 00000000..32791cf9 --- /dev/null +++ b/app/Console/Commands/ClearCaches.php @@ -0,0 +1,41 @@ +=7.2", @@ -13,11 +14,13 @@ "ext-simplexml": "*", "ext-pdo": "*", "composer/composer": "~1.8.0", + "composer/installers": "~1.0", "laravel/framework": "~6.0", "akaunting/money": "^1.0", "anhskohbo/no-captcha": "^3.0", "appstract/laravel-opcache": "^2.0", "arrilot/laravel-widgets": "~3.13.0", + "codedge/laravel-selfupdater": "^2.5", "doctrine/dbal": "~2.9.2", "elcobvg/laravel-opcache": "~0.4", "facade/ignition": "^1.6", @@ -50,7 +53,8 @@ "theiconic/php-ga-measurement-protocol": "2.7.*", "tivie/php-os-detector": "~1.1.0", "webpatser/laravel-uuid": "~3.0", - "codedge/laravel-selfupdater": "^2.5" + "oomphinc/composer-installers-extender": "^1.1", + "phpvms/sample-module": "^1.0" }, "require-dev": { "barryvdh/laravel-debugbar": "^3.0", @@ -86,17 +90,28 @@ ] }, "extra": { + "installer-types": ["phpvms-module"], "installer-paths": { - "modules/{$name}/": [ - "type:laravel-library", - "type:phpvms-plugin" - ] - } + "modules/{$name}/": ["type:phpvms-module"] + }, + "module-dir": "modules" }, "scripts": { + "pre-package-uninstall": [ + "@php -r \"array_map('unlink', glob('bootstrap/cache/*'));\"" + ], + "post-package-uninstall": [ + "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", + "@php artisan package:discover --ansi", + "@php artisan phpvms:caches" + ], + "pre-autoload-dump": [ + "@php -r \"array_map('unlink', glob('bootstrap/cache/*'));\"" + ], "post-autoload-dump": [ "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", - "@php artisan package:discover --ansi" + "@php artisan package:discover --ansi", + "@php artisan phpvms:caches" ] }, "config": { diff --git a/composer.lock b/composer.lock index 2f20e358..913446a9 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "5f8a87c7717ad2b6ed1d6cf1c585cc3d", + "content-hash": "30e2e357e76a813ae0179df9e40215e9", "packages": [ { "name": "akaunting/money", @@ -358,7 +358,7 @@ { "name": "Tobias Nyholm", "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/nyholm" + "homepage": "https://github.com/Nyholm" } ], "description": "Common classes for PSR-6 adapters", @@ -413,7 +413,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -426,7 +426,7 @@ { "name": "Tobias Nyholm", "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/nyholm" + "homepage": "https://github.com/Nyholm" } ], "description": "A PSR-6 cache implementation using a php array. This implementation supports tags", @@ -475,7 +475,7 @@ "/Tests/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -488,7 +488,7 @@ { "name": "Tobias Nyholm", "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/nyholm" + "homepage": "https://github.com/Nyholm" } ], "description": "A helper trait and interface to your PSR-6 cache to support hierarchical keys.", @@ -530,7 +530,7 @@ "Cache\\TagInterop\\": "" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -538,7 +538,7 @@ { "name": "Tobias Nyholm", "email": "tobias.nyholm@gmail.com", - "homepage": "https://github.com/nyholm" + "homepage": "https://github.com/Nyholm" }, { "name": "Nicolas Grekas", @@ -760,6 +760,130 @@ ], "time": "2019-06-11T13:03:06+00:00" }, + { + "name": "composer/installers", + "version": "v1.8.0", + "source": { + "type": "git", + "url": "https://github.com/composer/installers.git", + "reference": "7d610d50aae61ae7ed6675e58efeabdf279bb5e3" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/installers/zipball/7d610d50aae61ae7ed6675e58efeabdf279bb5e3", + "reference": "7d610d50aae61ae7ed6675e58efeabdf279bb5e3", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0" + }, + "replace": { + "roundcube/plugin-installer": "*", + "shama/baton": "*" + }, + "require-dev": { + "composer/composer": "1.0.*@dev", + "phpunit/phpunit": "^4.8.36" + }, + "type": "composer-plugin", + "extra": { + "class": "Composer\\Installers\\Plugin", + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Installers\\": "src/Composer/Installers" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Kyle Robinson Young", + "email": "kyle@dontkry.com", + "homepage": "https://github.com/shama" + } + ], + "description": "A multi-framework Composer library installer", + "homepage": "https://composer.github.io/installers/", + "keywords": [ + "Craft", + "Dolibarr", + "Eliasis", + "Hurad", + "ImageCMS", + "Kanboard", + "Lan Management System", + "MODX Evo", + "MantisBT", + "Mautic", + "Maya", + "OXID", + "Plentymarkets", + "Porto", + "RadPHP", + "SMF", + "Thelia", + "Whmcs", + "WolfCMS", + "agl", + "aimeos", + "annotatecms", + "attogram", + "bitrix", + "cakephp", + "chef", + "cockpit", + "codeigniter", + "concrete5", + "croogo", + "dokuwiki", + "drupal", + "eZ Platform", + "elgg", + "expressionengine", + "fuelphp", + "grav", + "installer", + "itop", + "joomla", + "known", + "kohana", + "laravel", + "lavalite", + "lithium", + "magento", + "majima", + "mako", + "mediawiki", + "modulework", + "modx", + "moodle", + "osclass", + "phpbb", + "piwik", + "ppi", + "puppet", + "pxcms", + "reindex", + "roundcube", + "shopware", + "silverstripe", + "sydes", + "sylius", + "symfony", + "typo3", + "wordpress", + "yawik", + "zend", + "zikula" + ], + "time": "2020-02-07T10:39:20+00:00" + }, { "name": "composer/semver", "version": "1.5.1", @@ -1792,7 +1916,7 @@ "src/functions_include.php" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -1915,7 +2039,7 @@ "Hashids\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2173,7 +2297,7 @@ "stubs/" ] }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2224,7 +2348,7 @@ "Joshbrw\\LaravelModuleInstaller\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -2397,16 +2521,16 @@ }, { "name": "laravel/framework", - "version": "v6.16.0", + "version": "v6.17.1", "source": { "type": "git", "url": "https://github.com/laravel/framework.git", - "reference": "b47217e41868d3049ec545cbb713aa94c6f39e55" + "reference": "32d1ed55dd46dcd706ff2e45bb7965be7320b87d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laravel/framework/zipball/b47217e41868d3049ec545cbb713aa94c6f39e55", - "reference": "b47217e41868d3049ec545cbb713aa94c6f39e55", + "url": "https://api.github.com/repos/laravel/framework/zipball/32d1ed55dd46dcd706ff2e45bb7965be7320b87d", + "reference": "32d1ed55dd46dcd706ff2e45bb7965be7320b87d", "shasum": "" }, "require": { @@ -2539,7 +2663,7 @@ "framework", "laravel" ], - "time": "2020-02-18T15:17:52+00:00" + "time": "2020-02-26T14:23:01+00:00" }, { "name": "laravel/helpers", @@ -3444,6 +3568,48 @@ ], "time": "2019-11-12T18:38:48+00:00" }, + { + "name": "oomphinc/composer-installers-extender", + "version": "v1.1.2", + "source": { + "type": "git", + "url": "https://github.com/oomphinc/composer-installers-extender.git", + "reference": "ca1c4b16b0905c81d1e77e608f36a2eff1a56f56" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/oomphinc/composer-installers-extender/zipball/ca1c4b16b0905c81d1e77e608f36a2eff1a56f56", + "reference": "ca1c4b16b0905c81d1e77e608f36a2eff1a56f56", + "shasum": "" + }, + "require": { + "composer-plugin-api": "^1.0", + "composer/installers": "^1.0" + }, + "type": "composer-plugin", + "extra": { + "class": "OomphInc\\ComposerInstallersExtender\\Plugin" + }, + "autoload": { + "psr-4": { + "OomphInc\\ComposerInstallersExtender\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Stephen Beemsterboer", + "email": "stephen@oomphinc.com", + "homepage": "https://github.com/balbuf" + } + ], + "description": "Extend the composer/installers plugin to accept any arbitrary package type.", + "homepage": "http://www.oomphinc.com/", + "time": "2017-03-31T16:57:39+00:00" + }, { "name": "opis/closure", "version": "3.5.1", @@ -3645,7 +3811,7 @@ "PhpUnitsOfMeasure\\": "source/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -3721,6 +3887,41 @@ ], "time": "2019-12-15T19:35:24+00:00" }, + { + "name": "phpvms/sample-module", + "version": "1.0.2", + "source": { + "type": "git", + "url": "https://github.com/nabeelio/phpvms-module.git", + "reference": "6332c03a6d552c03a1b70d2f2c24da86c6a12132" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nabeelio/phpvms-module/zipball/6332c03a6d552c03a1b70d2f2c24da86c6a12132", + "reference": "6332c03a6d552c03a1b70d2f2c24da86c6a12132", + "shasum": "" + }, + "require": { + "composer/installers": "~1.0" + }, + "type": "phpvms-module", + "extra": { + "laravel": { + "providers": [ + "Modules\\Sample\\Providers\\SampleServiceProvider", + "Modules\\Sample\\Providers\\EventServiceProvider" + ] + } + }, + "autoload": { + "psr-4": { + "Modules\\Sample\\": "." + } + }, + "notification-url": "https://packagist.org/downloads/", + "description": "A sample phpvms module", + "time": "2020-02-28T15:42:04+00:00" + }, { "name": "pragmarx/version", "version": "v0.2.9", @@ -3978,7 +4179,7 @@ "Psr\\Cache\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -4024,7 +4225,7 @@ "Psr\\Container\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -4590,9 +4791,9 @@ "authors": [ { "name": "Sebastiaan Luca", - "role": "Author", "email": "hello@sebastiaanluca.com", - "homepage": "https://www.sebastiaanluca.com" + "homepage": "https://www.sebastiaanluca.com", + "role": "Author" } ], "description": "An extensive set of Laravel framework helper functions and collection macros.", @@ -6744,7 +6945,7 @@ "TheIconic\\Tracking\\GoogleAnalytics\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], @@ -6832,7 +7033,7 @@ "Tivie\\OS\\": "src/" } }, - "notification-url": "http://packagist.org/downloads/", + "notification-url": "https://packagist.org/downloads/", "license": [ "APACHE 2.0" ], @@ -7028,26 +7229,26 @@ "packages-dev": [ { "name": "barryvdh/laravel-debugbar", - "version": "v3.2.8", + "version": "v3.2.9", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-debugbar.git", - "reference": "18208d64897ab732f6c04a19b319fe8f1d57a9c0" + "reference": "42d5da5379a7860093f8e4032167e4cb5ebec180" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/18208d64897ab732f6c04a19b319fe8f1d57a9c0", - "reference": "18208d64897ab732f6c04a19b319fe8f1d57a9c0", + "url": "https://api.github.com/repos/barryvdh/laravel-debugbar/zipball/42d5da5379a7860093f8e4032167e4cb5ebec180", + "reference": "42d5da5379a7860093f8e4032167e4cb5ebec180", "shasum": "" }, "require": { - "illuminate/routing": "^5.5|^6", - "illuminate/session": "^5.5|^6", - "illuminate/support": "^5.5|^6", - "maximebf/debugbar": "~1.15.0", + "illuminate/routing": "^5.5|^6|^7", + "illuminate/session": "^5.5|^6|^7", + "illuminate/support": "^5.5|^6|^7", + "maximebf/debugbar": "^1.15.1", "php": ">=7.0", - "symfony/debug": "^3|^4", - "symfony/finder": "^3|^4" + "symfony/debug": "^3|^4|^5", + "symfony/finder": "^3|^4|^5" }, "require-dev": { "laravel/framework": "5.5.x" @@ -7092,37 +7293,37 @@ "profiler", "webprofiler" ], - "time": "2019-08-29T07:01:03+00:00" + "time": "2020-02-25T20:42:23+00:00" }, { "name": "barryvdh/laravel-ide-helper", - "version": "v2.6.6", + "version": "v2.6.7", "source": { "type": "git", "url": "https://github.com/barryvdh/laravel-ide-helper.git", - "reference": "b91b959364d97af658f268c733c75dccdbff197e" + "reference": "edd69c5e0508972c81f1f7173236de2459c45814" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/b91b959364d97af658f268c733c75dccdbff197e", - "reference": "b91b959364d97af658f268c733c75dccdbff197e", + "url": "https://api.github.com/repos/barryvdh/laravel-ide-helper/zipball/edd69c5e0508972c81f1f7173236de2459c45814", + "reference": "edd69c5e0508972c81f1f7173236de2459c45814", "shasum": "" }, "require": { "barryvdh/reflection-docblock": "^2.0.6", "composer/composer": "^1.6", "doctrine/dbal": "~2.3", - "illuminate/console": "^5.5|^6", - "illuminate/filesystem": "^5.5|^6", - "illuminate/support": "^5.5|^6", - "php": ">=7" + "illuminate/console": "^5.5|^6|^7", + "illuminate/filesystem": "^5.5|^6|^7", + "illuminate/support": "^5.5|^6|^7", + "php": ">=7.2" }, "require-dev": { - "illuminate/config": "^5.5|^6", - "illuminate/view": "^5.5|^6", - "phpro/grumphp": "^0.14", - "phpunit/phpunit": "4.*", - "scrutinizer/ocular": "~1.1", + "illuminate/config": "^5.5|^6|^7", + "illuminate/view": "^5.5|^6|^7", + "mockery/mockery": "^1.3", + "orchestra/testbench": "^3|^4", + "phpro/grumphp": "^0.17.1", "squizlabs/php_codesniffer": "^3" }, "type": "library", @@ -7163,7 +7364,7 @@ "phpstorm", "sublime" ], - "time": "2019-10-30T20:53:27+00:00" + "time": "2020-02-25T20:41:32+00:00" }, { "name": "barryvdh/reflection-docblock", @@ -7815,22 +8016,22 @@ }, { "name": "maximebf/debugbar", - "version": "v1.15.1", + "version": "v1.16.1", "source": { "type": "git", "url": "https://github.com/maximebf/php-debugbar.git", - "reference": "6c4277f6117e4864966c9cb58fb835cee8c74a1e" + "reference": "58998b818c6567fac01e35b8a4b70c1a64530556" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/6c4277f6117e4864966c9cb58fb835cee8c74a1e", - "reference": "6c4277f6117e4864966c9cb58fb835cee8c74a1e", + "url": "https://api.github.com/repos/maximebf/php-debugbar/zipball/58998b818c6567fac01e35b8a4b70c1a64530556", + "reference": "58998b818c6567fac01e35b8a4b70c1a64530556", "shasum": "" }, "require": { - "php": ">=5.6", + "php": "^7.1", "psr/log": "^1.0", - "symfony/var-dumper": "^2.6|^3|^4" + "symfony/var-dumper": "^2.6|^3|^4|^5" }, "require-dev": { "phpunit/phpunit": "^5" @@ -7843,7 +8044,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.15-dev" + "dev-master": "1.16-dev" } }, "autoload": { @@ -7872,7 +8073,7 @@ "debug", "debugbar" ], - "time": "2019-09-24T14:55:42+00:00" + "time": "2019-11-24T09:46:11+00:00" }, { "name": "mockery/mockery", @@ -8210,16 +8411,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "5.0.0", + "version": "5.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "a48807183a4b819072f26e347bbd0b5199a9d15f" + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/a48807183a4b819072f26e347bbd0b5199a9d15f", - "reference": "a48807183a4b819072f26e347bbd0b5199a9d15f", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", + "reference": "cd72d394ca794d3466a3b2fc09d5a6c1dc86b47e", "shasum": "" }, "require": { @@ -8259,30 +8460,29 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2020-02-09T09:16:15+00:00" + "time": "2020-02-22T12:28:44+00:00" }, { "name": "phpdocumentor/type-resolver", - "version": "1.0.1", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9" + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", - "reference": "2e32a6d48972b2c1976ed5d8967145b6cec4a4a9", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/7462d5f123dfc080dfdf26897032a6513644fc95", + "reference": "7462d5f123dfc080dfdf26897032a6513644fc95", "shasum": "" }, "require": { - "php": "^7.1", + "php": "^7.2", "phpdocumentor/reflection-common": "^2.0" }, "require-dev": { - "ext-tokenizer": "^7.1", - "mockery/mockery": "~1", - "phpunit/phpunit": "^7.0" + "ext-tokenizer": "^7.2", + "mockery/mockery": "~1" }, "type": "library", "extra": { @@ -8306,7 +8506,7 @@ } ], "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", - "time": "2019-08-22T18:11:29+00:00" + "time": "2020-02-18T18:59:58+00:00" }, { "name": "phpspec/prophecy", @@ -9625,9 +9825,9 @@ } ], "aliases": [], - "minimum-stability": "stable", + "minimum-stability": "dev", "stability-flags": [], - "prefer-stable": false, + "prefer-stable": true, "prefer-lowest": false, "platform": { "php": ">=7.2", diff --git a/config/modules.php b/config/modules.php index 2ec7508d..ee070448 100644 --- a/config/modules.php +++ b/config/modules.php @@ -94,6 +94,7 @@ return [ 'enabled' => false, 'paths' => [ base_path('vendor/*/*'), + base_path('modules/*'), ], ], /* diff --git a/modules/.gitignore b/modules/.gitignore index f957b1e3..3089778c 100644 --- a/modules/.gitignore +++ b/modules/.gitignore @@ -6,6 +6,5 @@ !/Awards !/Importer !/Installer -!/Sample !/Updater !/Vacentral diff --git a/modules/Sample/Awards/SampleAward.php b/modules/Sample/Awards/SampleAward.php deleted file mode 100644 index cf0e56f2..00000000 --- a/modules/Sample/Awards/SampleAward.php +++ /dev/null @@ -1,27 +0,0 @@ -user, which holds the current - * user the award is being checked against - * - * @param null $params Parameters passed in from the UI - * - * @return bool - */ - public function check($params = null): bool - { - return false; - } -} diff --git a/modules/Sample/Config/config.php b/modules/Sample/Config/config.php deleted file mode 100644 index 798e91df..00000000 --- a/modules/Sample/Config/config.php +++ /dev/null @@ -1,5 +0,0 @@ - 'Sample', -]; diff --git a/modules/Sample/Database/seeders/SampleDatabaseSeeder.php b/modules/Sample/Database/seeders/SampleDatabaseSeeder.php deleted file mode 100644 index 2e84cd0d..00000000 --- a/modules/Sample/Database/seeders/SampleDatabaseSeeder.php +++ /dev/null @@ -1,21 +0,0 @@ -call("OthersTableSeeder"); - } -} diff --git a/modules/Sample/Http/Controllers/Admin/AdminController.php b/modules/Sample/Http/Controllers/Admin/AdminController.php deleted file mode 100644 index b9e112b7..00000000 --- a/modules/Sample/Http/Controllers/Admin/AdminController.php +++ /dev/null @@ -1,65 +0,0 @@ -message('Hello, world!'); - } - - /** - * @param Request $request - * - * @return \Illuminate\Http\JsonResponse - */ - public function hello(Request $request) - { - // Another way to return JSON, this for a custom response - // It's recommended to use Resources for responses from the database - return response()->json([ - 'name' => Auth::user()->name, - ]); - } -} diff --git a/modules/Sample/Http/Controllers/SampleController.php b/modules/Sample/Http/Controllers/SampleController.php deleted file mode 100644 index 118cc975..00000000 --- a/modules/Sample/Http/Controllers/SampleController.php +++ /dev/null @@ -1,67 +0,0 @@ - []], function () { - Route::get('/', 'SampleController@index'); -}); - -/* - * This is required to have a valid API key - */ -Route::group(['middleware' => [ - 'api.auth', -]], function () { - Route::get('/hello', 'SampleController@hello'); -}); diff --git a/modules/Sample/Http/Routes/web.php b/modules/Sample/Http/Routes/web.php deleted file mode 100644 index c36c3395..00000000 --- a/modules/Sample/Http/Routes/web.php +++ /dev/null @@ -1,9 +0,0 @@ - [ - 'role:user', // leave blank to make this public -]], function () { - // all your routes are prefixed with the above prefix - // e.g. yoursite.com/sample - Route::get('/', 'SampleController@index'); -}); diff --git a/modules/Sample/Listeners/TestEventListener.php b/modules/Sample/Listeners/TestEventListener.php deleted file mode 100644 index b6191119..00000000 --- a/modules/Sample/Listeners/TestEventListener.php +++ /dev/null @@ -1,17 +0,0 @@ - [TestEventListener::class], - ]; - - /** - * Register any events for your application. - */ - public function boot() - { - parent::boot(); - } -} diff --git a/modules/Sample/Providers/SampleServiceProvider.php b/modules/Sample/Providers/SampleServiceProvider.php deleted file mode 100644 index 8d2d9cb0..00000000 --- a/modules/Sample/Providers/SampleServiceProvider.php +++ /dev/null @@ -1,153 +0,0 @@ -moduleSvc = app(ModuleService::class); - - $this->registerRoutes(); - $this->registerTranslations(); - $this->registerConfig(); - $this->registerViews(); - - $this->registerLinks(); - - $this->loadMigrationsFrom(__DIR__.'/../Database/migrations'); - } - - /** - * Register the service provider. - */ - public function register() - { - // - } - - /** - * Add module links here - */ - public function registerLinks() - { - // Show this link if logged in - // $this->moduleSvc->addFrontendLink('Sample', '/sample', '', $logged_in=true); - - // Admin links: - $this->moduleSvc->addAdminLink('Sample', '/admin/sample'); - } - - /** - * Register the routes - */ - protected function registerRoutes() - { - /* - * Routes for the frontend - */ - Route::group([ - 'as' => 'sample.', - 'prefix' => 'sample', - // If you want a RESTful module, change this to 'api' - 'middleware' => ['web'], - 'namespace' => 'Modules\Sample\Http\Controllers', - ], function () { - $this->loadRoutesFrom(__DIR__.'/../Http/Routes/web.php'); - }); - - /* - * Routes for the admin - */ - Route::group([ - 'as' => 'sample.', - 'prefix' => 'admin/sample', - // If you want a RESTful module, change this to 'api' - 'middleware' => ['web', 'role:admin'], - 'namespace' => 'Modules\Sample\Http\Controllers\Admin', - ], function () { - $this->loadRoutesFrom(__DIR__.'/../Http/Routes/admin.php'); - }); - - /* - * Routes for an API - */ - Route::group([ - 'as' => 'sample.', - 'prefix' => 'api/sample', - // If you want a RESTful module, change this to 'api' - 'middleware' => ['api'], - 'namespace' => 'Modules\Sample\Http\Controllers\Api', - ], function () { - $this->loadRoutesFrom(__DIR__.'/../Http/Routes/api.php'); - }); - } - - /** - * Register config. - */ - protected function registerConfig() - { - $this->publishes([ - __DIR__.'/../Config/config.php' => config_path('sample.php'), - ], 'config'); - - $this->mergeConfigFrom( - __DIR__.'/../Config/config.php', 'sample' - ); - } - - /** - * Register views. - */ - public function registerViews() - { - $viewPath = resource_path('views/modules/sample'); - $sourcePath = __DIR__.'/../Resources/views'; - - $this->publishes([ - $sourcePath => $viewPath, - ], 'views'); - - $paths = array_map( - function ($path) { - return $path.'/modules/sample'; - }, - \Config::get('view.paths') - ); - - $paths[] = $sourcePath; - $this->loadViewsFrom($paths, 'sample'); - } - - /** - * Register translations. - */ - public function registerTranslations() - { - $langPath = resource_path('lang/modules/sample'); - - if (is_dir($langPath)) { - $this->loadTranslationsFrom($langPath, 'sample'); - } else { - $this->loadTranslationsFrom(__DIR__.'/../Resources/lang', 'sample'); - } - } - - /** - * Get the services provided by the provider. - */ - public function provides(): array - { - return []; - } -} diff --git a/modules/Sample/Resources/views/admin/create.blade.php b/modules/Sample/Resources/views/admin/create.blade.php deleted file mode 100644 index dd55d46a..00000000 --- a/modules/Sample/Resources/views/admin/create.blade.php +++ /dev/null @@ -1,14 +0,0 @@ -@extends('sample::layouts.admin') - -@section('title', 'Sample Create') -@section('actions') -@endsection - -@section('content') -
-
-

Create something!

-

Add a form!

-
-
-@endsection diff --git a/modules/Sample/Resources/views/admin/index.blade.php b/modules/Sample/Resources/views/admin/index.blade.php deleted file mode 100644 index 0d994bc9..00000000 --- a/modules/Sample/Resources/views/admin/index.blade.php +++ /dev/null @@ -1,18 +0,0 @@ -@extends('sample::layouts.admin') - -@section('title', 'Sample') -@section('actions') -
  • - - - Add New -
  • -@endsection -@section('content') -
    -
    -

    Admin Scaffold!

    -

    This view is loaded from module: {{ config('sample.name') }}

    -
    -
    -@endsection diff --git a/modules/Sample/Resources/views/index.blade.php b/modules/Sample/Resources/views/index.blade.php deleted file mode 100644 index 4ecd1f5d..00000000 --- a/modules/Sample/Resources/views/index.blade.php +++ /dev/null @@ -1,9 +0,0 @@ -@extends('sample::layouts.frontend') - -@section('content') -

    Hello World

    - -

    - This view is loaded from module: {{ config('sample.name') }} -

    -@endsection diff --git a/modules/Sample/Resources/views/layouts/admin.blade.php b/modules/Sample/Resources/views/layouts/admin.blade.php deleted file mode 100644 index 421bbe11..00000000 --- a/modules/Sample/Resources/views/layouts/admin.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -{{-- -You probably don't want to edit anything here. Just make -sure to extend this in your views. It will pass the content section through ---}} -@extends('admin.app') diff --git a/modules/Sample/Resources/views/layouts/frontend.blade.php b/modules/Sample/Resources/views/layouts/frontend.blade.php deleted file mode 100644 index 86f3a27a..00000000 --- a/modules/Sample/Resources/views/layouts/frontend.blade.php +++ /dev/null @@ -1,5 +0,0 @@ -{{-- -You probably don't want to edit anything here. Just make -sure to extend this in your views. It will pass the content section through ---}} -@extends('app') diff --git a/modules/Sample/composer.json b/modules/Sample/composer.json deleted file mode 100644 index e05835a4..00000000 --- a/modules/Sample/composer.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "phpvms/sample-module", - "type": "laravel-module", - "description": "", - "require": { - "joshbrw/laravel-module-installer": "0.1.x" - }, - "extra": { - "laravel": { - "providers": [ - "Modules\\Sample\\Providers\\SampleServiceProvider", - "Modules\\Sample\\Providers\\EventServiceProvider" - ], - "aliases": { - - } - } - }, - "autoload": { - "psr-4": { - "Modules\\Sample\\": "" - } - } -} diff --git a/modules/Sample/module.json b/modules/Sample/module.json deleted file mode 100644 index 7f563f3b..00000000 --- a/modules/Sample/module.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "name": "Sample", - "alias": "sample", - "description": "", - "keywords": [], - "active": 1, - "order": 0, - "providers": [ - "Modules\\Sample\\Providers\\SampleServiceProvider", - "Modules\\Sample\\Providers\\EventServiceProvider" - ], - "aliases": {}, - "files": [], - "requires": [] -} diff --git a/resources/stubs/modules/composer.stub b/resources/stubs/modules/composer.stub index f8f2c18f..140c27d8 100644 --- a/resources/stubs/modules/composer.stub +++ b/resources/stubs/modules/composer.stub @@ -1,6 +1,6 @@ { "name": "VENDOR/$LOWER_NAME$-module", - "type": "laravel-module", + "type": "phpvms-module", "description": "", "authors": [ { @@ -9,7 +9,7 @@ } ], "require": { - "joshbrw/laravel-module-installer": "0.1.x" + "composer/installers": "~1.0" }, "extra": { "laravel": { @@ -24,7 +24,7 @@ }, "autoload": { "psr-4": { - "$MODULE_NAMESPACE$\\$STUDLY_NAME$\\": "" + "$MODULE_NAMESPACE$\\$STUDLY_NAME$\\": "." } } } diff --git a/tests/AwardsTest.php b/tests/AwardsTest.php index 8fba76ee..2efbd8ff 100644 --- a/tests/AwardsTest.php +++ b/tests/AwardsTest.php @@ -6,7 +6,9 @@ use App\Services\PirepService; class AwardsTest extends TestCase { + /** @var AwardService */ private $awardSvc; + private $pirepSvc; public function setUp(): void