diff --git a/src/Config/Config.php b/src/Config/Config.php index aa9b62e..c4823a4 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -65,7 +65,7 @@ public function setAuthor(string $author) : void { } public function getAuthor() : string { - return $this->author; + return $this->author ?? self::DEFAULT_COMMIT_AUTHOR; } /** diff --git a/src/Config/ConfigInterface.php b/src/Config/ConfigInterface.php index f280b97..f38fc67 100644 --- a/src/Config/ConfigInterface.php +++ b/src/Config/ConfigInterface.php @@ -4,6 +4,9 @@ interface ConfigInterface { + + const DEFAULT_COMMIT_AUTHOR = 'Drupal '; + /** * Branch where artifact is pushed. * diff --git a/src/DrupalArtifactBuilderGit.php b/src/DrupalArtifactBuilderGit.php index 2072f30..9767538 100644 --- a/src/DrupalArtifactBuilderGit.php +++ b/src/DrupalArtifactBuilderGit.php @@ -23,7 +23,7 @@ protected function configure() { parent::configure(); $this->setDescription('Commit and push artifact changes to git.'); $this->addOption('branch', 'b', InputOption::VALUE_REQUIRED,'Git branch'); - $this->addOption('author', 'a', InputOption::VALUE_REQUIRED,'Git commit author', 'Drupal '); + $this->addOption('author', 'a', InputOption::VALUE_REQUIRED,'Git commit author'); } /** @@ -45,6 +45,7 @@ protected function initialize(InputInterface $input, OutputInterface $output) { if ($input->hasOption('author') && !empty($input->getOption('author'))) { $this->getConfiguration()->setAuthor($input->getOption('author')); } + $this->log(sprintf('Commit author: %s', $this->getConfiguration()->getAuthor())); $this->assertRepository(); }