82 Commits

Author SHA1 Message Date
Mike McQuaid
3381cbf5c7
Use Homebrew::EnvConfig. 2020-04-07 09:58:26 +01:00
Mike McQuaid
f59c596e4b
cleanup: fix portable ruby bundler removal logic.
Need to ensure portable rubies are removed last and pass more paramaters to
git clean.
2020-01-16 16:06:22 +00:00
Roger Hu
d27c5fb2cb Catalina upgrades causes Homebrew to break when you run brew cleanup. Catalina has Ruby 2.6 installed, so the portable Ruby version is not needed.
If you have /usr/local/Homebrew/Library/Homebrew/vendor/portable-ruby (for older OS X versions), then the cleanup tool will nuke everything in usr/local/Homebrew/Library/Homebrew/vendor/bundle/ruby. You will need to brew update-reset to get back the old packages.
2020-01-15 23:56:28 -08:00
Mike McQuaid
95a1c8570a
cleanup: rescue more cask errors.
This will avoid a wider degree of failures.
2019-11-06 15:25:29 +00:00
Issy Long
1f6168fe8a
Change regexp.match?(string) to string.match?(regexp) everywhere
- Only try to call `.match?` on strings that aren't nil.
2019-10-13 23:22:51 +01:00
Issy Long
b78028b9c2
Auto-fix Performance/RegexpMatch offenses 2019-10-13 16:04:26 +01:00
Mike McQuaid
ea0e7f6d62
cleanup: some speedup optimisations.
- avoid calling `rm_ds_store` multiple times when unnecessary
- use native Ruby method to remove `.DS_Store` files as it saves
  shelling out to `find` and is a bit quicker.
2019-09-19 08:42:03 +01:00
Mike McQuaid
c4f72312ce
Fixup brew style failures. 2019-04-30 09:19:18 +01:00
Mike McQuaid
36dbad3922
Add frozen_string_literal to all files. 2019-04-20 13:27:36 +09:00
Mike McQuaid
d1ea6f38d3
Fix mutable constants violations. 2019-04-19 21:46:20 +09:00
Mike McQuaid
640234caa1
Merge pull request #6030 from MikeMcQuaid/ruby-no-threads
Remove usage of Thread.new
2019-04-18 16:03:18 +09:00
Mike McQuaid
7fbfb02625
Remove usage of Thread.new
I benchmarked these both locally and neither use of `Thread.new`
provides any measurable speedup (and in the `readall` case appears to
slow things down) on my 8 core machine.
2019-04-18 14:46:40 +09:00
Mike McQuaid
0b272ad26e
cleanup: don’t cleanup periodic clean file.
Cleaning up this file means that cleanup will run again prematurely.
2019-04-17 21:06:47 +09:00
Chase Stubblefield
2c95d733c2 cleanup: fix for formula/cask name collision
When a formula and cask share the same name, a download can be
incorrectly considered stale. Only check for if a download is a stale
formula or stale cask, but not both.
2019-03-05 19:55:19 -08:00
Mike McQuaid
17f3ee1957
Improve Bundler cleanup
Rather than trying to be smart and doing this ourselves in `brew cleanup` let’s just installed Bundler somewhere it doesn’t try to clean itself up and use `bundle install --cleanup` when we need cleanup done.

Also, use `ohai` and `odie` when possible as they look nicer.
2019-02-27 14:02:46 +00:00
Mike McQuaid
1dd8b82c6b
cleanup: run bundle clean. 2019-02-21 16:34:20 +00:00
Mike McQuaid
e095da4d01
rubocop: enable Layout/EmptyLineAfterGuardClause. 2019-02-21 12:55:49 +00:00
Mike McQuaid
d64429a736
rubocop: enable Style/IfUnlessModifier. 2019-02-21 12:55:49 +00:00
Mike McQuaid
ede9891bf2
cleanup: don't remove portable ruby on periodic cleanups.
Otherwise we end up deleting the running Ruby version.

Fixes #5707.
2019-02-13 12:56:36 +00:00
tueksta
4abacfd85d
style 2019-02-06 23:19:25 +01:00
tueksta
9abd7d31bd
Fix dry run 2019-02-06 22:50:17 +01:00
tueksta
b9b1b24e4e
Calculate actual delta in usage 2019-02-06 18:25:46 +01:00
Mike McQuaid
6fe75fb154
cleanup: fix stale cask detection.
This method is also run to check formulae and if a formula and cask have
the same name (e.g. `cmake`) then this method would mark all formulae
downloads to being stale.

Instead, check the `dirname` (which we're using for globs anyway) to
double check that this is definitely a stale cask.
2019-02-03 15:32:30 +01:00
Mike McQuaid
d5adf87cf4
cleanup: better handle edge cases.
- don't complain about "skipping" kegs when `brew cleanup` runs
  automatically
- better handle orphaned directories
- output a better error message when a keg cannot be removed

Fixes #4989
Fixes #5627
Fixes https://github.com/Homebrew/homebrew-core/pull/35958#issuecomment-458031634
2019-01-28 16:08:23 +00:00
Mike McQuaid
eed1444d61
Update deprecations and cleanup
- Move `odeprecated` to `odisabled`
- Remove `odisabled`
- Enable automatic cleanup on install/reinstall/upgrade.
2019-01-23 21:57:40 +00:00
Mike McQuaid
79f3ff0a4e
cleanup: also consider ctime on prunes.
If this is an old tarball then we may end up removing it otherwise if
we've respected the `mtime` from the server on download.
2019-01-21 21:35:24 +00:00
Mike McQuaid
ea0fca9511
cleanup: make cache directory for clean file.
This means the `.cleaned` file is correctly created for periodic
cleanup handling.
2019-01-08 21:19:49 +00:00
Mike McQuaid
8144667a71
Cleanup periodically if HOMEBREW_INSTALL_CLEANUP is set.
This will become the default in a later version of Homebrew but has an
opt-out through HOMEBREW_NO_INSTALL_CLEANUP.

Also, always cleanup files older than 120 days and set the general
default value for "old" logs, casks etc. to 30 days.
2019-01-03 16:23:44 +00:00
Mike McQuaid
8cfcc7fcf0
cleanup: run and replace brew prune.
It's always seemed a bit pointless to me that we have both of these
commands. Given we're doing more and more to recommend (and eventually,
safely, automatically run (see #4760) `brew cleanup` let's roll their
functionality into a single command.
2019-01-02 13:21:34 +00:00
Mike McQuaid
737b84b54b
brew style --fix fixes. 2018-11-02 17:29:23 +00:00
Markus Reiter
1f24c6600c Fix cleanup of incomplete downloads. 2018-10-14 00:15:16 +02:00
Mike McQuaid
fe6b78a3f3
Use cache_store for descriptions
This makes use of both the existing interfaces and could use the
existing cache file but we'll create a new one and cleanup the old one
to avoid issues and use a more consistent name.
2018-10-13 08:22:52 -07:00
Markus Reiter
a9128c543c Use ActiveSupport’s #days. 2018-10-07 23:10:56 +02:00
Mike McQuaid
4475d1e0f5
cleanup: remove vendor/bundle/ruby.
Otherwise gem paths will contain references to a now-deleted Ruby.
2018-10-04 15:08:38 +01:00
Mike McQuaid
d2b5c704e1
cleanup: cleanup portable ruby, old linkage cache.
- Cleanup portable ruby if you haven't specifically requested it and
  you don't need it. This will be useful when e.g. upgrading OS versions
- Cleanup the old DBM linkage cache. These will not be used again.
2018-10-03 19:26:49 +01:00
Mike McQuaid
9a698d2130
keg: further tweak directory constants.
- ensure that `HOMEBREW_CELLAR` is always created on `install`.
- remove the need for a special `PRUNEABLE_DIRECTORIES` variable
- reuse values from existing variables and get `uniq`s.
2018-09-25 22:03:29 +01:00
Markus Reiter
e9b9ea49a1 Update to RuboCop 0.59.1. 2018-09-17 03:45:59 +02:00
Markus Reiter
769d89dead Resolve formulae in brew cleanup. 2018-09-11 17:44:39 +02:00
Mike McQuaid
7615d3a812
Improve writable directory handling
Consolidate the handling of which directories need to exist and which
need to be writable. Additionally, add a fatal check for formula
installations to ensure that any directories that need to be writable
are so before attempting an installation.

Fixes #4626.
2018-09-06 18:38:43 +01:00
Markus Reiter
a84a1c63db Rename Hbc module to Cask. 2018-09-06 09:30:52 +02:00
commitay
88bf60d589
Merge pull request #4815 from commitay/cargo-cache
rust/cargo: enable caching
2018-09-05 21:22:03 +10:00
Mike McQuaid
90b3a13909
cask: move cask/lib/hbc/* to cask/*.
Fix the load path, requires and some filenames accordingly.
2018-09-04 09:56:57 +01:00
commitay
11a6413fd0 cleanup: remove cargo_cache 2018-09-04 12:00:57 +10:00
Dominyk Tiller
9102c120bb
cleanup: fix go_cache cleanup 2018-09-02 04:27:22 +01:00
Markus Reiter
ae18bdf161 Skip mtime for non-existent symlink. 2018-09-01 06:42:54 +02:00
Markus Reiter
f287214699 Just use resolved_path.file?. 2018-08-31 16:51:23 +02:00
Markus Reiter
ccf396887a Add comment about refinement scope. 2018-08-31 16:51:23 +02:00
Markus Reiter
2773ce6156 Don’t clean up symlink target. 2018-08-31 16:51:23 +02:00
Markus Reiter
fbcaa8c85a Resolve URL to get real file extension. 2018-08-31 16:51:23 +02:00
Dominyk Tiller
318eb5054f
cleanup: cleanup go_cache 2018-08-29 13:16:55 +01:00