From 9aeda2c86034af12ed9ff6083a1123065f9d2bcd Mon Sep 17 00:00:00 2001 From: James Hodgson Date: Fri, 8 Mar 2019 08:44:29 +0000 Subject: [PATCH] Add option to allow specifying directories to ignore --- src/PushCommand.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/PushCommand.php b/src/PushCommand.php index b17a261..bdb7618 100644 --- a/src/PushCommand.php +++ b/src/PushCommand.php @@ -34,9 +34,10 @@ protected function configure() new InputOption('username', null, InputArgument::OPTIONAL, 'Username to log in the distant Nexus repository'), new InputOption('password', null, InputArgument::OPTIONAL, 'Password to log in the distant Nexus repository'), + new InputOption('ignore-dirs', 'i', InputOption::VALUE_OPTIONAL | InputOption::VALUE_IS_ARRAY, 'Directories to ignore when creating the zip') ]) ->setHelp(<<nexus-push command uses the archive command to reate a ZIP +The nexus-push command uses the archive command to create a ZIP archive and send it to the configured (or given) nexus repository. EOT ) @@ -62,9 +63,11 @@ protected function execute(InputInterface $input, OutputInterface $output) $packageName . '-' . $input->getArgument('version') )); + $ignoredDirectories = array_merge(['vendor'], $input->getOption('ignore-dirs')); + try { ZipArchiver::archiveDirectory(getcwd(), $fileName, $subdirectory, - ['vendor'], + $ignoredDirectories, $this->getIO()); $url = $this->generateUrl( @@ -99,8 +102,8 @@ protected function execute(InputInterface $input, OutputInterface $output) * * @return string URL to the repository */ - private function generateUrl($url, $name, $version) { - + private function generateUrl($url, $name, $version) + { if (empty($url)) { $url = $this->getNexusExtra('url');