Skip to content

Commit

Permalink
[WIP] Directory/file organization directus#1197
Browse files Browse the repository at this point in the history
  • Loading branch information
wellingguzman committed Jun 25, 2016
1 parent f65dd08 commit 3a5e9bc
Show file tree
Hide file tree
Showing 26 changed files with 29 additions and 88 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ dist/*

# Don't track composer phar/vendors
composer.phar
api/vendor
vendor

# Ignore log files, but track the log README
api/logs/*.log
Expand Down
2 changes: 1 addition & 1 deletion api/api.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// Composer Autoloader
$loader = require 'vendor/autoload.php';
$loader = require __DIR__.'/../vendor/autoload.php';

// Non-autoload components
require dirname(__FILE__) . '/config.php';
Expand Down
6 changes: 3 additions & 3 deletions api/core/Directus/Bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ private static function filesystem()
private static function extensions() {
self::requireConstants('APPLICATION_PATH', __FUNCTION__);
$extensions = array();
$extensionsDirectory = APPLICATION_PATH . '/extensions/';
$extensionsDirectory = APPLICATION_PATH . '/customs/extensions/';
foreach (new \DirectoryIterator($extensionsDirectory) as $file) {
if($file->isDot()) {
continue;
Expand All @@ -365,7 +365,7 @@ private static function extensions() {
*/
private static function uis() {
self::requireConstants('APPLICATION_PATH', __FUNCTION__);
$uiDirectory = APPLICATION_PATH . '/ui';
$uiDirectory = APPLICATION_PATH . '/customs/ui';
$uis = array();

if (!file_exists($uiDirectory)) {
Expand All @@ -392,7 +392,7 @@ private static function uis() {
private static function listViews() {
self::requireConstants('APPLICATION_PATH', __FUNCTION__);
$listViews = array();
$listViewsDirectory = APPLICATION_PATH . '/listviews/';
$listViewsDirectory = APPLICATION_PATH . '/customs/listviews/';
foreach (new \DirectoryIterator($listViewsDirectory) as $file) {
if($file->isDot()) {
continue;
Expand Down
4 changes: 2 additions & 2 deletions api/core/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ function load_registered_hooks($listeners, $areFilters = false)

function getLocale() {
// TODO: get locale from user.
return 'en';
return 'es';
}

function getDefaultPhrases() {
Expand All @@ -164,7 +164,7 @@ function getDefaultPhrases() {
}

function getPhrases($locale = 'en') {
$langFile = BASE_PATH.'/content/locales/'.$locale.'.json';
$langFile = BASE_PATH.'/customs/locales/'.$locale.'.json';

if (file_exists($langFile)) {
$phrases = json_decode(file_get_contents($langFile), true);
Expand Down
6 changes: 3 additions & 3 deletions app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ require.config({
"vendor": "../assets/vendor",

// Extensions
"extensions": '../extensions',
"listviews": '../listviews',
"ui": '../ui'
"extensions": '../customs/extensions',
"listviews": '../customs/listviews',
"ui": '../customs/ui'
},

shim: {
Expand Down
2 changes: 1 addition & 1 deletion bin/directus
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<?php

// Composer Autoloader
$loader = require __DIR__ . '/../api/vendor/autoload.php';
$loader = require __DIR__ . '/../vendor/autoload.php';

use Directus\Util\Installation\Console;

Expand Down
2 changes: 1 addition & 1 deletion bin/directusLoader.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// Composer Autoloader
$loader = require __DIR__ . '/../api/vendor/autoload.php';
$loader = require __DIR__ . '/../vendor/autoload.php';

// Non-autoload components
require __DIR__ . '/../api/config.php';
Expand Down
4 changes: 2 additions & 2 deletions bin/ruckus.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
define('ROOTPATH', dirname(dirname(__FILE__)));
error_reporting(0);

$loader = require ROOTPATH . '/api/vendor/autoload.php';
$loader = require ROOTPATH . '/vendor/autoload.php';
$loader->add("Ruckusing", ROOTPATH . "/api/vendor/ruckusing/ruckusing-migrations/lib/");

use Ruckusing\FrameworkRunner as Ruckusing_Framework;
Expand All @@ -16,4 +16,4 @@

$main = new Ruckusing_Framework($config, $_SERVER['argv']);
$output = $main->execute();
echo $output;
echo $output;
6 changes: 3 additions & 3 deletions api/composer.json → composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@
},
"autoload": {
"psr-4": {
"Directus\\": "core/Directus/",
"Directus\\Installation\\": "../installation/includes/"
"Directus\\": "api/core/Directus/",
"Directus\\Installation\\": "installation/includes/"
},
"files": [
"core/functions.php"
"api/core/functions.php"
]
}
}
File renamed without changes.
2 changes: 2 additions & 0 deletions customs/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Prevent directory listing
IndexIgnore *
File renamed without changes.
File renamed without changes.
File renamed without changes.
Empty file added customs/locales/.gitkeep
Empty file.
File renamed without changes.
58 changes: 0 additions & 58 deletions extensions/_example/main.js

This file was deleted.

3 changes: 0 additions & 3 deletions extensions/_example/templates/example.html

This file was deleted.

6 changes: 3 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ gulp.task('singlepage', function () {
// Composer - Gulp Task
// --------------------
gulp.task('composer', function(cb) {
var child = cp.spawn('composer', ['install', '--ansi', '--prefer-dist', '--no-dev'], {cwd: './dist/api'});
var child = cp.spawn('composer', ['install', '--ansi', '--prefer-dist', '--no-dev'], {cwd: './dist/'});

child.stdout.on('data', function(chunk) {
process.stdout.write(chunk);
Expand All @@ -240,7 +240,7 @@ gulp.task('move', function() {
'./api/logs/*',
'./api/migrations/**/*',
// './api/vendor/**/*.*',
'./api/composer.json',
'./composer.json',
'./api/.htaccess',
'./api/api.php',
'./api/config_sample.php',
Expand Down Expand Up @@ -320,4 +320,4 @@ gulp.task('build', function(cb) {
});

// Default task
gulp.task('default', ['watch', 'build']);
gulp.task('default', ['watch', 'build']);
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
}

// Composer Autoloader
$loader = require 'api/vendor/autoload.php';
$loader = require 'vendor/autoload.php';

// Non-autoloaded components
require 'api/api.php';
Expand Down
2 changes: 1 addition & 1 deletion installation/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

require __DIR__.'/includes/install.functions.php';

$vendorAutoload = BASE_PATH.'/api/vendor/autoload.php';
$vendorAutoload = BASE_PATH.'/vendor/autoload.php';
$installationAutoload = __DIR__.'/autoload.php';

if (!file_exists($vendorAutoload)) {
Expand Down
2 changes: 1 addition & 1 deletion installation/includes/Steps/CheckRequirementsStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public function preRun(&$state)
$errors[] = 'Your host needs to have GD Library enabled to run this version of Directus!';
}

if (!file_exists(BASE_PATH.'/api/vendor/autoload.php')) {
if (!file_exists(BASE_PATH.'/vendor/autoload.php')) {
$errors[] = 'Composer dependencies must be installed first.';
}

Expand Down
2 changes: 1 addition & 1 deletion installation/views/confirm.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@
</tr>
<tr>
<td class="item">Composer Dependencies Installed (../api/composer.json)</td>
<td class="result"><?php if(file_exists('../api/vendor/autoload.php')) {echo('<span class="label label-success">Yes</span>');} else {echo('<span class="label label-important">No</span><a href="https://github.com/RNGR/Directus/wiki/6.-Development-Build#step-4-install-dependencies" target="_blank"> ?</a>');} ?></td>
<td class="result"><?php if(file_exists('../vendor/autoload.php')) {echo('<span class="label label-success">Yes</span>');} else {echo('<span class="label label-important">No</span><a href="https://github.com/RNGR/Directus/wiki/6.-Development-Build#step-4-install-dependencies" target="_blank"> ?</a>');} ?></td>
</tr>
<tr>
<td class="item">Logs Writable (../api/logs/)</td>
Expand Down
2 changes: 1 addition & 1 deletion login.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
}

// Composer Autoloader
$loader = require 'api/vendor/autoload.php';
$loader = require 'vendor/autoload.php';

define('BASE_PATH', dirname(__FILE__));
define('API_PATH', BASE_PATH . '/api');
Expand Down
2 changes: 1 addition & 1 deletion media_auth_proxy/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

// Composer Autoloader
$loader = require '../api/vendor/autoload.php';
$loader = require '../vendor/autoload.php';

// Non-autoload components
require dirname(__FILE__) . '/../api/config.php';
Expand Down
2 changes: 1 addition & 1 deletion phpunit.php
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<?php

$loader = require __DIR__.'/api/vendor/autoload.php';
$loader = require __DIR__.'/vendor/autoload.php';

0 comments on commit 3a5e9bc

Please sign in to comment.