From e4bb09dd402ad4b8e3b98d16fec9cfef9646b393 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 3 Dec 2017 09:57:04 +0100 Subject: [PATCH 1/3] Remove unused writer methods for `Hbc.caskroom` and `Hbc.cache`. --- Library/Homebrew/cask/lib/hbc/locations.rb | 4 ---- Library/Homebrew/compat/hbc/cli.rb | 3 +-- .../test/support/helper/spec/shared_context/homebrew_cask.rb | 5 +++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb index e55bdf15dc..539f9c554d 100644 --- a/Library/Homebrew/cask/lib/hbc/locations.rb +++ b/Library/Homebrew/cask/lib/hbc/locations.rb @@ -7,14 +7,10 @@ module Hbc end module ClassMethods - attr_writer :caskroom - def caskroom @caskroom ||= HOMEBREW_PREFIX.join("Caskroom") end - attr_writer :cache - def cache @cache ||= HOMEBREW_CACHE.join("Cask") end diff --git a/Library/Homebrew/compat/hbc/cli.rb b/Library/Homebrew/compat/hbc/cli.rb index 60d298ed63..9215256290 100644 --- a/Library/Homebrew/compat/hbc/cli.rb +++ b/Library/Homebrew/compat/hbc/cli.rb @@ -12,8 +12,7 @@ module Hbc end) option "--caskroom=PATH", (lambda do |value| - Hbc.caskroom = value - odeprecated "`brew cask` with the `--caskroom` flag", disable_on: Time.utc(2017, 10, 31) + odisabled "`brew cask` with the `--caskroom` flag" end) end end diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb index fc83149d01..35aacc2632 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb @@ -8,8 +8,6 @@ require "test/support/helper/cask/never_sudo_system_command" HOMEBREW_CASK_DIRS = [ :appdir, - :caskroom, - :cache, :prefpanedir, :qlplugindir, :servicedir, @@ -20,6 +18,8 @@ RSpec.shared_context "Homebrew-Cask" do around(:each) do |example| third_party_tap = Tap.fetch("third-party", "tap") begin + [Hbc.caskroom, Hbc.cache].each(&:mkpath) + dirs = HOMEBREW_CASK_DIRS.map do |dir| Pathname.new(TEST_TMPDIR).join("cask-#{dir}").tap do |path| path.mkpath @@ -40,6 +40,7 @@ RSpec.shared_context "Homebrew-Cask" do example.run ensure FileUtils.rm_rf dirs + FileUtils.rm_rf Hbc.caskroom, Hbc.cache Hbc.default_tap.path.unlink FileUtils.rm_rf Hbc.default_tap.path.parent third_party_tap.path.unlink From a02ce4f8e9699053b363a7dcf593736accae36cb Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 3 Dec 2017 10:05:50 +0100 Subject: [PATCH 2/3] Also remove writer method for `Hbc.binarydir`. --- Library/Homebrew/cask/lib/hbc/locations.rb | 2 -- Library/Homebrew/test/cask/artifact/binary_spec.rb | 4 ---- .../test/support/helper/spec/shared_context/homebrew_cask.rb | 5 ++--- 3 files changed, 2 insertions(+), 9 deletions(-) diff --git a/Library/Homebrew/cask/lib/hbc/locations.rb b/Library/Homebrew/cask/lib/hbc/locations.rb index 539f9c554d..5c9a28f5d9 100644 --- a/Library/Homebrew/cask/lib/hbc/locations.rb +++ b/Library/Homebrew/cask/lib/hbc/locations.rb @@ -57,8 +57,6 @@ module Hbc @servicedir ||= Pathname.new("~/Library/Services").expand_path end - attr_writer :binarydir - def binarydir @binarydir ||= HOMEBREW_PREFIX.join("bin") end diff --git a/Library/Homebrew/test/cask/artifact/binary_spec.rb b/Library/Homebrew/test/cask/artifact/binary_spec.rb index 6a3f1da346..e9514d9ae6 100644 --- a/Library/Homebrew/test/cask/artifact/binary_spec.rb +++ b/Library/Homebrew/test/cask/artifact/binary_spec.rb @@ -7,10 +7,6 @@ describe Hbc::Artifact::Binary, :cask do let(:artifacts) { cask.artifacts.select { |a| a.is_a?(described_class) } } let(:expected_path) { Hbc.binarydir.join("binary") } - before(:each) do - Hbc.binarydir.mkpath - end - after(:each) do FileUtils.rm expected_path if expected_path.exist? end diff --git a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb index 35aacc2632..e1afc44bf4 100644 --- a/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb +++ b/Library/Homebrew/test/support/helper/spec/shared_context/homebrew_cask.rb @@ -11,14 +11,13 @@ HOMEBREW_CASK_DIRS = [ :prefpanedir, :qlplugindir, :servicedir, - :binarydir, ].freeze RSpec.shared_context "Homebrew-Cask" do around(:each) do |example| third_party_tap = Tap.fetch("third-party", "tap") begin - [Hbc.caskroom, Hbc.cache].each(&:mkpath) + [Hbc.binarydir, Hbc.caskroom, Hbc.cache].each(&:mkpath) dirs = HOMEBREW_CASK_DIRS.map do |dir| Pathname.new(TEST_TMPDIR).join("cask-#{dir}").tap do |path| @@ -40,7 +39,7 @@ RSpec.shared_context "Homebrew-Cask" do example.run ensure FileUtils.rm_rf dirs - FileUtils.rm_rf Hbc.caskroom, Hbc.cache + FileUtils.rm_rf [Hbc.binarydir, Hbc.caskroom, Hbc.cache] Hbc.default_tap.path.unlink FileUtils.rm_rf Hbc.default_tap.path.parent third_party_tap.path.unlink From 9d1573c0405ead882a38d2bb70cfd66f76c06ccf Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 3 Dec 2017 10:10:54 +0100 Subject: [PATCH 3/3] Fix unused variable. --- Library/Homebrew/compat/hbc/cli.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/compat/hbc/cli.rb b/Library/Homebrew/compat/hbc/cli.rb index 9215256290..fb17a1d050 100644 --- a/Library/Homebrew/compat/hbc/cli.rb +++ b/Library/Homebrew/compat/hbc/cli.rb @@ -11,7 +11,7 @@ module Hbc EOS end) - option "--caskroom=PATH", (lambda do |value| + option "--caskroom=PATH", (lambda do |*| odisabled "`brew cask` with the `--caskroom` flag" end) end