Skip to content

Commit a0aec14

Browse files
author
Michael Babker
committed
Use a Composer autoloader (Fix #183)
1 parent 127d526 commit a0aec14

File tree

5 files changed

+23
-16
lines changed

5 files changed

+23
-16
lines changed

administrator/components/com_patchtester/patchtester.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
// Application reference
1818
$app = JFactory::getApplication();
1919

20-
// Register the component namespace to the autoloader
21-
JLoader::registerNamespace('PatchTester', __DIR__);
20+
// Import our Composer autoloader to load the component classes
21+
require_once __DIR__ . '/vendor/autoload.php';
2222

2323
// Build the controller class name based on task
2424
$task = $app->input->getCmd('task', 'display');

administrator/components/com_patchtester/patchtester.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@
4444
<folder>backups</folder>
4545
<folder>install</folder>
4646
<folder>language</folder>
47+
<folder>vendor</folder>
4748
<filename>access.xml</filename>
4849
<filename>config.xml</filename>
4950
<filename>patchtester.php</filename>

build/patchtester/build.sh

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
#!/bin/sh
22
cd ../../
3-
rm -rf packaging && mkdir packaging
4-
rm -rf packages && mkdir packages
5-
composer install --no-dev
6-
cp -r administrator/components/com_patchtester packaging/admin
7-
cp -r administrator/templates/hathor/html/com_patchtester packaging/hathor
8-
cp -r media/com_patchtester packaging/media
9-
rm -rf packaging/admin/backups/*.txt
10-
mv packaging/admin/patchtester.xml packaging/patchtester.xml
11-
mv packaging/admin/script.php packaging/script.php
12-
cd packaging
13-
tar jcf packages/com_patchtester.tar.bz2 admin/ hathor/ media/ patchtester.xml script.php
14-
tar zcf packages/com_patchtester.tar.gz admin/ hathor/ media/ patchtester.xml script.php
15-
zip -r packages/com_patchtester.zip admin/ hathor/ media/ patchtester.xml script.php
3+
rm -rf build/packaging && mkdir build/packaging
4+
rm -rf build/packages && mkdir build/packages
5+
composer install --no-dev -o
6+
cp -r administrator/components/com_patchtester build/packaging/admin
7+
cp -r administrator/templates/hathor/html/com_patchtester build/packaging/hathor
8+
cp -r media/com_patchtester build/packaging/media
9+
rm -rf build/packaging/admin/backups/*.txt
10+
mv build/packaging/admin/patchtester.xml build/packaging/patchtester.xml
11+
mv build/packaging/admin/script.php build/packaging/script.php
12+
cd build/packaging
13+
tar jcf ../packages/com_patchtester.tar.bz2 .
14+
tar zcf ../packages/com_patchtester.tar.gz .
15+
zip -r ../packages/com_patchtester.zip .
16+
cd ../../
1617
composer install

composer.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,10 @@
1414
"require-dev": {
1515
"joomla/crowdin-sync": "dev-master",
1616
"squizlabs/php_codesniffer": "~1.5"
17+
},
18+
"autoload": {
19+
"psr-4": {
20+
"PatchTester\\": "administrator/components/com_patchtester/PatchTester/"
21+
}
1722
}
1823
}

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)