From 0bb2773b171d8572bd7b73b38cc63ed2fa9b555a Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Tue, 23 May 2017 17:37:37 +0200 Subject: [PATCH 1/2] Deprecate `--caskroom` flag. --- Library/Homebrew/cask/lib/hbc/cli.rb | 1 - Library/Homebrew/compat/hbc.rb | 1 + Library/Homebrew/compat/hbc/cli.rb | 12 ++++++++++++ Library/Homebrew/manpages/brew-cask.1.md | 5 +---- Library/Homebrew/test/cask/cli_spec.rb | 7 ------- manpages/brew-cask.1 | 6 +----- 6 files changed, 15 insertions(+), 17 deletions(-) create mode 100644 Library/Homebrew/compat/hbc/cli.rb diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index 1c20a2a331c0d..f0cb5806f6666 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -49,7 +49,6 @@ class CLI include Options - option "--caskroom=PATH", ->(value) { Hbc.caskroom = value } option "--appdir=PATH", ->(value) { Hbc.appdir = value } option "--colorpickerdir=PATH", ->(value) { Hbc.colorpickerdir = value } option "--prefpanedir=PATH", ->(value) { Hbc.prefpanedir = value } diff --git a/Library/Homebrew/compat/hbc.rb b/Library/Homebrew/compat/hbc.rb index 353a72488e761..3ff8fccb7cd65 100644 --- a/Library/Homebrew/compat/hbc.rb +++ b/Library/Homebrew/compat/hbc.rb @@ -2,6 +2,7 @@ require "compat/hbc/cli/update" require "compat/hbc/cache" require "compat/hbc/caskroom" +require "compat/hbc/cli" module Hbc class << self diff --git a/Library/Homebrew/compat/hbc/cli.rb b/Library/Homebrew/compat/hbc/cli.rb new file mode 100644 index 0000000000000..d563e64cb3e10 --- /dev/null +++ b/Library/Homebrew/compat/hbc/cli.rb @@ -0,0 +1,12 @@ +require "cask/lib/hbc/cli/options" + +module Hbc + class CLI + include Options + + option "--caskroom=PATH", (lambda do |value| + Hbc.caskroom = value + odeprecated "`brew cask` with the `--caskroom` flag", disable_on: Time.utc(2017, 10, 31) + end) + end +end diff --git a/Library/Homebrew/manpages/brew-cask.1.md b/Library/Homebrew/manpages/brew-cask.1.md index 6b4e8bc87088d..bfb9cd7a5333a 100644 --- a/Library/Homebrew/manpages/brew-cask.1.md +++ b/Library/Homebrew/manpages/brew-cask.1.md @@ -160,9 +160,6 @@ in a future version. * `--require-sha`: Abort Cask installation if the Cask does not have a checksum defined. - * `--caskroom=`: - Set location of the Caskroom, where all binaries are stored. The default value is `$(brew --prefix)/Caskroom`. - * `--verbose`: Give additional feedback during installation. @@ -255,7 +252,7 @@ Environment variables specific to Homebrew-Cask: the command-line. This is particularly useful to make options persistent. For example, you might add to your .bash_profile or .zshenv something like: - export HOMEBREW_CASK_OPTS='--appdir=/Applications --caskroom=/etc/Caskroom' + export HOMEBREW_CASK_OPTS='--appdir=~/Applications --fontdir=/Library/Fonts' Other environment variables: diff --git a/Library/Homebrew/test/cask/cli_spec.rb b/Library/Homebrew/test/cask/cli_spec.rb index baad160c3214a..569b831de2118 100644 --- a/Library/Homebrew/test/cask/cli_spec.rb +++ b/Library/Homebrew/test/cask/cli_spec.rb @@ -54,13 +54,6 @@ described_class.run("noop") end - it "respects the env variable when choosing a non-default Caskroom location" do - allow(ENV).to receive(:[]) - allow(ENV).to receive(:[]).with("HOMEBREW_CASK_OPTS").and_return("--caskroom=/custom/caskdir") - expect(Hbc).to receive(:caskroom=).with(Pathname.new("/custom/caskdir")) - described_class.run("noop") - end - it "exits with a status of 1 when something goes wrong" do allow(described_class).to receive(:lookup_command).and_raise(Hbc::CaskError) command = Hbc::CLI.new("noop") diff --git a/manpages/brew-cask.1 b/manpages/brew-cask.1 index 353de66bf6676..e6066136e9708 100644 --- a/manpages/brew-cask.1 +++ b/manpages/brew-cask.1 @@ -161,10 +161,6 @@ Skip Cask dependencies when installing\. Abort Cask installation if the Cask does not have a checksum defined\. . .TP -\fB\-\-caskroom=\fR -Set location of the Caskroom, where all binaries are stored\. The default value is \fB$(brew \-\-prefix)/Caskroom\fR\. -. -.TP \fB\-\-verbose\fR Give additional feedback during installation\. . @@ -290,7 +286,7 @@ This variable may contain any arguments normally used as options on the command\ . .nf - export HOMEBREW_CASK_OPTS=\'\-\-appdir=/Applications \-\-caskroom=/etc/Caskroom\' + export HOMEBREW_CASK_OPTS=\'\-\-appdir=~/Applications \-\-fontdir=/Library/Fonts\' . .fi . From 68a513083ebbd6a91a0fbb27daff0401edf7f47a Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Wed, 24 May 2017 02:46:23 +0200 Subject: [PATCH 2/2] Also move `--binarydir` to `compat/*`. --- Library/Homebrew/cask/lib/hbc/cli.rb | 4 ---- Library/Homebrew/compat/hbc/cli.rb | 7 +++++++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/cli.rb b/Library/Homebrew/cask/lib/hbc/cli.rb index f0cb5806f6666..0eb21b0a7dcd9 100644 --- a/Library/Homebrew/cask/lib/hbc/cli.rb +++ b/Library/Homebrew/cask/lib/hbc/cli.rb @@ -62,10 +62,6 @@ class CLI option "--vst_plugindir=PATH", ->(value) { Hbc.vst_plugindir = value } option "--vst3_plugindir=PATH", ->(value) { Hbc.vst3_plugindir = value } option "--screen_saverdir=PATH", ->(value) { Hbc.screen_saverdir = value } - option "--binarydir=PATH", ->(*) { opoo(<<-EOS.undent) } - Option --binarydir is obsolete! - Homebrew-Cask now uses the same location as your Homebrew installation for executable links. - EOS option "--help", :help, false diff --git a/Library/Homebrew/compat/hbc/cli.rb b/Library/Homebrew/compat/hbc/cli.rb index d563e64cb3e10..0173bce9c4618 100644 --- a/Library/Homebrew/compat/hbc/cli.rb +++ b/Library/Homebrew/compat/hbc/cli.rb @@ -4,6 +4,13 @@ module Hbc class CLI include Options + option "--binarydir=PATH", (lambda do |*| + opoo <<-EOS.undent + Option --binarydir is obsolete! + Homebrew-Cask now uses the same location as your Homebrew installation for executable links. + EOS + end) + option "--caskroom=PATH", (lambda do |value| Hbc.caskroom = value odeprecated "`brew cask` with the `--caskroom` flag", disable_on: Time.utc(2017, 10, 31)