From ce15622584618802a229960d20199cd1655cf5fa Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 20 Apr 2019 23:56:55 +0200 Subject: [PATCH] Add `*_to_slashes` methods to `compat`. --- Library/Homebrew/cask/cmd/edit.rb | 2 +- Library/Homebrew/compat.rb | 1 + Library/Homebrew/compat/cask/dsl/version.rb | 24 +++++++++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 Library/Homebrew/compat/cask/dsl/version.rb diff --git a/Library/Homebrew/cask/cmd/edit.rb b/Library/Homebrew/cask/cmd/edit.rb index 549f889552..2687ce9214 100644 --- a/Library/Homebrew/cask/cmd/edit.rb +++ b/Library/Homebrew/cask/cmd/edit.rb @@ -17,7 +17,7 @@ module Cask def cask_path casks.first.sourcefile_path - rescue CaskInvalidError, CaskUnreadableError + rescue CaskInvalidError, CaskUnreadableError, MethodDeprecatedError path = CaskLoader.path(args.first) return path if path.file? diff --git a/Library/Homebrew/compat.rb b/Library/Homebrew/compat.rb index e69de29bb2..6d164787ce 100644 --- a/Library/Homebrew/compat.rb +++ b/Library/Homebrew/compat.rb @@ -0,0 +1 @@ +require "compat/cask/dsl/version" diff --git a/Library/Homebrew/compat/cask/dsl/version.rb b/Library/Homebrew/compat/cask/dsl/version.rb new file mode 100644 index 0000000000..107e628eab --- /dev/null +++ b/Library/Homebrew/compat/cask/dsl/version.rb @@ -0,0 +1,24 @@ +module Cask + class DSL + class Version < ::String + module Compat + def dots_to_slashes + odeprecated "#dots_to_slashes" + version { tr(".", "/") } + end + + def hyphens_to_slashes + odeprecated "#hyphens_to_slashes" + version { tr("-", "/") } + end + + def underscores_to_slashes + odeprecated "#underscores_to_slashes" + version { tr("_", "/") } + end + end + + prepend Compat + end + end +end