Small refactoring and documentation fix

This commit is contained in:
Stéphane Goetz 2017-11-07 23:17:05 +01:00
parent def4b5ed98
commit 837fca6886
3 changed files with 18 additions and 11 deletions

View File

@ -6,7 +6,7 @@
[![Build Status](https://img.shields.io/travis/dauxio/daux.io/master.svg?style=flat-square)](https://travis-ci.org/dauxio/daux.io) [![Build Status](https://img.shields.io/travis/dauxio/daux.io/master.svg?style=flat-square)](https://travis-ci.org/dauxio/daux.io)
[![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/dauxio/daux.io.svg?style=flat-square)](https://scrutinizer-ci.com/g/dauxio/daux.io/code-structure) [![Coverage Status](https://img.shields.io/scrutinizer/coverage/g/dauxio/daux.io.svg?style=flat-square)](https://scrutinizer-ci.com/g/dauxio/daux.io/code-structure)
[![Quality Score](https://img.shields.io/scrutinizer/g/dauxio/daux.io.svg?style=flat-square)](https://scrutinizer-ci.com/g/dauxio/daux.io) [![Quality Score](https://img.shields.io/scrutinizer/g/dauxio/daux.io.svg?style=flat-square)](https://scrutinizer-ci.com/g/dauxio/daux.io)
[![Total Downloads](https://img.shields.io/packagist/dt/dauxio/daux.io.svg?style=flat-square)](https://packagist.org/packages/dauxio/daux.io) [![Total Downloads](https://img.shields.io/packagist/dt/daux/daux.io.svg?style=flat-square)](https://packagist.org/packages/daux/daux.io)
**Daux.io** is a documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly. It helps you create great looking documentation in a developer friendly way. **Daux.io** is a documentation generator that uses a simple folder structure and Markdown files to create custom documentation on the fly. It helps you create great looking documentation in a developer friendly way.

View File

@ -72,7 +72,7 @@ class Daux
// Read command line overrides // Read command line overrides
$override_file = $this->getConfigurationOverride($override_file); $override_file = $this->getConfigurationOverride($override_file);
if ($override_file != null) { if ($override_file !== null) {
$params->setConfigurationOverrideFile($override_file); $params->setConfigurationOverrideFile($override_file);
$this->loadConfiguration($override_file); $this->loadConfiguration($override_file);
} }

View File

@ -469,11 +469,19 @@ class DauxHelper
return '' !== $parts['root']; return '' !== $parts['root'];
} }
public static function getAbsolutePath($path) {
if (DauxHelper::isAbsolutePath($path)) {
return $path;
}
return getcwd() . '/' . $path;
}
/** /**
* @param $path * @param string|null $path
* @param $basedir * @param string $basedir
* @param $var * @param string $var The constant name to check
* @param $type * @param "dir"|"file" $type
* @return false|null|string * @return false|null|string
*/ */
public static function findLocation($path, $basedir, $var, $type) { public static function findLocation($path, $basedir, $var, $type) {
@ -483,18 +491,17 @@ class DauxHelper
return $env; return $env;
} }
// If Path is explicitly null, it's useless to go further
if ($path == null) { if ($path == null) {
return null; return null;
} }
// Check if it's relative to the current directory or an absolute path
if (DauxHelper::is($path, $type)) { if (DauxHelper::is($path, $type)) {
if (DauxHelper::isAbsolutePath($path)) { return DauxHelper::getAbsolutePath($path);
return $path;
}
return getcwd() . '/' . $path;
} }
// Check if it exists relative to Daux's root
$newPath = $basedir . DIRECTORY_SEPARATOR . $path; $newPath = $basedir . DIRECTORY_SEPARATOR . $path;
if (DauxHelper::is($newPath, $type)) { if (DauxHelper::is($newPath, $type)) {
return $newPath; return $newPath;