Permalink
Browse files

Cleanup

  • Loading branch information...
1 parent 8e43a47 commit 4f020f83c036cd7cb7b5952b7f1826fc5b62eb16 @sebastianbergmann committed Nov 9, 2012
Showing with 43 additions and 15 deletions.
  1. +22 −3 composer.json
  2. +21 −12 { → composer}/bin/phploc
View
@@ -1,13 +1,32 @@
{
"name": "phploc/phploc",
"description": "A tool for quickly measuring the size of a PHP project.",
+ "homepage": "https://github.com/sebastianbergmann/phploc",
+ "license": "BSD-3-Clause",
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/phploc/issues",
+ },
"require": {
"php": ">=5.3.3",
"symfony/finder": "2.1.x-dev",
"zetacomponents/console-tools": "dev-master"
},
"autoload": {
- "classmap": ["PHPLOC/"]
+ "classmap": [
@trq

trq Nov 9, 2012

This doesn't work because the directory structure within src/ doesn't conform to PSR-0.

@ihabunek

ihabunek Nov 10, 2012

Contributor

Not true, because he is using "classmap" autoloader. You are thinking of the "psr-0" autoloader.
See here:
http://getcomposer.org/doc/04-schema.md#classmap

@trq

trq via email Nov 10, 2012

+ "src/"
+ ]
},
- "bin": ["bin/phploc"]
-}
+ "bin": [
+ "composer/bin/phpunit"
@trq

trq Nov 9, 2012

Is this a typo? This file doesn't exist, nor is it part of this package.

+ ],
+ "config": {
+ "bin-dir": "bin"
+ }
+}
@@ -42,20 +42,29 @@
* @since File available since Release 1.0.0
*/
-if (strpos('@php_bin@', '@php_bin') === 0) {
- set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
+$files = array(
+ __DIR__ . '/../../vendor/autoload.php',
+ __DIR__ . '/../../../../autoload.php'
+);
+
+$found = FALSE;
+
+foreach ($files as $file) {
+ if (file_exists($file)) {
+ require $file;
+
+ $found = TRUE;
+
+ break;
+ }
}
-// Composer autoloader must be avaiable
-if (file_exists(dirname(__FILE__) . '/../vendor/autoload.php')) {
- // phploc was installed stand-alone
- require_once dirname(__FILE__) . '/../vendor/autoload.php';
-} else if (file_exists(dirname(__FILE__) . '/../../../autoload.php')) {
- // phploc was installed as dependency inside another project
- require_once dirname(__FILE__) . '/../../../autoload.php';
-} else {
- // phploc wasn't installed through composer
- die ('To use this binary, you must install phploc through composer!');
+if (!$found) {
+ die(
+ 'You need to set up the project dependencies using the following commands:' . PHP_EOL .
+ 'curl -s http://getcomposer.org/installer | php' . PHP_EOL .
+ 'php composer.phar install' . PHP_EOL
+ );
}
$textui = new PHPLOC_TextUI_Command;

0 comments on commit 4f020f8

Please sign in to comment.