Use a Composer autoloader (Fix #183)

This commit is contained in:
Michael Babker 2017-01-21 13:37:31 -06:00
parent 127d5269c0
commit a0aec1450b
5 changed files with 23 additions and 16 deletions

View File

@ -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');

View File

@ -44,6 +44,7 @@
<folder>backups</folder>
<folder>install</folder>
<folder>language</folder>
<folder>vendor</folder>
<filename>access.xml</filename>
<filename>config.xml</filename>
<filename>patchtester.php</filename>

View File

@ -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

View File

@ -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/"
}
}
}

2
composer.lock generated
View File

@ -395,7 +395,7 @@
"crowdin",
"joomla"
],
"time": "2016-10-31T22:30:19+00:00"
"time": "2016-10-31 22:30:19"
},
{
"name": "joomla/filter",