From 97ac5a1a6229fb399447cf29556a726f9973a182 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 29 Nov 2014 15:35:51 +0100 Subject: [PATCH 1/2] add PHPDOX_HOME, instead of PHPDOC_PHAR --- build/phar/autoload.php.in | 1 + src/config/GlobalConfig.php | 4 ++-- src/config/InheritanceConfig.php | 4 ++-- src/generator/engine/html/HtmlConfig.php | 4 ++-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/build/phar/autoload.php.in b/build/phar/autoload.php.in index 04f7c743..824a5dfb 100644 --- a/build/phar/autoload.php.in +++ b/build/phar/autoload.php.in @@ -21,6 +21,7 @@ spl_autoload_register( Phar::mapPhar('phpdox.phar'); define('PHPDOX_PHAR', 'phpdox.phar'); +define('PHPDOX_HOME', 'phar://' . PHPDOX_PHAR); TheSeer\phpDox\Version::setVersion('___VERSION___'); diff --git a/src/config/GlobalConfig.php b/src/config/GlobalConfig.php index 4bdcf781..76ffbcdc 100644 --- a/src/config/GlobalConfig.php +++ b/src/config/GlobalConfig.php @@ -111,8 +111,8 @@ public function getProjects() { * @throws ConfigException */ protected function runResolver($ctx) { - if (defined('PHPDOX_PHAR')) { - $home = 'phar://' . constant('PHPDOX_PHAR'); + if (defined('PHPDOX_HOME')) { + $home = PHPDOX_HOME; } else { $home = realpath(__DIR__.'/../../'); } diff --git a/src/config/InheritanceConfig.php b/src/config/InheritanceConfig.php index 9a4500e0..dbbadfae 100644 --- a/src/config/InheritanceConfig.php +++ b/src/config/InheritanceConfig.php @@ -55,8 +55,8 @@ public function __construct(CollectorConfig $config, fDOMElement $ctx = NULL) { */ public function getDependencyDirectories() { - if (defined('PHPDOX_PHAR')) { - $home = 'phar://' . constant('PHPDOX_PHAR'); + if (defined('PHPDOX_HOME')) { + $home = PHPDOX_HOME; } else { $home = realpath(__DIR__.'/../../'); } diff --git a/src/generator/engine/html/HtmlConfig.php b/src/generator/engine/html/HtmlConfig.php index 43ce590a..78fbdc50 100644 --- a/src/generator/engine/html/HtmlConfig.php +++ b/src/generator/engine/html/HtmlConfig.php @@ -40,8 +40,8 @@ class HtmlConfig extends \TheSeer\phpDox\BuildConfig { public function getTemplateDirectory() { - if (defined('PHPDOX_PHAR')) { - $default = sprintf('phar://%s/templates/html', PHPDOX_PHAR); + if (defined('PHPDOX_HOME')) { + $default = PHPDOX_HOME . '/templates/html'; } else { $default = __DIR__ . '/../../../../templates/html'; } From 2d920a978e4e8d5e8606db33b2864efd8a010170 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 29 Nov 2014 15:48:34 +0100 Subject: [PATCH 2/2] cleanup, closer to other use of the constant --- src/generator/engine/html/HtmlConfig.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/generator/engine/html/HtmlConfig.php b/src/generator/engine/html/HtmlConfig.php index 78fbdc50..66a7a4b2 100644 --- a/src/generator/engine/html/HtmlConfig.php +++ b/src/generator/engine/html/HtmlConfig.php @@ -41,10 +41,11 @@ class HtmlConfig extends \TheSeer\phpDox\BuildConfig { public function getTemplateDirectory() { if (defined('PHPDOX_HOME')) { - $default = PHPDOX_HOME . '/templates/html'; + $default = PHPDOX_HOME; } else { - $default = __DIR__ . '/../../../../templates/html'; + $default = realpath(__DIR__ . '/../../../..'); } + $default .= '/templates/html'; $node = $this->ctx->queryOne('cfg:template'); if (!$node) { return $default;