214 Commits

Author SHA1 Message Date
thibhero
99fad7797c modifying files with brew style 2025-03-06 21:27:13 -05:00
thibhero
f4d93e19b8 refactoring testball case to make it more readable 2025-03-06 20:59:56 -05:00
thibhero
e5e647d950 refactoring testball 2025-03-06 19:58:32 -05:00
thibhero
16599b6e05 tests for install_spec.rb 2025-03-06 19:34:46 -05:00
thibhero
885b7c6f4f checking other tests functions 2025-03-05 23:57:58 -05:00
thibhero
0b9374b7ac modifying integration_test.rb to work with other dependencies 2025-03-05 21:29:02 -05:00
Douglas Eichelberger
f5d2d30f5b Add test for concurrent fetching 2025-02-04 13:02:50 -08:00
Issy Long
6ada9a9665
Add clarifying comments to rubocop:disables
- Needed for PR 18842 that adds a `DisableComment` RuboCop to ensure that all RuboCop disables have comments.
2025-01-12 16:59:07 +00:00
Rui Chen
79ed2c6e61
chore: fix typos
Signed-off-by: Rui Chen <rui@chenrui.dev>
2024-12-28 15:53:35 -05:00
Mike McQuaid
4d4531c19d
Revamp installed_on_request handling
- `reinstall` and `upgrade` no longer mark as installed on request,
  with or without names specified, but preserve the version from the
  tab instead
- default `install_on_request` to `false` rather than `true`
- only set installed in request in a tab if it's missing rather than
  false

Co-authored-by: Michael Cho <michael@michaelcho.dev>
2024-11-19 08:39:55 +00:00
Douglas Eichelberger
ced4a3a91f Migrate Parlour extensions to Tapioca compilers 2024-10-14 19:50:09 -07:00
Mike McQuaid
f719090446
Add a bunch more UNDEFINED_CONSTANTS for startup.
This should avoid these getting included globally in future.

I found this list from a combination of
https://github.com/Homebrew/brew/pull/17707/files, looking at the
Gemfile and just looking around myself.
2024-08-16 12:33:26 +01:00
apainintheneck
f6a6979711 Verify more constants are not loaded at startup
Loading different constants can be tricky with all the requires in
Homebrew so we want to strengthen the existing checks to make
sure that things are not getting required when there is a performance
penalty. This expands the existing check to include more constants
beyond `Formula` that we don't expect to be defined and that pull
in a lot of other dependencies.
2024-08-14 19:08:31 -07:00
Mike McQuaid
02d414d79b
Merge pull request #18008 from Homebrew/deprecate-old-style-cmds 2024-08-14 07:45:13 +01:00
apainintheneck
a3e917afe1 Refactor method to remove extra tap requires
We were selectively requiring the tap.rb file in a few places for
performance reasons. The main method we were referencing was the
`Tap.cmd_directories` method which uses `Pathname` and the `TAP_DIRECTORY`
constant internally. `Tap.cmd_directories` is mostly used in the `Commands`
module and that is loaded very early on in the program so it made sense
to move that command to that module. To facilitate that I moved the
`TAP_DIRECTORY` constant to the top-level and renamed it to
`HOMEBREW_TAP_DIRECTORY`. It now lies in the tap_constants.rb file.

A nice bonus of this refactor is that it speeds up loading external
commands since the tap.rb file is no longer required by default in
those cases.
2024-08-10 13:49:10 -07:00
Douglas Eichelberger
cefae82307 Fix tests 2024-08-10 11:20:53 -07:00
Mike McQuaid
f39b5c1426
Merge pull request #17554 from Homebrew/cask-install-receipt 2024-07-13 10:55:06 -04:00
Bo Anderson
ae9d5f9f14
cli/named_args: raise priority of core casks 2024-07-12 05:27:57 +01:00
Rylan Polster
46cb7f2847
Update tests 2024-07-04 01:47:14 -04:00
Ruoyu Zhong
9cd5078efb
cmd/tab: new command
Add `brew tab`, a new command to edit tab information, as previously
discussed in https://github.com/Homebrew/brew/pull/17125#issuecomment-2068473483.
Currently, this supports marking or unmarking formulae as installed on
request.

Sample usage:

    $ brew tab --installed-on-request curl
    ==> curl is now marked as installed on request.
    $ brew autoremove --dry-run
    [no output]
    $ brew tab --no-installed-on-request curl
    ==> curl is now marked as not installed on request.
    $ brew autoremove --dry-run
    ==> Would autoremove 2 unneeded formulae:
    curl
    rtmpdump

Co-authored-by: Mike McQuaid <mike@mikemcquaid.com>
2024-06-13 11:44:14 +08:00
apainintheneck
56ecd42ebd dev-cmd/tests: skip tests that require core if it's not tapped
There were a few tests which require core to be tapped and fail
if it isn't. This is annoying if someone is trying to contribute
to the project and they're using the JSON API instead of having
the core repo tapped locally.

I'm just skipping these because it's the simplest thing to do.
The tests that failed are mostly rubocop tests so it's fine
if they only run on CI.
2024-05-03 00:32:50 -07:00
Douglas Eichelberger
c1a4a806e1 rm unused OutputAsTTY helper 2024-03-30 18:44:39 -07:00
apainintheneck
9ff0f85335 untap_spec: use builtin spec helpers to simplify tests 2024-03-12 22:07:14 -07:00
apainintheneck
11b67e04c2 untap: add tests for finding formulae/casks in each tap
These are regression tests to make sure that this logic is reproducible.
If this logic is not working, it might mean that someone removes a tap
accidentally that still includes a formula or cask that they currently
have installed.

The tests are extravagant and over-engineered but I'm not sure that
there's an easier way to do this without massive integration tests.
2024-03-10 22:33:44 -07:00
Mike McQuaid
ea2892f8ee
brew.rb: handle missing args. 2024-03-07 16:20:20 +00:00
Douglas Eichelberger
c2e48ec79c Extract find_files to helper 2024-02-19 08:28:12 -08:00
Douglas Eichelberger
ab8f5702ac
git grep -l '^shared_examples' | xargs gsed -i 's|^shared_examples|RSpec.shared_examples|g' 2024-02-19 13:57:28 +00:00
Markus Reiter
ad1d50e64a
Clear tap cache after setting up test formula. 2024-02-16 10:44:01 +01:00
Markus Reiter
27189f4aba
Fix stubbing casks in tests. 2024-02-13 18:44:00 +01:00
Douglas Eichelberger
12d32cc69e Manual fixes 2024-02-11 20:13:24 -08:00
Markus Reiter
d1fa91cd78
Clear tap caches after linking cask fixtures. 2024-02-09 23:37:11 +01:00
Markus Reiter
d9263196a2
Never link outdated cask fixtures. 2024-02-09 22:04:26 +01:00
Douglas Eichelberger
0852e1d7b6 Refactor away String#indent 2024-01-08 13:36:45 -08:00
Bo Anderson
89531e9ff3
Update all dependencies 2023-12-15 16:24:46 +00:00
Bo Anderson
fb21d59b5a
Improve coverage tracking 2023-11-11 05:36:40 +00:00
Bo Anderson
14c1dce38b
Allow HOMEBREW_RUBY3 in tests 2023-10-27 15:58:43 +01:00
Bo Anderson
af7d744af0
Fixes for Ruby 3 2023-09-29 05:25:48 +01:00
apainintheneck
5c41e85ae9 update cmd/uses and cmd/deps tests
These tests were very simple before and now this should result
in more code coverage without affecting test performance.

The only tricky thing was testing the `--missing` option without
actually installing a package using `install_test_formula` because
that is very slow (around 10 seconds on my machine). I ended
up just writing the tab to a plausible keg directory for each
package I wanted to "install". This allows us to test the behavior
while also not increasing CI time by ~20 seconds (though it'd
probably be faster on CI than my local machine).
2023-08-28 21:54:32 -07:00
Mike McQuaid
22553cd34a
Fix cask sharding issues
- Fix cask info output being incorrect
- Improve some code referring to casks as formulae
- Move livecheck cask fixtures to not shadow existing names
- Adjust the cask tap symlinking logic to make handling outdated
  shadowed casks significantly easier
- Fix various flaky tests caused by casks sharding logic
- Prefer longer paths when there's multiple formulae or casks in a tap
  with the same name rather than always using the first
2023-08-10 16:08:47 +01:00
Mike McQuaid
b3c33d34ab
Various sharding fixes
- Load paths with no API when needed (e.g. for `brew edit`)
- Use no API mode for `brew log` as it's needed there
- Define sharding format for homebrew-cask and homebrew-core inside
  `Tap` methods
- Create new formulae/casks in location defined by these `Tap` methods
- Fix a bug in Formulary that made sharded formulae lookup less
  efficient (and possibly broke it for core and some API usage)
- Fix various other hardcoded Formula/Cask directory assumptions

Co-authored-by: Bo Anderson <mail@boanderson.me>
2023-08-04 16:43:13 +01:00
Bo Anderson
ba02c669e1
Introduce CoreCaskTap class 2023-07-13 20:33:26 +01:00
Markus Reiter
486c3765ce
Add --os=all and --arch=all options. 2023-05-17 15:26:46 +02:00
Markus Reiter
a3231a03fa
Implement cask renames. 2023-05-12 21:17:30 +02:00
Ilya Kulakov
6a4322833f sudo: Fix tests. 2023-04-28 11:22:54 -07:00
Douglas Eichelberger
9075cbae62 brew style --fix 2023-04-21 09:58:50 -07:00
Douglas Eichelberger
ac1e6ded9a git grep -l '# typed: false' | xargs gsed -i 's|# typed: false||g' 2023-04-21 09:57:47 -07:00
Markus Reiter
3da305fa80
Add keyboard_layout stanza. 2023-03-26 08:14:24 +02:00
Issy Long
6a704f2f40
sorbet: Bump more files to typed: true
- This was done through the `brew typecheck --suggest-typed --update`
  command.
2023-03-05 18:18:59 +00:00
Mike McQuaid
c3294f9356
test: add instance variable comments. 2023-01-24 10:15:25 +00:00
Douglas Eichelberger
49ca993074 git grep -l rubocop:todo test/ | xargs gsed -i 's|rubocop:todo|rubocop:disable|g' 2023-01-23 11:51:12 -08:00