Class: Homebrew::TestBot::CleanupBefore Private
- Inherits:
-
TestCleanup
- Object
- Test
- TestCleanup
- Homebrew::TestBot::CleanupBefore
- Defined in:
- test_bot/cleanup_before.rb
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Instance Attribute Summary
Attributes inherited from Test
Instance Method Summary collapse
- #run!(args:) ⇒ Object private
Methods inherited from Test
Methods included from Utils::Output::Mixin
#odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #pretty_duration, #pretty_installed, #pretty_outdated, #pretty_uninstalled
Instance Method Details
#run!(args:) ⇒ Object
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'test_bot/cleanup_before.rb', line 7 def run!(args:) test_header(:CleanupBefore) if tap.to_s != CoreTap.instance.name && CoreTap.instance.installed? reset_if_needed(CoreTap.instance.path.to_s) end Pathname.glob("*.bottle*.*").each(&:unlink) if ENV["HOMEBREW_GITHUB_ACTIONS"] && !ENV["GITHUB_ACTIONS_HOMEBREW_SELF_HOSTED"] # minimally fix brew doctor failures (a full clean takes ~5m) # TODO: move to extend/os # rubocop:todo Homebrew/MoveToExtendOS if OS.linux? # brew doctor complains bad_paths = %w[ /usr/local/include/node/ /opt/pipx_bin/ansible-config ].map { |path| Pathname.new(path) } delete_or_move bad_paths, sudo: true elsif OS.mac? delete_or_move HOMEBREW_CELLAR.glob("*") frameworks_dir = Pathname("/Library/Frameworks") frameworks = %w[ Mono.framework PluginManager.framework Python.framework R.framework Xamarin.Android.framework Xamarin.Mac.framework Xamarin.iOS.framework ].map { |framework| frameworks_dir/framework } delete_or_move frameworks, sudo: true end test "brew", "cleanup", "--prune-prefix" end # rubocop:enable Homebrew/MoveToExtendOS # Keep all "brew" invocations after cleanup_shared # (which cleans up Homebrew/brew) cleanup_shared end |