Skip to content

Commit

Permalink
Merge pull request #10 from zerkalica/master
Browse files Browse the repository at this point in the history
Composer support
  • Loading branch information
manuelpichler committed Sep 7, 2012
2 parents 3291fba + dbbd7cb commit 3622bb8
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
14 changes: 14 additions & 0 deletions composer.json
@@ -0,0 +1,14 @@
{
"name": "zerkalica/phpmd",
"description": "Unofficial version of PHPMD development staff to be handled with Composer.",
"require": {
"php": ">=5.3.0",
"pdepend/pdepend": "dev-master"
},
"include-path": [
"../../pdepend/pdepend/src/main/php",
"src/main/php"
],
"bin": ["src/bin/phpmd"]
}

25 changes: 16 additions & 9 deletions src/bin/phpmd.php → src/bin/phpmd
@@ -1,15 +1,22 @@
#!/usr/bin/env php
<?php

// PEAR installation workaround
if (strpos('@package_version@', '@package_version') === 0) {
set_include_path(
dirname(__FILE__) . '/../main/php' .
PATH_SEPARATOR .
dirname(__FILE__) . '/../../lib/pdepend/src/main/php' .
PATH_SEPARATOR .
'.'
);

if (file_exists(__DIR__ . '/../../../../autoload.php')) {
// phpmd is part of a composer installation
require_once __DIR__ . '/../../../../autoload.php';
} else {

// PEAR installation workaround
if (strpos('@package_version@', '@package_version') === 0) {
set_include_path(
dirname(__FILE__) . '/../main/php' .
PATH_SEPARATOR .
dirname(__FILE__) . '/../../lib/pdepend/src/main/php' .
PATH_SEPARATOR .
'.'
);
}
}

// Allow as much memory as possible by default
Expand Down

0 comments on commit 3622bb8

Please sign in to comment.