Skip to content

Conversation

@pierreboutet
Copy link

Hello,
this add a parameter to chose file type for the package (zip / tar / tar.gz)

File zipFile = File.createTempFile(projectName + "-", ".zip");
String extension;
BundleType bundleType;
if (fileType == null || fileType.equals("Tar")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be fileType.equals("Zip")

} else if (fileType.equals("Tgz")) {
extension = ".tar.gz";
bundleType = BundleType.Tgz;
} else {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather we throw on an unknown file type since you're already handling the default null case (maybe update it to include empty string too)


sourceDirectory.zip(
new FileOutputStream(zipFile),
if (fileType == null || fileType.equals("Zip")) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might change this to switch based on bundleType since you set it earlier into 1 of the 3 categories (avoids having to have the fallback / null check here)

@Jmcfar
Copy link
Collaborator

Jmcfar commented Dec 19, 2017

Hi!

Thanks for the contribution.

Did you perform any testing as part of the changes? If so it'd be helpful to include that in the PR.

Are you OK with submitting this contribution under the Apache License 2.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants