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

Add endpoint for downloading a project #7291

Merged
merged 13 commits into from
Jul 14, 2023

Conversation

4e6
Copy link
Contributor

@4e6 4e6 commented Jul 13, 2023

Pull Request Description

close #7194

Changelog:

  • add: /projects/{project_id}/enso_project HTTP endpoint returning an .enso-project archive structure
  • update: archive enso project to a .enso-project .tar.gz archive
  • update: make project path a required field

Important Notes

Checklist

Please ensure that the following checklist has been satisfied before submitting the PR:

  • The documentation has been updated, if necessary.
  • All code follows the
    Scala,
    Java,
    and
    Rust
    style guides. In case you are using a language not listed above, follow the Rust style guide.
  • All code has been tested:
    • Unit tests have been written where possible.

@4e6 4e6 requested a review from JaroslavTulach as a code owner July 13, 2023 16:57
@4e6 4e6 self-assigned this Jul 13, 2023
@4e6 4e6 changed the title Wip/db/7194 endpoint for downloading a project Add endpoint for downloading a project Jul 13, 2023
import org.enso.pkg.Package$;

/** A file visitor that builds a tar archive out of visited files. */
public final class TarArchiveBuildingFileVisitor implements FileVisitor<Path> {
Copy link
Member

Choose a reason for hiding this comment

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

I'd expect this to be an implementation detail class and I'd keep it package private.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made package private

complete(StatusCodes.NotFound)
case Success(Right(Some(archive))) =>
complete(
HttpEntity(
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we also write a test for this endpoint?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

All the tricky logic is about the archive building. This one is pretty straightforward. I'll see if I can mock the project repository and add a test then

/** Error when trying to close an enso-project archive entry. */
public final class CloseArchiveEntryException extends EnsoProjectArchiveException {

public CloseArchiveEntryException(IOException cause) {
Copy link
Member

Choose a reason for hiding this comment

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

If the class (and other similar cases) is only constructed in the same package, then you may want to have package private constructors.

@4e6 4e6 added the CI: Ready to merge This PR is eligible for automatic merge label Jul 14, 2023
@mergify mergify bot merged commit f691713 into develop Jul 14, 2023
@mergify mergify bot deleted the wip/db/7194-endpoint-for-downloading-a-project branch July 14, 2023 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CI: Ready to merge This PR is eligible for automatic merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Project Manager endpoint for downloading a project as an .enso-project archive
2 participants