Skip to content

Commit

Permalink
Add option to allow specifying directories to ignore
Browse files Browse the repository at this point in the history
  • Loading branch information
Hodgy committed Mar 8, 2019
1 parent 313ab98 commit 9aeda2c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/PushCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(<<<EOT
The <info>nexus-push</info> command uses the archive command to reate a ZIP
The <info>nexus-push</info> command uses the archive command to create a ZIP
archive and send it to the configured (or given) nexus repository.
EOT
)
Expand All @@ -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(
Expand Down Expand Up @@ -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');

Expand Down

0 comments on commit 9aeda2c

Please sign in to comment.