Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable to chose file type : .zip or .tar or .tar.gz #8

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

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