Merge pull request #4186 from reitermarkus/compat

Clean up `compat`.
This commit is contained in:
Markus Reiter 2018-05-18 18:52:07 +02:00 committed by GitHub
commit 54270e9214
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 159 additions and 128 deletions

View File

@ -1,4 +1,5 @@
module SharedEnvExtension
module Compat
def j1
odisabled "ENV.j1", "ENV.deparallelize"
end
@ -6,4 +7,7 @@ module SharedEnvExtension
def java_cache
odisabled "ENV.java_cache"
end
end
prepend Compat
end

View File

@ -1,6 +1,10 @@
module Dependable
module Compat
def run?
odeprecated "Dependable#run?"
tags.include? :run
end
end
prepend Compat
end

View File

@ -1,4 +1,5 @@
class String
module Compat
def undent
odisabled "<<-EOS.undent", "<<~EOS"
self
@ -16,4 +17,7 @@ class String
# mollit anim id est laborum.
# EOS
alias undent_________________________________________________________72 undent
end
prepend Compat
end

View File

@ -1,5 +1,9 @@
class Formula
module Compat
def rake(*)
odisabled "FileUtils#rake", "system \"rake\""
end
end
prepend Compat
end

View File

@ -1,7 +1,6 @@
module Gpg
module_function
class << self
module Compat
def executable
odisabled "Gpg.executable", 'which "gpg"'
end
@ -10,7 +9,7 @@ module Gpg
odisabled "Gpg.available?", 'which "gpg"'
end
def create_test_key(_)
def create_test_key(*)
odisabled "Gpg.create_test_key"
end
@ -18,7 +17,11 @@ module Gpg
odisabled "Gpg.cleanup_test_processes!"
end
def test(_)
def test(*)
odisabled "Gpg.test"
end
end
prepend Compat
end
end

View File

@ -7,8 +7,7 @@ require "compat/hbc/dsl"
module Hbc
class << self
prepend(
Module.new do
module Compat
def init
Cache.delete_legacy_cache
@ -17,7 +16,8 @@ module Hbc
super
end
end,
)
end
prepend Compat
end
end

View File

@ -1,7 +1,7 @@
module Hbc
module Cache
module_function
class << self
module Compat
def delete_legacy_cache
legacy_cache = HOMEBREW_CACHE.join("Casks")
return unless legacy_cache.exist?
@ -10,4 +10,8 @@ module Hbc
FileUtils.remove_entry_secure(legacy_cache)
end
end
prepend Compat
end
end
end

View File

@ -1,4 +1,9 @@
module CaskLoaderCompatibilityLayer
module Hbc
module CaskLoader
class FromContentLoader; end
class FromPathLoader < FromContentLoader
module Compat
private
def cask(header_token, **options, &block)
@ -9,14 +14,9 @@ module CaskLoaderCompatibilityLayer
super(header_token, **options, &block)
end
end
end
module Hbc
module CaskLoader
class FromContentLoader; end
class FromPathLoader < FromContentLoader
prepend CaskLoaderCompatibilityLayer
prepend Compat
end
end
end

View File

@ -1,7 +1,7 @@
module Hbc
module Caskroom
module_function
class << self
module Compat
def migrate_legacy_caskroom
return if Hbc.caskroom.exist?
@ -42,4 +42,8 @@ module Hbc
end
end
end
prepend Compat
end
end
end

View File

@ -2,22 +2,18 @@ require "cask/lib/hbc/cli/abstract_command"
module Hbc
class CLI
module Compat
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
end
end
def self.help
"a synonym for 'brew update'"
end
end
prepend Compat
end
end

View File

@ -1,7 +1,11 @@
module Hbc
class DSL
module Compat
def license(*)
odeprecated "Hbc::DSL#license"
end
end
prepend Compat
end
end

View File

@ -1,10 +1,14 @@
module OS
module Mac
class << self
module Compat
def release
odeprecated "MacOS.release", "MacOS.version"
version
end
end
prepend Compat
end
end
end

View File

@ -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