-
Notifications
You must be signed in to change notification settings - Fork 55
Added executable binary path option for zip and 7z #126
base: master
Are you sure you want to change the base?
Conversation
Nyholm
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @patrickbussmann.
I like this change. I just had some minor comments.
| processor: | ||
| type: tar # Required: tar|zip|7z | ||
| options: | ||
| executable: zip|7z # If not added to path variable please set binary path for zip and 7z! e.g. on Windows: 'C:\Program Files\7-Zip\7z.exe' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Im not sure I understand this comment. Is "zip|7z" default value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the default decides which executable to use. So if type is set to zip the executable is zip and if its set to 7z then the executable is 7z. If you use tar as type its ignored because tar and bzip is used.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it would be better to specify the possibilities right in the comment, otherwise it's a little bit confusing.
Processor/ZipProcessor.php
Outdated
| } | ||
|
|
||
| return sprintf('cd %s && zip %s %s .', $basePath, implode(' ', $params), $archivePath); | ||
| $binaryFile = escapeshellarg(isset($this->options['executable']) ? $this->options['executable'] : 'zip'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrong indentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
Processor/SevenZipProcessor.php
Outdated
| } | ||
|
|
||
| return sprintf('cd %s && 7z a %s %s', $basePath, implode(' ', $params), $archivePath); | ||
| $binaryFile = escapeshellarg(isset($this->options['executable']) ? $this->options['executable'] : '7z'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be shortened to $binaryFile = escapeshellarg($this->options['executable'] ?: '7z');
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Thanks 👍
I want to use this bundle on a Amazon ElasticBeanstalk Environment.
If I want to use 7zip I must install it via this command.
And then I can execute it via
7za.But in this bundle the default is
7zso I cant execute them.Linux solution will be to make a symlink from 7z to 7za. This should work, too. (Temporarily)
But on my windows development environment I want to test it, too - without changing path variable. So now I can add
executable: 'C:\Program Files\7-Zip\7z.exe'to config.yml and it works.Other solution is to add it to path.
I added this functionality for zip, too. But not for tar because then we need two executable paths.