From ef34fbc634ffa6457f5ef043e39b3aedd31cd4cd Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 1 Dec 2019 14:19:26 +0000 Subject: [PATCH 1/3] cask/cmd/style: don't hide warnings. These sometimes display useful RuboCop deprecations. --- Library/Homebrew/cask/cmd/style.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Library/Homebrew/cask/cmd/style.rb b/Library/Homebrew/cask/cmd/style.rb index 6f7a368d57..06dfc45f82 100644 --- a/Library/Homebrew/cask/cmd/style.rb +++ b/Library/Homebrew/cask/cmd/style.rb @@ -13,7 +13,7 @@ module Cask Homebrew.install_bundler_gems! cache_env = { "XDG_CACHE_HOME" => "#{HOMEBREW_CACHE}/style" } - hide_warnings = debug ? [] : [ENV["HOMEBREW_RUBY_PATH"], "-W0", "-S"] + hide_warnings = debug ? [] : [ENV["HOMEBREW_RUBY_PATH"], "-S"] args = [ "--force-exclusion", From 2101de77cf4e629c1cffcf9a3fc6dad2fc379259 Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 1 Dec 2019 14:20:11 +0000 Subject: [PATCH 2/3] .rubocop_cask: fix RuboCop names. Broken since a RuboCop update. --- Library/.rubocop_cask.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Library/.rubocop_cask.yml b/Library/.rubocop_cask.yml index 938acb0afe..d779e664d4 100644 --- a/Library/.rubocop_cask.yml +++ b/Library/.rubocop_cask.yml @@ -26,10 +26,10 @@ Layout/HashAlignment: EnforcedHashRocketStyle: table EnforcedColonStyle: table -Layout/IndentFirstArrayElement: +Layout/FirstArrayElementIndentation: EnforcedStyle: align_brackets -Layout/IndentFirstHashElement: +Layout/FirstHashElementIndentation: EnforcedStyle: align_braces # Casks often contain long URLs and file paths. From c1b00297e0556197a21155a44876e3422e8f4b1e Mon Sep 17 00:00:00 2001 From: Mike McQuaid Date: Sun, 1 Dec 2019 15:04:30 +0000 Subject: [PATCH 3/3] cask/cmd/style_spec: add rubocop test. This verifies the cask configuration hasn't been broken. --- Library/Homebrew/test/cask/cmd/style_spec.rb | 30 ++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/Library/Homebrew/test/cask/cmd/style_spec.rb b/Library/Homebrew/test/cask/cmd/style_spec.rb index 447a465f58..5767740cb2 100644 --- a/Library/Homebrew/test/cask/cmd/style_spec.rb +++ b/Library/Homebrew/test/cask/cmd/style_spec.rb @@ -10,6 +10,36 @@ describe Cask::Cmd::Style, :cask do it_behaves_like "a command that handles invalid options" + describe ".rubocop" do + subject { described_class.rubocop(cask_path) } + + around do |example| + FileUtils.ln_s HOMEBREW_LIBRARY_PATH, HOMEBREW_LIBRARY/"Homebrew" + FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop_cask.yml", HOMEBREW_LIBRARY/".rubocop_cask.yml" + FileUtils.ln_s HOMEBREW_LIBRARY_PATH.parent/".rubocop_shared.yml", HOMEBREW_LIBRARY/".rubocop_shared.yml" + + example.run + ensure + FileUtils.rm_f HOMEBREW_LIBRARY/"Homebrew" + FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_cask.yml" + FileUtils.rm_f HOMEBREW_LIBRARY/".rubocop_shared.yml" + end + + before do + allow(Homebrew).to receive(:install_bundler_gems!) + end + + context "with a valid Cask" do + let(:cask_path) do + Pathname.new("#{HOMEBREW_LIBRARY}/Homebrew/test/support/fixtures/cask/Casks/version-latest.rb") + end + + it "returns true" do + expect(subject.success?).to be true + end + end + end + describe "#cask_paths" do subject { cli.cask_paths }