Skip to content

Commit 458ebb1

Browse files
committed
Move CLI into main src folder
1 parent 17a70e3 commit 458ebb1

File tree

115 files changed

+246
-318
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

115 files changed

+246
-318
lines changed

.drone.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ steps:
2828
depends_on: [ composer ]
2929
commands:
3030
- echo $(date)
31-
- ./vendor/bin/phpstan analyse src tests cli
31+
- ./vendor/bin/phpstan analyse src tests
3232
- echo $(date)
3333

3434
- name: php74
@@ -83,6 +83,6 @@ volumes:
8383

8484
---
8585
kind: signature
86-
hmac: 52d4d6492e6060882b25d6eac8e86d78a3e49bcca526fcf4b00e3c7b4a8246f0
86+
hmac: 31d8b4222de772e09097b43afa09f63b73d82571a036621f4c528404a3dd42b8
8787

8888
...

Documentation/Development/CLI-application.md

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
## CLI - Command Line Application
22

3-
The script is located at `/bin/jtracker`, which is a symlink to `/cli/tracker.php` created for convenience.
4-
It is meant to be executed on the computers [command line interface](https://en.wikipedia.org/wiki/Command-line_interface).
3+
The script is located at `/bin/jtracker` and is meant to be executed on the computers [command line interface](https://en.wikipedia.org/wiki/Command-line_interface).
54

65
This script will do:
76

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@ The application also has external dependencies installable via [Composer](https:
1919

2020
See also: [Dependencies](Documentation/Development/Dependencies.md).
2121

22-
Note: All references to `bin/jtracker` refer to an executable symlink to `cli/tracker.php`. If you cannot execute the `bin/jtracker` symlink replace that path with `cli/tracker.php`
23-
2422
## Setup
2523

2624
1. Clone the git repo to where ever your test environment is located or download a ZIP file.

bin/jtracker

-1
This file was deleted.

bin/jtracker

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
#!/usr/bin/env php
2+
<?php
3+
/**
4+
* Part of the Joomla! Tracker application.
5+
*
6+
* @copyright Copyright (C) 2012 - 2014 Open Source Matters, Inc. All rights reserved.
7+
* @license http://www.gnu.org/licenses/gpl-2.0.txt GNU General Public License Version 2 or Later
8+
*/
9+
10+
// Configure error reporting to maximum for CLI output.
11+
error_reporting(-1);
12+
ini_set('display_errors', 1);
13+
14+
\define('JPATH_ROOT', realpath(__DIR__ . '/..'));
15+
\define('JPATH_CONFIGURATION', JPATH_ROOT . '/etc');
16+
\define('JPATH_THEMES', JPATH_ROOT . '/www');
17+
\define('JPATH_TEMPLATES', JPATH_ROOT . '/templates');
18+
\define('JTRACKER_START_TIME', microtime(true));
19+
\define('JTRACKER_START_MEMORY', memory_get_usage());
20+
21+
(function ()
22+
{
23+
// Load the autoloader
24+
$path = realpath(JPATH_ROOT . '/vendor/autoload.php');
25+
26+
if (!$path)
27+
{
28+
// Do not translate!
29+
echo 'ERROR: Composer not properly set up! Run "composer install" or see README.md for more details.' . PHP_EOL;
30+
31+
exit(1);
32+
}
33+
34+
include $path;
35+
36+
try
37+
{
38+
(new \JTracker\Kernel\ConsoleKernel)->run();
39+
}
40+
catch (\Exception $e)
41+
{
42+
$trace = $e->getTraceAsString();
43+
44+
echo "\n\n"
45+
. 'ERROR: ' . $e->getMessage()
46+
. "\n\n"
47+
. 'Call stack:' . "\n"
48+
. str_replace(JPATH_ROOT, 'JPATH_ROOT', $e->getTraceAsString());
49+
50+
exit($e->getCode() ? : 255);
51+
}
52+
})();

build.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<target name="phpdoc" description="Generate API documentation using phpDocumentor">
113113
<exec executable="phpdoc">
114114
<arg value="--directory" />
115-
<arg path="${basedir}/src/,${basedir}/cli/" />
115+
<arg path="${basedir}/src/" />
116116
<arg value="--target" />
117117
<arg path="${basedir}/build/api/" />
118118
<arg value="--title" />

cli/tracker.php

-56
This file was deleted.

composer.json

+1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@
6565
"App\\": "src/App/"
6666
}
6767
},
68+
"bin": ["bin/jtracker"],
6869
"autoload-dev": {
6970
"psr-4": {
7071
"JTracker\\Tests\\": "tests/tracker/"

ruleset.xml

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
<exclude-pattern>*/Gruntfile.js</exclude-pattern>
2424

2525
<!-- Exclude tracker.php because of strange error -->
26-
<exclude-pattern>*/cli/tracker.php</exclude-pattern>
2726
<exclude-pattern>*/src/App/Support/Model/IconsModel.php</exclude-pattern>
2827

2928
<rule ref="Joomla">

src/App/Activity/ActivityApp.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use Joomla\DI\Container;
1212
use Joomla\Router\Router;
13-
use JTracker\AppInterface;
13+
use JTracker\Application\AppInterface;
1414

1515
/**
1616
* Activity app

src/App/Activity/Controller/AbstractBaseController.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
namespace App\Activity\Controller;
1010

1111
use App\Activity\View\DefaultHtmlView;
12-
1312
use JTracker\Controller\AbstractTrackerController;
1413

1514
/**
@@ -38,7 +37,7 @@ public function initialize()
3837
{
3938
parent::initialize();
4039

41-
/** @var \JTracker\Application $application */
40+
/** @var \JTracker\Application\Application $application */
4241
$application = $this->getContainer()->get('app');
4342

4443
$application->getUser()->authorize('view');

src/App/Activity/Controller/Ajax/ProjectActivity.php

+1-2
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@
99
namespace App\Activity\Controller\Ajax;
1010

1111
use App\Activity\Model\ProjectactivityModel;
12-
1312
use Joomla\Registry\Registry;
14-
use JTracker\Application;
13+
use JTracker\Application\Application;
1514
use JTracker\Controller\AbstractAjaxController;
1615

1716
/**

src/App/Debug/DebugApp.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
namespace App\Debug;
1010

1111
use Joomla\DI\Container;
12-
use JTracker\AppInterface;
12+
use JTracker\Application\AppInterface;
1313

1414
/**
1515
* Debug app

src/App/Debug/Renderer/Html.php

+3-5
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,8 @@
1111
use App\Debug\Database\DatabaseDebugger;
1212
use App\Debug\Format\Html\SqlFormat;
1313
use App\Debug\Format\Html\TableFormat;
14-
1514
use Joomla\DI\Container;
1615
use Joomla\DI\ContainerAwareInterface;
17-
1816
use Kint\Kint;
1917
use Kint\Renderer\RichRenderer;
2018

@@ -39,7 +37,7 @@ public function render()
3937
{
4038
$html = [];
4139

42-
/** @var \JTracker\Application $application */
40+
/** @var \JTracker\Application\Application $application */
4341
$application = $this->getContainer()->get('app');
4442

4543
// Check if debug is only displayed for admin users
@@ -119,7 +117,7 @@ public function render()
119117
*/
120118
private function getNavigation()
121119
{
122-
/** @var \JTracker\Application $application */
120+
/** @var \JTracker\Application\Application $application */
123121
$application = $this->getContainer()->get('app');
124122

125123
$html = [];
@@ -249,7 +247,7 @@ private function renderDatabase()
249247
{
250248
$debug = [];
251249

252-
/** @var \JTracker\Application $application */
250+
/** @var \JTracker\Application\Application $application */
253251
$application = $this->getContainer()->get('app');
254252

255253
$debugger = $application->getDebugger();

src/App/Debug/TrackerDebugger.php

+1-6
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,17 @@
1010

1111
use App\Debug\Handler\ProductionHandler;
1212
use App\Debug\Renderer\Html;
13-
1413
use Joomla\DI\Container;
1514
use Joomla\DI\ContainerAwareInterface;
1615
use Joomla\DI\ContainerAwareTrait;
1716
use Joomla\Profiler\Profiler;
18-
19-
use JTracker\Application;
20-
17+
use JTracker\Application\Application;
2118
use Monolog\Handler\NullHandler;
2219
use Monolog\Handler\StreamHandler;
2320
use Monolog\Logger;
2421
use Monolog\Processor\WebProcessor;
25-
2622
use Psr\Log\LoggerAwareInterface;
2723
use Psr\Log\LoggerAwareTrait;
28-
2924
use Whoops\Handler\PrettyPageHandler;
3025
use Whoops\Run;
3126

src/App/GitHub/Controller/Ajax/Labels/Add.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Add extends AbstractAjaxController
2727
*/
2828
protected function prepareResponse()
2929
{
30-
/** @var \JTracker\Application $application */
30+
/** @var \JTracker\Application\Application $application */
3131
$application = $this->getContainer()->get('app');
3232

3333
$application->getUser()->authorize('manage');

src/App/GitHub/Controller/Ajax/Labels/Delete.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class Delete extends AbstractAjaxController
2727
*/
2828
protected function prepareResponse()
2929
{
30-
/** @var \JTracker\Application $application */
30+
/** @var \JTracker\Application\Application $application */
3131
$application = $this->getContainer()->get('app');
3232

3333
$application->getUser()->authorize('manage');

src/App/GitHub/Controller/Ajax/Milestones/Delete.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Delete extends Base
2626
*/
2727
protected function prepareResponse()
2828
{
29-
/** @var \JTracker\Application $application */
29+
/** @var \JTracker\Application\Application $application */
3030
$application = $this->getContainer()->get('app');
3131

3232
$application->getUser()->authorize('manage');

src/App/GitHub/Controller/Ajax/Milestones/Save.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Save extends Base
2626
*/
2727
protected function prepareResponse()
2828
{
29-
/** @var \JTracker\Application $application */
29+
/** @var \JTracker\Application\Application $application */
3030
$application = $this->getContainer()->get('app');
3131

3232
$application->getUser()->authorize('manage');

src/App/GitHub/GitHubApp.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use Joomla\DI\Container;
1212
use Joomla\Router\Router;
13-
use JTracker\AppInterface;
13+
use JTracker\Application\AppInterface;
1414

1515
/**
1616
* GitHub app

src/App/Groups/GroupsApp.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use Joomla\DI\Container;
1212
use Joomla\Router\Router;
13-
use JTracker\AppInterface;
13+
use JTracker\Application\AppInterface;
1414

1515
/**
1616
* Groups app

src/App/Projects/ProjectsApp.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
use Joomla\DI\Container;
1212
use Joomla\Router\Router;
13-
use JTracker\AppInterface;
13+
use JTracker\Application\AppInterface;
1414

1515
/**
1616
* Projects app

src/App/Support/Controller/Icons/ViewCssIconsController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
/**
1717
* CSS icon list controller.
1818
*
19-
* @method \JTracker\Application getApplication()
19+
* @method \JTracker\Application\Application getApplication()
2020
*
2121
* @since 1.0
2222
*/

src/App/Support/SupportApp.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
use Joomla\Renderer\RendererInterface;
1515
use Joomla\Router\Route;
1616
use Joomla\Router\Router;
17+
use JTracker\Application\AppInterface;
1718
use JTracker\View\BaseHtmlView;
18-
use JTracker\AppInterface;
1919

2020
/**
2121
* Support app

src/App/System/Controller/WrongCmsController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* Controller class to display a message to individuals looking for the wrong CMS
1616
*
17-
* @method \JTracker\Application getApplication()
17+
* @method \JTracker\Application\Application getApplication()
1818
*
1919
* @since 1.0
2020
*/

src/App/System/SystemApp.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
use Joomla\DI\Container;
1313
use Joomla\Router\Route;
1414
use Joomla\Router\Router;
15-
use JTracker\AppInterface;
15+
use JTracker\Application\AppInterface;
1616

1717
/**
1818
* System app

src/App/Text/Controller/CreateArticleController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
/**
1818
* Controller class to add an article.
1919
*
20-
* @method \JTracker\Application getApplication()
20+
* @method \JTracker\Application\Application getApplication()
2121
*
2222
* @since 1.0
2323
*/

src/App/Text/Controller/DeleteArticleController.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
/**
1616
* Controller class to delete an article.
1717
*
18-
* @method \JTracker\Application getApplication()
18+
* @method \JTracker\Application\Application getApplication()
1919
*
2020
* @since 1.0
2121
*/

0 commit comments

Comments
 (0)