Skip to content
Permalink
Browse files

[core: getData] Added new parameters, Improve custom chain for gitboo…

…k update (#341)
  • Loading branch information...
enzolutions committed Apr 20, 2018
1 parent bf1fb4a commit e93efb21f062884f50f35acc6f4366f62a91dbf1
Showing with 25 additions and 4 deletions.
  1. +7 −3 dist/chain/update-gitbook.yml
  2. +18 −1 src/Application.php
@@ -1,5 +1,5 @@
# How to use
# update:gitbook --directory="/path/to/drupal-project/"
# update:gitbook --directory="/path/to/drupal-console/gitbook-repository/"
command:
name: update:gitbook
description: 'Update gitbook'
@@ -16,17 +16,21 @@ commands:
- node
- views
- features
{% set languages = ['en', 'es', 'hi', 'hu', 'pt_br', 'ro', 'vn', 'zh_hans'] %}
- command: 'develop:translation:sync'
{% set languages = ['en', 'ca', 'es', 'hi', 'hu', 'ja', 'mr', 'pt-br', 'ro', 'ru', 'vn' , 'zh-hans'] %}
{% for language in languages %}
- command: settings:set
arguments:
name: language
value: {{ language }}
- command: exec
arguments:
bin: 'rm -Rf {{ directory }}/{{ language }}/commands'
- command: develop:doc:gitbook
options:
path: '{{ directory }}/{{ language }}'
{% endfor %}
- command: settings:set
arguments:
name: language
value: en
value: en
@@ -664,7 +664,7 @@ private function registerExtendCommands()
->loadExtendConfiguration();
}
public function getData()
public function getData($filterNamespaces = null, $excludeNamespaces = [], $excludeChainCommands = false)
{
$singleCommands = [
'about',
@@ -693,9 +693,16 @@ public function getData()
return (strpos($item, ':')<=0);
}
);
sort($namespaces);
array_unshift($namespaces, 'misc');
// Exclude specific namespaces
$namespaces = array_diff($namespaces, $excludeNamespaces);
// filter namespaces if available
if($filterNamespaces) $namespaces = array_intersect($namespaces, $filterNamespaces);
foreach ($namespaces as $namespace) {
$commands = $this->all($namespace);
usort(
@@ -705,6 +712,11 @@ public function getData()
);
foreach ($commands as $command) {
// Exclude command if is a chain command and was requested to exclude chain commands
if($excludeChainCommands && $command instanceof ChainCustomCommand) {
continue;
}
if (method_exists($command, 'getModule')) {
if ($command->getModule() == 'Console') {
$data['commands'][$namespace][] = $this->commandData(
@@ -719,6 +731,11 @@ public function getData()
}
}
// Remove namepsaces without commands
$namespaces = array_filter($namespaces, function($namespace) use( $data) {
return count($data['commands'][$namespace]) > 0;
});
$input = $this->getDefinition();
$options = [];
foreach ($input->getOptions() as $option) {

0 comments on commit e93efb2

Please sign in to comment.
You can’t perform that action at this time.