From a0aec1450bd6e80d6884d1b1bd153aa56977ee46 Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Sat, 21 Jan 2017 13:37:31 -0600 Subject: [PATCH] Use a Composer autoloader (Fix #183) --- .../com_patchtester/patchtester.php | 4 +-- .../com_patchtester/patchtester.xml | 1 + build/patchtester/build.sh | 27 ++++++++++--------- composer.json | 5 ++++ composer.lock | 2 +- 5 files changed, 23 insertions(+), 16 deletions(-) diff --git a/administrator/components/com_patchtester/patchtester.php b/administrator/components/com_patchtester/patchtester.php index 38339ac..c6cb161 100644 --- a/administrator/components/com_patchtester/patchtester.php +++ b/administrator/components/com_patchtester/patchtester.php @@ -17,8 +17,8 @@ if (!JFactory::getUser()->authorise('core.manage', 'com_patchtester')) // Application reference $app = JFactory::getApplication(); -// Register the component namespace to the autoloader -JLoader::registerNamespace('PatchTester', __DIR__); +// Import our Composer autoloader to load the component classes +require_once __DIR__ . '/vendor/autoload.php'; // Build the controller class name based on task $task = $app->input->getCmd('task', 'display'); diff --git a/administrator/components/com_patchtester/patchtester.xml b/administrator/components/com_patchtester/patchtester.xml index ade1555..8204291 100644 --- a/administrator/components/com_patchtester/patchtester.xml +++ b/administrator/components/com_patchtester/patchtester.xml @@ -44,6 +44,7 @@ backups install language + vendor access.xml config.xml patchtester.php diff --git a/build/patchtester/build.sh b/build/patchtester/build.sh index 705e637..1261000 100755 --- a/build/patchtester/build.sh +++ b/build/patchtester/build.sh @@ -1,16 +1,17 @@ #!/bin/sh cd ../../ -rm -rf packaging && mkdir packaging -rm -rf packages && mkdir packages -composer install --no-dev -cp -r administrator/components/com_patchtester packaging/admin -cp -r administrator/templates/hathor/html/com_patchtester packaging/hathor -cp -r media/com_patchtester packaging/media -rm -rf packaging/admin/backups/*.txt -mv packaging/admin/patchtester.xml packaging/patchtester.xml -mv packaging/admin/script.php packaging/script.php -cd packaging -tar jcf packages/com_patchtester.tar.bz2 admin/ hathor/ media/ patchtester.xml script.php -tar zcf packages/com_patchtester.tar.gz admin/ hathor/ media/ patchtester.xml script.php -zip -r packages/com_patchtester.zip admin/ hathor/ media/ patchtester.xml script.php +rm -rf build/packaging && mkdir build/packaging +rm -rf build/packages && mkdir build/packages +composer install --no-dev -o +cp -r administrator/components/com_patchtester build/packaging/admin +cp -r administrator/templates/hathor/html/com_patchtester build/packaging/hathor +cp -r media/com_patchtester build/packaging/media +rm -rf build/packaging/admin/backups/*.txt +mv build/packaging/admin/patchtester.xml build/packaging/patchtester.xml +mv build/packaging/admin/script.php build/packaging/script.php +cd build/packaging +tar jcf ../packages/com_patchtester.tar.bz2 . +tar zcf ../packages/com_patchtester.tar.gz . +zip -r ../packages/com_patchtester.zip . +cd ../../ composer install diff --git a/composer.json b/composer.json index 1555e7b..b312d23 100644 --- a/composer.json +++ b/composer.json @@ -14,5 +14,10 @@ "require-dev": { "joomla/crowdin-sync": "dev-master", "squizlabs/php_codesniffer": "~1.5" + }, + "autoload": { + "psr-4": { + "PatchTester\\": "administrator/components/com_patchtester/PatchTester/" + } } } diff --git a/composer.lock b/composer.lock index 445879f..3bd6e0e 100644 --- a/composer.lock +++ b/composer.lock @@ -395,7 +395,7 @@ "crowdin", "joomla" ], - "time": "2016-10-31T22:30:19+00:00" + "time": "2016-10-31 22:30:19" }, { "name": "joomla/filter",