Use module Compat for everything.
This commit is contained in:
parent
a6d9d45ec3
commit
5b7831f06f
@ -1,9 +1,13 @@
|
|||||||
module SharedEnvExtension
|
module SharedEnvExtension
|
||||||
def j1
|
module Compat
|
||||||
odisabled "ENV.j1", "ENV.deparallelize"
|
def j1
|
||||||
|
odisabled "ENV.j1", "ENV.deparallelize"
|
||||||
|
end
|
||||||
|
|
||||||
|
def java_cache
|
||||||
|
odisabled "ENV.java_cache"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def java_cache
|
prepend Compat
|
||||||
odisabled "ENV.java_cache"
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,6 +1,10 @@
|
|||||||
module Dependable
|
module Dependable
|
||||||
def run?
|
module Compat
|
||||||
odeprecated "Dependable#run?"
|
def run?
|
||||||
tags.include? :run
|
odeprecated "Dependable#run?"
|
||||||
|
tags.include? :run
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
prepend Compat
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,19 +1,23 @@
|
|||||||
class String
|
class String
|
||||||
def undent
|
module Compat
|
||||||
odisabled "<<-EOS.undent", "<<~EOS"
|
def undent
|
||||||
self
|
odisabled "<<-EOS.undent", "<<~EOS"
|
||||||
end
|
self
|
||||||
alias unindent undent
|
end
|
||||||
|
alias unindent undent
|
||||||
|
|
||||||
# eg:
|
# eg:
|
||||||
# if foo then <<-EOS.undent_________________________________________________________72
|
# if foo then <<-EOS.undent_________________________________________________________72
|
||||||
# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
|
# Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
|
||||||
# eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
# eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
||||||
# minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
|
# minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip
|
||||||
# ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
# ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
||||||
# voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
|
# voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur
|
||||||
# sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
# sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt
|
||||||
# mollit anim id est laborum.
|
# mollit anim id est laborum.
|
||||||
# EOS
|
# EOS
|
||||||
alias undent_________________________________________________________72 undent
|
alias undent_________________________________________________________72 undent
|
||||||
|
end
|
||||||
|
|
||||||
|
prepend Compat
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,5 +1,9 @@
|
|||||||
class Formula
|
class Formula
|
||||||
def rake(*)
|
module Compat
|
||||||
odisabled "FileUtils#rake", "system \"rake\""
|
def rake(*)
|
||||||
|
odisabled "FileUtils#rake", "system \"rake\""
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
prepend Compat
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,24 +1,27 @@
|
|||||||
|
|
||||||
module Gpg
|
module Gpg
|
||||||
module_function
|
class << self
|
||||||
|
module Compat
|
||||||
|
def executable
|
||||||
|
odisabled "Gpg.executable", 'which "gpg"'
|
||||||
|
end
|
||||||
|
|
||||||
def executable
|
def available?
|
||||||
odisabled "Gpg.executable", 'which "gpg"'
|
odisabled "Gpg.available?", 'which "gpg"'
|
||||||
end
|
end
|
||||||
|
|
||||||
def available?
|
def create_test_key(*)
|
||||||
odisabled "Gpg.available?", 'which "gpg"'
|
odisabled "Gpg.create_test_key"
|
||||||
end
|
end
|
||||||
|
|
||||||
def create_test_key(_)
|
def cleanup_test_processes!
|
||||||
odisabled "Gpg.create_test_key"
|
odisabled "Gpg.cleanup_test_processes!"
|
||||||
end
|
end
|
||||||
|
|
||||||
def cleanup_test_processes!
|
def test(*)
|
||||||
odisabled "Gpg.cleanup_test_processes!"
|
odisabled "Gpg.test"
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def test(_)
|
prepend Compat
|
||||||
odisabled "Gpg.test"
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,13 +1,17 @@
|
|||||||
module Hbc
|
module Hbc
|
||||||
module Cache
|
module Cache
|
||||||
module_function
|
class << self
|
||||||
|
module Compat
|
||||||
|
def delete_legacy_cache
|
||||||
|
legacy_cache = HOMEBREW_CACHE.join("Casks")
|
||||||
|
return unless legacy_cache.exist?
|
||||||
|
|
||||||
def delete_legacy_cache
|
ohai "Deleting legacy cache at #{legacy_cache}"
|
||||||
legacy_cache = HOMEBREW_CACHE.join("Casks")
|
FileUtils.remove_entry_secure(legacy_cache)
|
||||||
return unless legacy_cache.exist?
|
end
|
||||||
|
end
|
||||||
|
|
||||||
ohai "Deleting legacy cache at #{legacy_cache}"
|
prepend Compat
|
||||||
FileUtils.remove_entry_secure(legacy_cache)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,45 +1,49 @@
|
|||||||
module Hbc
|
module Hbc
|
||||||
module Caskroom
|
module Caskroom
|
||||||
module_function
|
class << self
|
||||||
|
module Compat
|
||||||
|
def migrate_legacy_caskroom
|
||||||
|
return if Hbc.caskroom.exist?
|
||||||
|
|
||||||
def migrate_legacy_caskroom
|
legacy_caskroom = Pathname.new("/opt/homebrew-cask/Caskroom")
|
||||||
return if Hbc.caskroom.exist?
|
return if Hbc.caskroom == legacy_caskroom
|
||||||
|
return unless legacy_caskroom.exist?
|
||||||
|
return if legacy_caskroom.symlink?
|
||||||
|
|
||||||
legacy_caskroom = Pathname.new("/opt/homebrew-cask/Caskroom")
|
ohai "Migrating Caskroom from #{legacy_caskroom} to #{Hbc.caskroom}."
|
||||||
return if Hbc.caskroom == legacy_caskroom
|
if Hbc.caskroom.parent.writable?
|
||||||
return unless legacy_caskroom.exist?
|
FileUtils.mv legacy_caskroom, Hbc.caskroom
|
||||||
return if legacy_caskroom.symlink?
|
else
|
||||||
|
opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom."
|
||||||
|
SystemCommand.run("/bin/mv", args: [legacy_caskroom, Hbc.caskroom.parent], sudo: true)
|
||||||
|
end
|
||||||
|
|
||||||
ohai "Migrating Caskroom from #{legacy_caskroom} to #{Hbc.caskroom}."
|
ohai "Creating symlink from #{Hbc.caskroom} to #{legacy_caskroom}."
|
||||||
if Hbc.caskroom.parent.writable?
|
if legacy_caskroom.parent.writable?
|
||||||
FileUtils.mv legacy_caskroom, Hbc.caskroom
|
FileUtils.ln_s Hbc.caskroom, legacy_caskroom
|
||||||
else
|
else
|
||||||
opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom."
|
opoo "#{legacy_caskroom.parent} is not writable, sudo is needed to link the Caskroom."
|
||||||
SystemCommand.run("/bin/mv", args: [legacy_caskroom, Hbc.caskroom.parent], sudo: true)
|
SystemCommand.run("/bin/ln", args: ["-s", Hbc.caskroom, legacy_caskroom], sudo: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def migrate_caskroom_from_repo_to_prefix
|
||||||
|
repo_caskroom = HOMEBREW_REPOSITORY.join("Caskroom")
|
||||||
|
return if Hbc.caskroom.exist?
|
||||||
|
return unless repo_caskroom.directory?
|
||||||
|
|
||||||
|
ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX"
|
||||||
|
|
||||||
|
if Hbc.caskroom.parent.writable?
|
||||||
|
FileUtils.mv repo_caskroom, Hbc.caskroom
|
||||||
|
else
|
||||||
|
opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom."
|
||||||
|
SystemCommand.run("/bin/mv", args: [repo_caskroom, Hbc.caskroom.parent], sudo: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
ohai "Creating symlink from #{Hbc.caskroom} to #{legacy_caskroom}."
|
prepend Compat
|
||||||
if legacy_caskroom.parent.writable?
|
|
||||||
FileUtils.ln_s Hbc.caskroom, legacy_caskroom
|
|
||||||
else
|
|
||||||
opoo "#{legacy_caskroom.parent} is not writable, sudo is needed to link the Caskroom."
|
|
||||||
SystemCommand.run("/bin/ln", args: ["-s", Hbc.caskroom, legacy_caskroom], sudo: true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def migrate_caskroom_from_repo_to_prefix
|
|
||||||
repo_caskroom = HOMEBREW_REPOSITORY.join("Caskroom")
|
|
||||||
return if Hbc.caskroom.exist?
|
|
||||||
return unless repo_caskroom.directory?
|
|
||||||
|
|
||||||
ohai "Moving Caskroom from HOMEBREW_REPOSITORY to HOMEBREW_PREFIX"
|
|
||||||
|
|
||||||
if Hbc.caskroom.parent.writable?
|
|
||||||
FileUtils.mv repo_caskroom, Hbc.caskroom
|
|
||||||
else
|
|
||||||
opoo "#{Hbc.caskroom.parent} is not writable, sudo is needed to move the Caskroom."
|
|
||||||
SystemCommand.run("/bin/mv", args: [repo_caskroom, Hbc.caskroom.parent], sudo: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -2,14 +2,18 @@ require "cask/lib/hbc/cli/abstract_command"
|
|||||||
|
|
||||||
module Hbc
|
module Hbc
|
||||||
class CLI
|
class CLI
|
||||||
class Update < AbstractCommand
|
module Compat
|
||||||
def self.run(*_ignored)
|
class Update < AbstractCommand
|
||||||
odisabled "`brew cask update`", "`brew update`"
|
def self.run(*_ignored)
|
||||||
end
|
odisabled "`brew cask update`", "`brew update`"
|
||||||
|
end
|
||||||
|
|
||||||
def self.visible
|
def self.visible
|
||||||
false
|
false
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
prepend Compat
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,7 +1,11 @@
|
|||||||
module Hbc
|
module Hbc
|
||||||
class DSL
|
class DSL
|
||||||
def license(*)
|
module Compat
|
||||||
odeprecated "Hbc::DSL#license"
|
def license(*)
|
||||||
|
odeprecated "Hbc::DSL#license"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
prepend Compat
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,10 +1,14 @@
|
|||||||
module OS
|
module OS
|
||||||
module Mac
|
module Mac
|
||||||
module_function
|
class << self
|
||||||
|
module Compat
|
||||||
|
def release
|
||||||
|
odeprecated "MacOS.release", "MacOS.version"
|
||||||
|
version
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
def release
|
prepend Compat
|
||||||
odeprecated "MacOS.release", "MacOS.version"
|
|
||||||
version
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user