Merge pull request #6794 from MikeMcQuaid/fix-cask-style

Fix `brew cask style`.
This commit is contained in:
Mike McQuaid 2019-12-01 15:19:18 +00:00 committed by GitHub
commit fcfa80a63a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 3 deletions

View File

@ -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.

View File

@ -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",

View File

@ -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 }