-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
API Add configuration loader, YAML configuration file for commands
* Remove username fro member:create * Move flush option to application instead of base command
- Loading branch information
1 parent
52e4415
commit 7463be2
Showing
9 changed files
with
204 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
# | ||
# silverleague/silverstripe-console: Command configuration | ||
# | ||
# - Add new commands to this file | ||
# | ||
# Note that BuildTask commands are added automatically. | ||
# | ||
|
||
Commands: | ||
- SilverLeague\Console\Command\Member\ChangeGroupsCommand | ||
- SilverLeague\Console\Command\Member\ChangePasswordCommand | ||
- SilverLeague\Console\Command\Member\CreateCommand |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
|
||
namespace SilverLeague\Console\Framework\Loader; | ||
|
||
use RuntimeException; | ||
use SilverLeague\Console\Framework\ConsoleBase; | ||
use Symfony\Component\Yaml\Yaml; | ||
|
||
/** | ||
* The Configuration Loader is reponsible for loading the core configuration YAML file, and merging in any | ||
* other configuration files from other locations | ||
* | ||
* @package silverstripe-console | ||
* @author Robbie Averill <robbie@averill.co.nz> | ||
*/ | ||
class ConfigurationLoader extends ConsoleBase | ||
{ | ||
/** | ||
* The configuration file name to look for | ||
* | ||
* @var string | ||
*/ | ||
const CONFIGURATION_FILE = 'console.yml'; | ||
|
||
/** | ||
* Load the YAML configuration for the application and return it | ||
* | ||
* @return array | ||
* @throws RuntimeException If the filecould not be loaded | ||
*/ | ||
public function load() | ||
{ | ||
$filename = CONSOLE_BASE_DIR . '/' . self::CONFIGURATION_FILE; | ||
if (!file_exists($filename) || !is_readable($filename)) { | ||
throw new RuntimeException('The configuration YAML file does not exist!'); | ||
} | ||
|
||
return Yaml::parse($filename); | ||
} | ||
} |
3 changes: 2 additions & 1 deletion
3
src/Framework/SilverStripeLoader.php → src/Framework/Loader/SilverStripeLoader.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters