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

Port remaining commands to use AbstractCommand #16998

Merged
merged 30 commits into from
Apr 2, 2024
Merged

Conversation

dduugg
Copy link
Member

@dduugg dduugg commented Apr 1, 2024

  • 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?

Continuation of #16975

Resolves #16814 (though there will be some cleanup PRs)

@dduugg dduugg changed the title Ported next batch of commands Port next batch of commands to use AbstractCommand Apr 1, 2024
@dduugg dduugg changed the title Port next batch of commands to use AbstractCommand Port remaining commands to use AbstractCommand Apr 1, 2024
Copy link
Contributor

@apainintheneck apainintheneck left a comment

Choose a reason for hiding this comment

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

You're a machine. Are you using the dark arts (sed) to update these automatically? 🤣

Comment on lines +12 to +13
UNBREWED_EXCLUDE_FILES = %w[.DS_Store].freeze
UNBREWED_EXCLUDE_PATHS = %w[
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be too paranoid to make these private constants?

($stdout.tty? || super) && !quiet?
end
def verbose?
($stdout.tty? || Context.current.verbose?) && !Context.current.quiet?
Copy link
Contributor

Choose a reason for hiding this comment

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

The context mixin is another option here.

next
end
Migrator.migrate_if_needed(formula, force: args.force?)
Homebrew.reinstall_formula(
Copy link
Contributor

Choose a reason for hiding this comment

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

This should probably get namespaced properly at some point. It seems to get used in both the upgrade and reinstall commands.

require "cmd/shared_examples/args_parse"

RSpec.describe Homebrew::Cmd::RbenvSync do
it_behaves_like "parseable arguments"
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 we could just automatically run it_behaves_like "parseable arguments" on all abstract command classes. The would remove the need to add this for every command and make it impossible to forget to add this test.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'll move the untap module back into this class after this gets merged in as discussed in #16814 (comment).

@MikeMcQuaid MikeMcQuaid merged commit 0b98c50 into master Apr 2, 2024
25 checks passed
@MikeMcQuaid MikeMcQuaid deleted the ported-cmds branch April 2, 2024 08:00
@MikeMcQuaid
Copy link
Member

Thanks again @dduugg and to @apainintheneck for the review!

@mahmudzero

This comment was marked as off-topic.

@MikeMcQuaid
Copy link
Member

after a

$ brew update

Please do not complain about things breaking before running brew update.

@mahmudzero
Copy link

after a

$ brew update

Please do not complain about things breaking before running brew update.

Thats a fair comment, that said, for some reason the install script (https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh), in certain environments, is installing an outdated version of brew - I will take a look into it.

Also wasn't really complaining and I closed my own comment as off topic ¯_(ツ)_/¯, really appreciate the work y'all do was just jarring this morning (I have a GitHub Action that installs brew each time, using the install script, and for some reason it's installing 4.2.14, instead of the latest version, and this was a change that happened over night but I see no updates to the install script in a few weeks so IDK what's going on there and not blaming anyone anyway)

@github-actions github-actions bot added the outdated PR was locked due to age label May 3, 2024
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 3, 2024
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.

brew CLI commands should be namespaced and implement an interface
4 participants