From 6584c5c7630b5395bc3ebbd01331210171f7477f Mon Sep 17 00:00:00 2001 From: m1 Date: Sat, 19 Dec 2015 12:58:17 +0000 Subject: [PATCH] README, CHANGELOG update --- CHANGELOG.md | 14 ++++++++++++++ README.md | 20 +++++++++++++++++--- src/Traits/PathTrait.php | 30 +++++++++++++++++++++++------- src/Vars.php | 1 - 4 files changed, 54 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 213115d..a7d5618 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,20 @@ All Notable changes to `Vars` will be documented in this file +## 0.3.0 - 2015-12-19 + +### Added +- Add recursive dir toggle flag +- Add suppression flag +- Add if else flag +- Add path trait + +### Altered +- Moved path logic to path trait + +### Fixed +- README format + ## 0.2.0 - 2015-12-16 ### Added diff --git a/README.md b/README.md index 4dfb148..c4b1e01 100644 --- a/README.md +++ b/README.md @@ -203,13 +203,21 @@ test_key_1: imports: sub/ ``` -Importing directories is by default recursive and will search folders within folders, you can change this by adding a recursive toggle: +Importing directories is by default not recursive and will not search folders within folders, you can change this by adding a recursive toggle: ``` yml test_key_1: imports: resource: sub/ - recursive: false + recursive: true +``` + +or by adding a recursive flag: +``` yml +test_key_1: + imports: + resource: sub/* ``` + As with the loading files, you can bulk import dirs with one recursive toggle: ``` yml test_key_1: @@ -238,7 +246,13 @@ The suppress exceptions flag `@` -- suppresses files not found exceptions. eg: imports: @file_does_not_exist.yml ``` -You can also combine the above two flags, so if the else file option does not exist, it won't throw an exception, eg: +The recursive flag makes it so directories within directories are searched for files. eg: +``` yml +imports: + resource: sub/* +``` + +You can also combine the above flags, so if the else file option does not exist, it won't throw an exception, eg: ```yml imports: example_1.yml ?: @example_2.yml diff --git a/src/Traits/PathTrait.php b/src/Traits/PathTrait.php index 6446d42..f150e1e 100644 --- a/src/Traits/PathTrait.php +++ b/src/Traits/PathTrait.php @@ -1,13 +1,28 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + * + * @package m1/vars + * @version 0.3.0 + * @author Miles Croxford + * @copyright Copyright (c) Miles Croxford + * @license http://github.com/m1/vars/blob/master/LICENSE + * @link http://github.com/m1/vars/blob/master/README.MD Documentation */ namespace M1\Vars\Traits; +/** + * Path trait gives common operation functions needed for Paths in Vars + * + * @since 0.1.0 + */ trait PathTrait { /** @@ -30,8 +45,9 @@ public function getPath() /** * Set the Vars base path * - * @param string $path The path to set - * + * @param string $path The path to set + * @param boolean $check_writeable Check whether dir is writeable + * @throws \InvalidArgumentException If the path does not exist or is not writable * * @return \M1\Vars\Vars @@ -52,4 +68,4 @@ public function setPath($path, $check_writeable = false) $this->path = realpath($path); return $this; } -} \ No newline at end of file +} diff --git a/src/Vars.php b/src/Vars.php index b0ff735..adf7760 100644 --- a/src/Vars.php +++ b/src/Vars.php @@ -159,7 +159,6 @@ private function makePaths($options) $this->setPath($options['path']); if (is_null($options['cache_path']) && !is_null($options['path'])) { - $this->cache->setPath($options['path']); $this->paths_loaded = true; }