Skip to content

Commit

Permalink
Merge pull request #21 from mothership-gmbh/develop
Browse files Browse the repository at this point in the history
Missing configuration files will not affect other commands
  • Loading branch information
azngeek committed Feb 22, 2016
2 parents ead4dd5 + e4b6a37 commit 3e505d3
Showing 1 changed file with 22 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,31 +92,34 @@ protected function configure()
'configuration'
);

$workflowConfigurationFile = getcwd() . '/app/etc/mothership/workflows/' . $explodedConfig[1];
if (array_key_exists(1, $explodedConfig) && strpos($explodedConfig[1], 'yaml') !== false) {

if (file_exists($workflowConfigurationFile)) {
$workflowConfiguration = \Symfony\Component\Yaml\Yaml::parse(file_get_contents($workflowConfigurationFile));
$workflowConfigurationFile = getcwd() . '/app/etc/mothership/workflows/' . $explodedConfig[1];

if (array_key_exists('options', $workflowConfiguration)) {
if (file_exists($workflowConfigurationFile)) {
$workflowConfiguration = \Symfony\Component\Yaml\Yaml::parse(file_get_contents($workflowConfigurationFile));

// add the config
$this->addOption(
'interactive',
'i',
InputOption::VALUE_NONE,
'enables the interactive mode'
);

$this->workflowConfiguration = $workflowConfiguration['options'];
if (array_key_exists('options', $workflowConfiguration)) {

foreach ($workflowConfiguration['options'] as $_option => $_optionConfiguration) {
// add the config
$this->addOption(
$_option,
array_key_exists('short', $_optionConfiguration) ? $_optionConfiguration['short'] : null,
$_optionConfiguration['required'],
$_optionConfiguration['description'],
array_key_exists('default', $_optionConfiguration) ? $_optionConfiguration['default'] : null
'interactive',
'i',
InputOption::VALUE_NONE,
'enables the interactive mode'
);

$this->workflowConfiguration = $workflowConfiguration['options'];

foreach ($workflowConfiguration['options'] as $_option => $_optionConfiguration) {
$this->addOption(
$_option,
array_key_exists('short', $_optionConfiguration) ? $_optionConfiguration['short'] : null,
$_optionConfiguration['required'],
$_optionConfiguration['description'],
array_key_exists('default', $_optionConfiguration) ? $_optionConfiguration['default'] : null
);
}
}
}
}
Expand Down

0 comments on commit 3e505d3

Please sign in to comment.