cleaned up paths.

This commit is contained in:
Taylor Otwell
2012-01-28 14:55:08 -06:00
parent 409e908964
commit 97fcea1e51
29 changed files with 86 additions and 81 deletions

View File

@@ -1,4 +1,4 @@
<?php namespace Laravel\CLI; isset($GLOBALS['APP_PATH']) or die('No direct script access.');
<?php namespace Laravel\CLI; defined('DS') or die('No direct script access.');
use Laravel\Bundle;
use Laravel\Config;
@@ -44,7 +44,7 @@ if (isset($_SERVER['cli']['db']))
* us to seamlessly add tasks to the CLI so that the Task class
* doesn't have to worry about how to resolve core tasks.
*/
require $GLOBALS['SYS_PATH'].'cli/dependencies'.EXT;
require path('sys').'cli/dependencies'.EXT;
/**
* We will wrap the command execution in a try / catch block and

View File

@@ -1,4 +1,4 @@
<?php namespace Laravel\CLI\Tasks\Bundle; isset($GLOBALS['APP_PATH']) or die('No direct script access.');
<?php namespace Laravel\CLI\Tasks\Bundle; defined('DS') or die('No direct script access.');
use Laravel\IoC;
use Laravel\Bundle;
@@ -16,7 +16,7 @@ class Bundler extends Task {
{
foreach ($this->get($bundles) as $bundle)
{
if (is_dir($GLOBALS['BUNDLE_PATH'].$bundle['name']))
if (is_dir(path('bundle').$bundle['name']))
{
echo "Bundle {$bundle['name']} is already installed.";

View File

@@ -17,7 +17,7 @@ class Github implements Provider {
// a location outside of the Git repository, so we don't need
// the full bundle path. We'll just take the basename in case
// the bundle directory has been renamed.
$path = basename($GLOBALS['BUNDLE_PATH']).'/';
$path = basename(path('bundle')).'/';
passthru('git submodule add '.$repository.' '.$path.$bundle['name']);

View File

@@ -16,7 +16,7 @@ class Publisher {
{
$path = Bundle::path($bundle);
$this->move($path.'public', $GLOBALS['PUBLIC_PATH'].'bundles'.DS.$bundle);
$this->move($path.'public', path('public').'bundles'.DS.$bundle);
echo "Assets published for bundle [$bundle].".PHP_EOL;
}
@@ -41,7 +41,7 @@ class Publisher {
*/
protected function to($bundle)
{
return $GLOBALS['PUBLIC_PATH'].'bundles'.DS.$bundle.DS;
return path('public').'bundles'.DS.$bundle.DS;
}
/**

View File

@@ -19,7 +19,7 @@ class Key extends Task {
*/
public function __construct()
{
$this->path = $GLOBALS['APP_PATH'].'config/application'.EXT;
$this->path = path('app').'config/application'.EXT;
}
/**

View File

@@ -222,7 +222,7 @@ class Migrator extends Task {
*/
protected function stub($bundle, $migration)
{
$stub = File::get($GLOBALS['SYS_PATH'].'cli/tasks/migrate/stub'.EXT);
$stub = File::get(path('sys').'cli/tasks/migrate/stub'.EXT);
// The class name is formatted simialrly to tasks and controllers,
// where the bundle name is prefixed to the class if it is not in

View File

@@ -34,7 +34,7 @@ class Manager extends Task {
// generated on the database.
$migration = $migrator->make(array('create_session_table'));
$stub = $GLOBALS['SYS_PATH'].'cli/tasks/session/migration'.EXT;
$stub = path('sys').'cli/tasks/session/migration'.EXT;
File::put($migration, File::get($stub));
@@ -42,7 +42,7 @@ class Manager extends Task {
// Since the developer is requesting that the session table be
// created on the database, we'll set the driver to database
// to save an extra step for the developer.
$config = File::get($GLOBALS['APP_PATH'].'config/session'.EXT);
$config = File::get(path('app').'config/session'.EXT);
$config = str_replace(
"'driver' => '',",
@@ -50,7 +50,7 @@ class Manager extends Task {
$config
);
File::put($GLOBALS['APP_PATH'].'config/session'.EXT, $config);
File::put(path('app').'config/session'.EXT, $config);
echo PHP_EOL;

View File

@@ -23,7 +23,7 @@ class Runner extends Task {
*/
public function core()
{
if ( ! is_dir($GLOBALS['BUNDLE_PATH'].'laravel-tests'))
if ( ! is_dir(path('bundle').'laravel-tests'))
{
throw new \Exception("The bundle [laravel-tests] has not been installed!");
}
@@ -31,9 +31,9 @@ class Runner extends Task {
// When testing the Laravel core, we will just stub the path directly
// so the test bundle is not required to be registered in the bundle
// configuration, as it is kind of a unique bundle.
$this->stub($GLOBALS['BUNDLE_PATH'].'laravel-tests/cases');
$this->stub(path('bundle').'laravel-tests/cases');
$path = $GLOBALS['BUNDLE_PATH'].'laravel-tests/';
$path = path('bundle').'laravel-tests/';
$this->test();
}
@@ -76,9 +76,9 @@ class Runner extends Task {
// We'll simply fire off PHPUnit with the configuration switch
// pointing to our temporary configuration file. This allows
// us to flexibly run tests for any setup.
passthru('phpunit -c '.$GLOBALS['BASE_PATH'].'phpunit.xml');
passthru('phpunit -c '.path('base').'phpunit.xml');
@unlink($GLOBALS['BASE_PATH'].'phpunit.xml');
@unlink(path('base').'phpunit.xml');
}
/**
@@ -89,11 +89,11 @@ class Runner extends Task {
*/
protected function stub($directory)
{
$stub = File::get($GLOBALS['SYS_PATH'].'cli/tasks/test/stub.xml');
$stub = File::get(path('sys').'cli/tasks/test/stub.xml');
$stub = str_replace('{{directory}}', $directory, $stub);
File::put($GLOBALS['BASE_PATH'].'phpunit.xml', $stub);
File::put(path('base').'phpunit.xml', $stub);
}
}