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

feat: clean cache #216

Merged
merged 8 commits into from
Jun 25, 2024
Merged

feat: clean cache #216

merged 8 commits into from
Jun 25, 2024

Conversation

evilrobot-01
Copy link
Contributor

Adds a simple command which allows a user to clean the cache by selecting those cached artifacts which are no longer required.

Note: uses 'clean' so that we can potentially add a default implementation of 'pop clean' to wrap 'cargo clean'. No real benefit apart from fewer characters to type.

Closes #78

Copy link

codecov bot commented Jun 23, 2024

Codecov Report

Attention: Patch coverage is 74.59016% with 93 lines in your changes missing coverage. Please review.

Project coverage is 66.00%. Comparing base (03aecfe) to head (2973f9f).

@@            Coverage Diff             @@
##             main     #216      +/-   ##
==========================================
+ Coverage   65.37%   66.00%   +0.63%     
==========================================
  Files          38       40       +2     
  Lines        5048     5413     +365     
  Branches     5048     5413     +365     
==========================================
+ Hits         3300     3573     +273     
- Misses       1229     1277      +48     
- Partials      519      563      +44     
Files Coverage Δ
crates/pop-cli/src/main.rs 45.33% <ø> (ø)
crates/pop-cli/src/style.rs 82.14% <ø> (ø)
crates/pop-cli/src/commands/mod.rs 0.00% <0.00%> (ø)
crates/pop-cli/src/commands/clean.rs 81.72% <81.72%> (ø)
crates/pop-cli/src/cli.rs 69.94% <69.94%> (ø)

@evilrobot-01
Copy link
Contributor Author

Need #217 merged so that I can complete the implementation of mocking for testing the implementation of the command.

Copy link
Collaborator

@AlexD10S AlexD10S left a comment

Choose a reason for hiding this comment

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

Remove #[cfg(feature = "parachain")] and support removing folders.

A nice-to-have feature would be the option to clean all with an all option in the multiselect or a --all flag. However, this feature is not essential for this PR. If it is not included, I will create a new issue with the good first issue tag for new contributors.

crates/pop-cli/src/commands/mod.rs Outdated Show resolved Hide resolved
crates/pop-cli/src/commands/mod.rs Outdated Show resolved Hide resolved
crates/pop-cli/src/commands/clean.rs Show resolved Hide resolved
@evilrobot-01
Copy link
Contributor Author

Note: have wrapped the cliclack usage in a trait in an effort to enable testing of interactions and improve coverage in the pop-cli crate. Its a manual mock so isnt perfect, but does enable some testing of command logic. Note also that the cli should not be defined on the command as it is not state applicable to the command, but is fine for an initial iteration. This should be refactored into a command handler in the future which injects the required dependencies for a cleaner implementation.

@evilrobot-01
Copy link
Contributor Author

Remove #[cfg(feature = "parachain")] and support removing folders.

Why do we need to remove folders? To my knowledge no folders are created here.

A nice-to-have feature would be the option to clean all with an all option in the multiselect or a --all flag.

Would be nice to have but afraid I dont have the bandwidth to add this now.

Copy link
Collaborator

@AlexD10S AlexD10S left a comment

Choose a reason for hiding this comment

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

Looks good to be merged now.
I've created two new issues to address in separate PRs (#224 and #225).
Additionally, as per your comment, we'll need to refactor the cliclack wrapper and integrate it with the rest of the commands.

@evilrobot-01
Copy link
Contributor Author

Additionally, as per your comment, we'll need to refactor the cliclack wrapper and integrate it with the rest of the commands.

I think we should address the cli parameter on the command as a separate PR first, as it is a dependency rather than command state, before moving all the commands to this type of implementation. I think it will be much easier that way, at least in terms of reviews.

@AlexD10S AlexD10S self-requested a review June 25, 2024 09:38
@AlexD10S AlexD10S merged commit 7de050e into main Jun 25, 2024
15 checks passed
@AlexD10S AlexD10S deleted the frank/cache branch June 25, 2024 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Cache management
2 participants