Skip to content

Commit

Permalink
Added Respect\Config dependence.
Browse files Browse the repository at this point in the history
  • Loading branch information
henriquemoody committed Feb 14, 2012
1 parent 9bdc73f commit f8150dc
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 19 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -0,0 +1,3 @@
/composer.lock
/composer.phar
/vendor
15 changes: 12 additions & 3 deletions composer.json
Expand Up @@ -3,11 +3,11 @@
"version": "0.1.1-alpha", "version": "0.1.1-alpha",
"type": "library", "type": "library",
"description": "Makes your code speak CLI", "description": "Makes your code speak CLI",
"homepage": "http:\/\/respect.li", "homepage": "http://respect.li",
"repositories": { "repositories": {
"repository": { "repository": {
"vcs": { "vcs": {
"url": "http:\/\/github.com\/Respect\/Cli" "url": "http://github.com/Respect/Cli"
} }
} }
}, },
Expand All @@ -16,10 +16,19 @@
{ {
"name": "Alexandre Gaigalas", "name": "Alexandre Gaigalas",
"email": "alexandre@gaigalas.net" "email": "alexandre@gaigalas.net"
},
{
"name": "Augusto Pascutti",
"email": "augusto@phpsp.org.br"
},
{
"name": "Henrique Moody",
"email": "henriquemoody@gmail.com"
} }
], ],
"require": { "require": {
"php": ">=5.3.0" "php": ">=5.3.0",
"respect/config": ">=0.3.1-dev"
}, },
"autoload": { "autoload": {
"psr-0": { "psr-0": {
Expand Down
33 changes: 17 additions & 16 deletions tests/bootstrap.php
Expand Up @@ -2,27 +2,28 @@


date_default_timezone_set('UTC'); date_default_timezone_set('UTC');


$pear_path = trim(`pear config-get php_dir`);
set_include_path('../library'
. PATH_SEPARATOR . $pear_path
. PATH_SEPARATOR . get_include_path());

/** /**
* Autoloader that implements the PSR-0 spec for interoperability between * Autoloader that implements the PSR-0 spec for interoperability between
* PHP software. * PHP software.
*/ */
spl_autoload_register( if (!@include __DIR__.'/../vendor/.composer/autoload.php') {
function($className) { $pear_path = trim(`pear config-get php_dir`);
$fileParts = explode('\\', ltrim($className, '\\')); set_include_path('../library'
. PATH_SEPARATOR . $pear_path
. PATH_SEPARATOR . get_include_path());
spl_autoload_register(
function($className) {
$fileParts = explode('\\', ltrim($className, '\\'));


if (false !== strpos(end($fileParts), '_')) if (false !== strpos(end($fileParts), '_'))
array_splice($fileParts, -1, 1, explode('_', current($fileParts))); array_splice($fileParts, -1, 1, explode('_', current($fileParts)));


$file = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php'; $file = implode(DIRECTORY_SEPARATOR, $fileParts) . '.php';


foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) { foreach (explode(PATH_SEPARATOR, get_include_path()) as $path) {
if (file_exists($path = $path . DIRECTORY_SEPARATOR . $file)) if (file_exists($path = $path . DIRECTORY_SEPARATOR . $file))
return require $path; return require $path;
}
} }
} );
); }

0 comments on commit f8150dc

Please sign in to comment.