Skip to content

Commit

Permalink
Connects to #1711: Adding config:get and config:dump commmands. (#1714)
Browse files Browse the repository at this point in the history
* Connects to #1711: Adding config:get and config:dump commmands.

* Executing config:dump during CI.
  • Loading branch information
grasmash authored Jun 21, 2017
1 parent beb4b0b commit 8b4b03b
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
3 changes: 3 additions & 0 deletions scripts/blt/ci/internal/create_blt_project.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ sed -i "s:deploy_updates:deploy_install:g" hooks/common/post-code-update/post-co
# Create example command and hook files.
blt examples:init

# Dump all config values.
blt config:dump

set +v
40 changes: 40 additions & 0 deletions src/Robo/Commands/Blt/ConfigCommand.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<?php

namespace Acquia\Blt\Robo\Commands\Blt;

use Acquia\Blt\Robo\BltTasks;
use Acquia\Blt\Robo\Exceptions\BltException;

/**
* Defines commands in the 'config:*' namespace.
*/
class ConfigCommand extends BltTasks {

/**
* Gets the value of a config variable.
*
* @command config:get
*
* @param string $key The key for the configuration item to get.
*
* @throws \Acquia\Blt\Robo\Exceptions\BltException
*/
public function getValue($key) {
if (!$this->getConfig()->has($key)) {
throw new BltException("$key is not set.");
}

$this->say($this->getConfigValue($key));
}

/**
* Dumps all configuration values.
*
* @command config:dump
*/
public function dump() {
$config = $this->getConfig()->export();
$this->printArrayAsTable($config);
}

}

0 comments on commit 8b4b03b

Please sign in to comment.