commit
54270e9214
@ -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
|
||||||
|
|||||||
@ -7,17 +7,17 @@ require "compat/hbc/dsl"
|
|||||||
|
|
||||||
module Hbc
|
module Hbc
|
||||||
class << self
|
class << self
|
||||||
prepend(
|
module Compat
|
||||||
Module.new do
|
def init
|
||||||
def init
|
Cache.delete_legacy_cache
|
||||||
Cache.delete_legacy_cache
|
|
||||||
|
|
||||||
Caskroom.migrate_caskroom_from_repo_to_prefix
|
Caskroom.migrate_caskroom_from_repo_to_prefix
|
||||||
Caskroom.migrate_legacy_caskroom
|
Caskroom.migrate_legacy_caskroom
|
||||||
|
|
||||||
super
|
super
|
||||||
end
|
end
|
||||||
end,
|
end
|
||||||
)
|
|
||||||
|
prepend Compat
|
||||||
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,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 Hbc
|
||||||
module CaskLoader
|
module CaskLoader
|
||||||
class FromContentLoader; end
|
class FromContentLoader; end
|
||||||
|
|
||||||
class FromPathLoader < FromContentLoader
|
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
|
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,22 +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
|
||||||
odeprecated "`brew cask update`", "`brew update`", disable_on: Time.utc(2017, 7, 1)
|
def self.run(*_ignored)
|
||||||
result = SystemCommand.run(HOMEBREW_BREW_FILE, args: ["update"],
|
odisabled "`brew cask update`", "`brew update`"
|
||||||
print_stderr: true,
|
end
|
||||||
print_stdout: true)
|
|
||||||
exit result.exit_status
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.visible
|
def self.visible
|
||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.help
|
|
||||||
"a synonym for 'brew update'"
|
|
||||||
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
|
||||||
class << self
|
class << self
|
||||||
def release
|
module Compat
|
||||||
odeprecated "MacOS.release", "MacOS.version"
|
def release
|
||||||
version
|
odeprecated "MacOS.release", "MacOS.version"
|
||||||
|
version
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
prepend Compat
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -74,8 +74,8 @@ describe Hbc::CLI, :cask do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it "provides a help message for all commands" do
|
it "provides a help message for all visible commands" do
|
||||||
described_class.command_classes.each do |command_class|
|
described_class.command_classes.select(&:visible).each do |command_class|
|
||||||
expect(command_class.help).to match(/\w+/), command_class.name
|
expect(command_class.help).to match(/\w+/), command_class.name
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user