Move src files to root of src/

This commit is contained in:
Timothy Warren 2016-08-29 16:36:13 -04:00
parent eaa0e517c1
commit ac971c5248
31 changed files with 8 additions and 48 deletions

View File

@ -4,12 +4,12 @@
"license":"MIT", "license":"MIT",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Aviat\\Ion\\": "src/" "Aviat\\AnimeClient\\": "src/"
} }
}, },
"autoload-dev": { "autoload-dev": {
"psr-4": { "psr-4": {
"Aviat\\Ion\\Tests\\": "tests/", "Aviat\\AnimeClient\\Tests\\": "tests/",
"CodeIgniter\\": "build/CodeIgniter/" "CodeIgniter\\": "build/CodeIgniter/"
} }
}, },

View File

@ -34,27 +34,9 @@ function _dir()
// Define base directories // Define base directories
$APP_DIR = _dir(__DIR__, 'app'); $APP_DIR = _dir(__DIR__, 'app');
$SRC_DIR = _dir(__DIR__, 'src');
$CONF_DIR = _dir($APP_DIR, 'config'); $CONF_DIR = _dir($APP_DIR, 'config');
/** // Load composer autoloader
* Set up autoloaders
*
* @codeCoverageIgnore
* @return void
*/
spl_autoload_register(function($class) use ($SRC_DIR) {
$class_parts = explode('\\', $class);
$ns_path = $SRC_DIR . '/' . implode('/', $class_parts) . ".php";
if (file_exists($ns_path))
{
require_once($ns_path);
return;
}
});
// Set up autoloader for third-party dependencies
require _dir(__DIR__, '/vendor/autoload.php'); require _dir(__DIR__, '/vendor/autoload.php');
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
@ -86,7 +68,6 @@ $container = $di($config_array);
// Unset 'constants' // Unset 'constants'
unset($APP_DIR); unset($APP_DIR);
unset($SRC_DIR);
unset($CONF_DIR); unset($CONF_DIR);
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------

View File

@ -15,7 +15,7 @@ namespace Aviat\AnimeClient;
use Yosymfony\Toml\Toml; use Yosymfony\Toml\Toml;
define('SRC_DIR', realpath(__DIR__ . '/../../')); define('SRC_DIR', realpath(__DIR__));
/** /**
* Application constants * Application constants

View File

@ -53,7 +53,7 @@ class BaseCommand extends Command {
*/ */
protected function setupContainer() protected function setupContainer()
{ {
$CONF_DIR = realpath(__DIR__ . '/../../../../app/config/'); $CONF_DIR = realpath(__DIR__ . '/../../app/config/');
require_once $CONF_DIR . '/base_config.php'; // $base_config require_once $CONF_DIR . '/base_config.php'; // $base_config
$config = AnimeClient::load_toml($CONF_DIR); $config = AnimeClient::load_toml($CONF_DIR);

View File

@ -12,9 +12,6 @@
*/ */
namespace Aviat\AnimeClient; namespace Aviat\AnimeClient;
use Aura\Web\Request;
use Aura\Web\Response;
use Aviat\Ion\Di\ContainerInterface; use Aviat\Ion\Di\ContainerInterface;
use Aviat\Ion\Friend; use Aviat\Ion\Friend;
@ -38,7 +35,7 @@ class Dispatcher extends RoutingBase {
/** /**
* Class wrapper for input superglobals * Class wrapper for input superglobals
* @var object * @var Psr\Http\Message\ServerRequestInterface
*/ */
protected $request; protected $request;
@ -215,6 +212,7 @@ class Dispatcher extends RoutingBase {
{ {
$default_namespace = AnimeClient::DEFAULT_CONTROLLER_NAMESPACE; $default_namespace = AnimeClient::DEFAULT_CONTROLLER_NAMESPACE;
$path = str_replace('\\', '/', $default_namespace); $path = str_replace('\\', '/', $default_namespace);
$path = str_replace('Aviat/AnimeClient/', '', $path);
$path = trim($path, '/'); $path = trim($path, '/');
$actual_path = realpath(\_dir(AnimeClient::SRC_DIR, $path)); $actual_path = realpath(\_dir(AnimeClient::SRC_DIR, $path));
$class_files = glob("{$actual_path}/*.php"); $class_files = glob("{$actual_path}/*.php");
@ -273,7 +271,7 @@ class Dispatcher extends RoutingBase {
$params = []; $params = [];
switch($failure->failedRule) { switch($failure->failedRule) {
case 'Aura\Router\Rule\Alows': case 'Aura\Router\Rule\Allows':
$params = [ $params = [
'http_code' => 405, 'http_code' => 405,
'title' => '405 Method Not Allowed', 'title' => '405 Method Not Allowed',

View File

@ -31,27 +31,8 @@ function _dir()
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
require _dir(__DIR__, 'AnimeClient_TestCase.php'); require _dir(__DIR__, 'AnimeClient_TestCase.php');
// Define base path constants
require _dir(__DIR__, '../vendor/autoload.php'); require _dir(__DIR__, '../vendor/autoload.php');
/**
* Set up autoloaders
*
* @codeCoverageIgnore
* @return void
*/
spl_autoload_register(function ($class) {
$class_parts = explode('\\', $class);
$ns_path = realpath(__DIR__ . '/../src') . '/' . implode('/', $class_parts) . ".php";
if (file_exists($ns_path))
{
require_once($ns_path);
return;
}
});
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Ini Settings // Ini Settings
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------