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

Remove cask/cmd/zap #14864

Merged
merged 5 commits into from Mar 6, 2023
Merged

Conversation

hyuraku
Copy link
Contributor

@hyuraku hyuraku commented Mar 2, 2023

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example.
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally?

remove cask/cmd/zap because of #14799

Comment on lines -10 to -26
it "can zap and unlink multiple Casks at once" do
caffeine = Cask::CaskLoader.load(cask_path("local-caffeine"))
transmission = Cask::CaskLoader.load(cask_path("local-transmission"))

Cask::Installer.new(caffeine).install
Cask::Installer.new(transmission).install

expect(caffeine).to be_installed
expect(transmission).to be_installed

described_class.run("local-caffeine", "local-transmission")

expect(caffeine).not_to be_installed
expect(caffeine.config.appdir.join("Caffeine.app")).not_to be_a_symlink
expect(transmission).not_to be_installed
expect(transmission.config.appdir.join("Transmission.app")).not_to be_a_symlink
end
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it would be possible to salvage some part of this test. We have a test for the zap artifact but not for the zap uninstall as a whole outside of this one. Maybe a one cask zap test could be added to cask/installer_spec.rb?

To be clear I don't think moving/adding that test should block this PR necessarily.

Comment on lines +71 to +77
casks.each do |cask|
odebug "Zapping Cask #{cask}"

raise Cask::CaskNotInstalledError, cask if !cask.installed? && !args.force?

Cask::Installer.new(cask, verbose: args.verbose?, force: args.force?).zap
end
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if it'd be better to just have this in another file like Cask::Uninstall. Then, we could provide a similar interface to what we do with uninstalling kegs above and combine the zap and uninstall command logic a bit.

Cask::Uninstall.uninstall_casks(
  *casks,
  verbose: args.verbose?,
  force:   args.force?,
  zap: args.zap?,
)

Copy link
Member

Choose a reason for hiding this comment

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

@apainintheneck I dunno. I kinda like this with how minimal it is and avoiding the need for another file.

Copy link
Contributor

Choose a reason for hiding this comment

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

In this case, it's just a few lines but once cask/cmd/uninstall gets removed a few more lines will be added. It's not the end of the word either way but I'd prefer to keep cask stuff in /cask and keep the commands leaner if possible. Another option would be to add them to the Uninstall module but that's not my first choice either.

Copy link
Member

Choose a reason for hiding this comment

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

Let's just do this as-is now and require that change in cask/cmd/uninstall.

@MikeMcQuaid
Copy link
Member

Thanks again @hyuraku! Looks good once CI is 🟢

auto-merge was automatically disabled March 6, 2023 12:41

Head branch was pushed to by a user without write access

@MikeMcQuaid MikeMcQuaid merged commit bb73c3d into Homebrew:master Mar 6, 2023
20 of 23 checks passed
@github-actions github-actions bot added the outdated PR was locked due to age label Apr 6, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants