diff --git a/Library/Homebrew/compat/hbc.rb b/Library/Homebrew/compat/hbc.rb index 608d46e376..b64c3e4377 100644 --- a/Library/Homebrew/compat/hbc.rb +++ b/Library/Homebrew/compat/hbc.rb @@ -7,17 +7,17 @@ require "compat/hbc/dsl" module Hbc class << self - prepend( - Module.new do - def init - Cache.delete_legacy_cache + module Compat + def init + Cache.delete_legacy_cache - Caskroom.migrate_caskroom_from_repo_to_prefix - Caskroom.migrate_legacy_caskroom + Caskroom.migrate_caskroom_from_repo_to_prefix + Caskroom.migrate_legacy_caskroom - super - end - end, - ) + super + end + end + + prepend Compat end end diff --git a/Library/Homebrew/compat/hbc/cask_loader.rb b/Library/Homebrew/compat/hbc/cask_loader.rb index e57aea71dd..c62c001a2f 100644 --- a/Library/Homebrew/compat/hbc/cask_loader.rb +++ b/Library/Homebrew/compat/hbc/cask_loader.rb @@ -1,22 +1,22 @@ -module CaskLoaderCompatibilityLayer - private - - def cask(header_token, **options, &block) - if header_token.is_a?(Hash) && header_token.key?(:v1) - odeprecated %q("cask :v1 => 'token'"), %q("cask 'token'") - header_token = header_token[:v1] - end - - super(header_token, **options, &block) - end -end - module Hbc module CaskLoader class FromContentLoader; end class FromPathLoader < FromContentLoader - prepend CaskLoaderCompatibilityLayer + module Compat + private + + def cask(header_token, **options, &block) + if header_token.is_a?(Hash) && header_token.key?(:v1) + odeprecated %q("cask :v1 => 'token'"), %q("cask 'token'") + header_token = header_token[:v1] + end + + super(header_token, **options, &block) + end + end + + prepend Compat end end end diff --git a/Library/Homebrew/compat/hbc/cli/update.rb b/Library/Homebrew/compat/hbc/cli/update.rb index 95321e8981..f23b272ae7 100644 --- a/Library/Homebrew/compat/hbc/cli/update.rb +++ b/Library/Homebrew/compat/hbc/cli/update.rb @@ -4,20 +4,12 @@ module Hbc class CLI class Update < AbstractCommand def self.run(*_ignored) - odeprecated "`brew cask update`", "`brew update`", disable_on: Time.utc(2017, 7, 1) - result = SystemCommand.run(HOMEBREW_BREW_FILE, args: ["update"], - print_stderr: true, - print_stdout: true) - exit result.exit_status + odisabled "`brew cask update`", "`brew update`" end def self.visible false end - - def self.help - "a synonym for 'brew update'" - end end end end diff --git a/Library/Homebrew/compat/os/mac.rb b/Library/Homebrew/compat/os/mac.rb index 6806fe900a..5ea2634bfc 100644 --- a/Library/Homebrew/compat/os/mac.rb +++ b/Library/Homebrew/compat/os/mac.rb @@ -1,10 +1,10 @@ module OS module Mac - class << self - def release - odeprecated "MacOS.release", "MacOS.version" - version - end + module_function + + def release + odeprecated "MacOS.release", "MacOS.version" + version end end end diff --git a/Library/Homebrew/test/cask/cli_spec.rb b/Library/Homebrew/test/cask/cli_spec.rb index e88b24ba2a..495aedb088 100644 --- a/Library/Homebrew/test/cask/cli_spec.rb +++ b/Library/Homebrew/test/cask/cli_spec.rb @@ -74,8 +74,8 @@ describe Hbc::CLI, :cask do end end - it "provides a help message for all commands" do - described_class.command_classes.each do |command_class| + it "provides a help message for all visible commands" do + described_class.command_classes.select(&:visible).each do |command_class| expect(command_class.help).to match(/\w+/), command_class.name end end