Merge branch 'master' into cask_source_tweaks

This commit is contained in:
Mike McQuaid 2023-01-31 10:50:34 +00:00 committed by GitHub
commit 90b154fdb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
47 changed files with 320 additions and 248 deletions

View File

@ -13,9 +13,6 @@ jobs:
linting:
if: github.repository == 'Homebrew/brew'
runs-on: ubuntu-22.04
defaults:
run:
working-directory: docs
steps:
- name: Set up Homebrew
id: set-up-homebrew
@ -25,6 +22,7 @@ jobs:
run: brew install vale
- name: Run vale for docs linting
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
run: vale .
- name: Install Ruby
@ -32,12 +30,14 @@ jobs:
with:
ruby-version: "2.7"
bundler-cache: true
working-directory: docs
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
- name: Check Markdown syntax
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
run: bundle exec rake lint
- name: Build docs site
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/docs
run: bundle exec rake build
rubydoc:
@ -63,5 +63,5 @@ jobs:
bundler-cache: true
- name: Process rubydoc comments
working-directory: Library/Homebrew
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}/Library/Homebrew
run: bundle exec yard doc --plugin sorbet --no-output --fail-on-warning

View File

@ -37,6 +37,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: |
git fetch origin
@ -46,15 +47,15 @@ jobs:
if git ls-remote --exit-code --heads origin "${BRANCH}"
then
git checkout "${BRANCH}"
git checkout "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
git checkout "Library/Homebrew/sorbet"
else
git checkout --no-track -B "${BRANCH}" origin/master
fi
brew typecheck --update
if ! git diff --stat --exit-code "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
if ! git diff --stat --exit-code "Library/Homebrew/sorbet"
then
git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
git add "Library/Homebrew/sorbet"
git commit -m "sorbet: Update RBI files." \
-m "Autogenerated by the [sorbet](https://github.com/Homebrew/brew/blob/master/.github/workflows/sorbet.yml) workflow."
echo "committed=true" >> $GITHUB_OUTPUT
@ -70,6 +71,7 @@ jobs:
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ steps.update.outputs.branch }}
force: true
origin_branch: "master"
@ -79,3 +81,4 @@ jobs:
run: hub pull-request --no-edit
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}

View File

@ -36,6 +36,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: |
git fetch origin
@ -45,14 +46,14 @@ jobs:
if git ls-remote --exit-code --heads origin "${BRANCH}"
then
git checkout "${BRANCH}"
git checkout "${GITHUB_WORKSPACE}/Library/Homebrew/data/spdx"
git checkout "Library/Homebrew/data/spdx"
else
git checkout --no-track -B "${BRANCH}" origin/master
fi
if brew update-license-data
then
git add "${GITHUB_WORKSPACE}/Library/Homebrew/data/spdx"
git add "Library/Homebrew/data/spdx"
git commit -m "spdx: update license data." -m "Autogenerated by [a scheduled GitHub Action](https://github.com/Homebrew/brew/blob/master/.github/workflows/spdx.yml)."
echo "committed=true" >> $GITHUB_OUTPUT
PULL_REQUEST_STATE="$(gh pr view --json=state | jq -r ".state")"
@ -67,6 +68,7 @@ jobs:
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ steps.update.outputs.branch }}
force: true
origin_branch: "master"
@ -76,3 +78,4 @@ jobs:
run: hub pull-request --no-edit
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}

View File

@ -61,17 +61,17 @@ jobs:
if git ls-remote --exit-code --heads origin "${BRANCH}"
then
git checkout "${BRANCH}"
git checkout "${GITHUB_WORKSPACE}/README.md" \
"${GITHUB_WORKSPACE}/docs/Manpage.md" \
"${GITHUB_WORKSPACE}/manpages/brew.1" \
"${GITHUB_WORKSPACE}/completions"
git checkout "README.md" \
"docs/Manpage.md" \
"manpages/brew.1" \
"completions"
else
git checkout --no-track -B "${BRANCH}" origin/master
fi
if brew update-sponsors
then
git add "${GITHUB_WORKSPACE}/README.md"
git add "README.md"
git commit -m "Update sponsors." \
-m "Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow."
COMMITTED=true
@ -79,9 +79,9 @@ jobs:
if brew update-maintainers
then
git add "${GITHUB_WORKSPACE}/README.md" \
"${GITHUB_WORKSPACE}/docs/Manpage.md" \
"${GITHUB_WORKSPACE}/manpages/brew.1"
git add "README.md" \
"docs/Manpage.md" \
"manpages/brew.1"
git commit -m "Update maintainers." \
-m "Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow."
COMMITTED=true
@ -89,10 +89,10 @@ jobs:
if brew generate-man-completions
then
git add "${GITHUB_WORKSPACE}/README.md" \
"${GITHUB_WORKSPACE}/docs/Manpage.md" \
"${GITHUB_WORKSPACE}/manpages/brew.1" \
"${GITHUB_WORKSPACE}/completions"
git add "README.md" \
"docs/Manpage.md" \
"manpages/brew.1" \
"completions"
git commit -m "Update manpage and completions." \
-m "Autogenerated by the [sponsors-maintainers-man-completions](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/sponsors-maintainers-man-completions.yml) workflow."
COMMITTED=true
@ -111,12 +111,14 @@ jobs:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_BREW_UPDATE_SPONSORS_MAINTAINERS_TOKEN }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
- name: Push commits
if: steps.update.outputs.committed == 'true'
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ steps.update.outputs.branch }}
force: true
origin_branch: "master"
@ -126,3 +128,4 @@ jobs:
run: hub pull-request --no-edit
env:
GITHUB_TOKEN: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}

View File

@ -148,6 +148,7 @@ jobs:
run: brew install-bundler-gems --groups=sorbet
- name: Check for uncommitted RubyGems
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: git diff --stat --exit-code Library/Homebrew/vendor/bundle/ruby
docker:
@ -159,6 +160,7 @@ jobs:
uses: Homebrew/actions/setup-homebrew@master
- name: Build Docker image
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: |
docker build -t brew --build-arg=version=22.04 \
--label org.opencontainers.image.created="$(date --rfc-3339=seconds --utc)" \
@ -183,6 +185,7 @@ jobs:
docker push "homebrew/ubuntu22.04:master"
- name: Build deprecated 16.04 Docker image
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: |
echo "homebrew/ubuntu16.04:master is deprecated and will soon be retired. Use homebrew/ubuntu22.04:master or homebrew/ubuntu16.04 or homebrew/brew. For CI, homebrew/ubuntu22.04:master is recommended." > .docker-deprecate
docker build -t brew-deprecated --build-arg=version=16.04 \
@ -262,6 +265,7 @@ jobs:
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
with:
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
files: Library/Homebrew/test/coverage/coverage.xml
test-default-formula-linux:
@ -310,6 +314,7 @@ jobs:
run: brew install-bundler-gems --groups=sorbet
- name: Check for uncommitted RubyGems
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: git diff --stat --exit-code Library/Homebrew/vendor/bundle/ruby
- run: brew doctor
@ -373,4 +378,5 @@ jobs:
- uses: codecov/codecov-action@d9f34f8cd5cb3b3eb79b3e4b5dae3a16df499a70
with:
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
files: Library/Homebrew/test/coverage/coverage.xml

View File

@ -49,6 +49,7 @@ jobs:
echo "gem_name=${gem_name}" >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
- name: Vendor Gems
env:
@ -59,11 +60,12 @@ jobs:
env:
GEM_NAME: ${{ steps.checkout.outputs.gem_name }}
HOMEBREW_GPG_PASSPHRASE: ${{ secrets.BREWTESTBOT_GPG_SIGNING_SUBKEY_PASSPHRASE }}
working-directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
run: |
brew typecheck --update
if ! git diff --stat --exit-code "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
if ! git diff --stat --exit-code "Library/Homebrew/sorbet"
then
git add "${GITHUB_WORKSPACE}/Library/Homebrew/sorbet"
git add "Library/Homebrew/sorbet"
git commit -m "Update RBI files for ${GEM_NAME}." \
-m "Autogenerated by the [vendor-gems](https://github.com/Homebrew/brew/blob/HEAD/.github/workflows/vendor-gems.yml) workflow."
fi
@ -72,5 +74,6 @@ jobs:
uses: Homebrew/actions/git-try-push@master
with:
token: ${{ secrets.HOMEBREW_GITHUB_PUBLIC_REPO_TOKEN }}
directory: ${{ steps.set-up-homebrew.outputs.repository-path }}
branch: ${{ steps.checkout.outputs.branch }}
force: true

View File

@ -11,8 +11,6 @@ RSpec/SubjectStub:
# TODO: try to enable these
RSpec/DescribeClass:
Enabled: false
RSpec/LeakyConstantDeclaration:
Enabled: false
RSpec/MessageSpies:
Enabled: false
RSpec/StubbedMock:

View File

@ -1,6 +1,5 @@
inherit_from:
- ../.rubocop_rspec.yml
- .rubocop_todo.yml
Homebrew/MoveToExtendOS:
Enabled: true
@ -20,9 +19,9 @@ Lint/NestedMethodDefinition:
# TODO: Try to bring down all metrics maximums.
Metrics/AbcSize:
Max: 280
Max: 241
Metrics/BlockLength:
Max: 106
Max: 86
Exclude:
# TODO: extract more of the bottling logic
- "dev-cmd/bottle.rb"
@ -31,18 +30,18 @@ Metrics/BlockLength:
Metrics/BlockNesting:
Max: 5
Metrics/ClassLength:
Max: 800
Max: 736
Exclude:
- "formula.rb"
- "formula_installer.rb"
Metrics/CyclomaticComplexity:
Max: 80
Max: 68
Metrics/PerceivedComplexity:
Max: 90
Max: 84
Metrics/MethodLength:
Max: 260
Max: 232
Metrics/ModuleLength:
Max: 500
Max: 463
Exclude:
# TODO: extract more of the bottling logic
- "dev-cmd/bottle.rb"
@ -57,6 +56,28 @@ Naming/PredicateName:
- is_32_bit?
- is_64_bit?
Style/Documentation:
AllowedConstants:
- Homebrew
Exclude:
- "extend/**/*.rb"
- "test/**/*.rb"
- "cask/macos.rb"
- "cli/args.rb"
- "cli/parser.rb"
- "cmd/list.rb"
- "cmd/update-report.rb"
- "dev-cmd/irb.rb"
- "dev-cmd/pr-pull.rb"
- "keg_relocate.rb"
- "os/mac/keg.rb"
- "software_spec.rb"
- "utils.rb"
- "utils/fork.rb"
- "utils/git_repository.rb"
- "utils/popen.rb"
- "utils/shell.rb"
Style/HashAsLastArrayItem:
Exclude:
- "test/utils/spdx_spec.rb"

View File

@ -1,35 +0,0 @@
Style/Documentation:
Exclude:
- "compat/**/*.rb"
- "extend/**/*.rb"
- "cmd/**/*.rb"
- "dev-cmd/**/*.rb"
- "test/**/*.rb"
- "cask/macos.rb"
- "cli/args.rb"
- "cli/parser.rb"
- "default_prefix.rb"
- "global.rb"
- "keg_relocate.rb"
- "os/mac/keg.rb"
- "reinstall.rb"
- "software_spec.rb"
- "upgrade.rb"
- "utils.rb"
- "utils/fork.rb"
- "utils/gems.rb"
- "utils/git_repository.rb"
- "utils/popen.rb"
- "utils/shell.rb"
- "version.rb"
Lint/EmptyBlock:
Exclude:
- "dev-cmd/extract.rb"
- "test/cache_store_spec.rb"
- "test/checksum_verification_spec.rb"
- "test/compiler_failure_spec.rb"
- "test/formula_spec.rb"
- "test/formula_validation_spec.rb"
- "test/pathname_spec.rb"
- "test/support/fixtures/cask/Casks/*flight*.rb"

View File

@ -11,7 +11,7 @@ GEM
public_suffix (>= 2.0.2, < 6.0)
ast (2.4.2)
bindata (2.4.14)
bootsnap (1.15.0)
bootsnap (1.16.0)
msgpack (~> 1.2)
byebug (11.1.3)
coderay (1.1.3)

View File

@ -247,6 +247,7 @@ module Cask
"container" => container&.pairs,
"auto_updates" => auto_updates,
"tap_git_head" => tap&.git_head,
"languages" => languages,
}
end

View File

@ -298,9 +298,10 @@ module Homebrew
def parse(argv = ARGV.freeze, ignore_invalid_options: false)
raise "Arguments were already parsed!" if @args_parsed
# If we accept formula options, parse once allowing invalid options
# so we can get the remaining list containing formula names.
if @formula_options
# If we accept formula options, but the command isn't scoped only
# to casks, parse once allowing invalid options so we can get the
# remaining list containing formula names.
if @formula_options && !only_casks?(argv)
remaining, non_options = parse_remaining(argv, ignore_invalid_options: true)
argv = [*remaining, "--", *non_options]
@ -639,6 +640,10 @@ module Homebrew
end
end.compact.uniq(&:name)
end
def only_casks?(argv)
argv.include?("--casks") || argv.include?("--cask")
end
end
class OptionConstraintError < UsageError

View File

@ -10,22 +10,30 @@ require "tap"
def with_monkey_patch
BottleSpecification.class_eval do
alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
define_method(:method_missing) { |*| }
define_method(:method_missing) do |*|
# do nothing
end
end
Module.class_eval do
alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
define_method(:method_missing) { |*| }
define_method(:method_missing) do |*|
# do nothing
end
end
Resource.class_eval do
alias_method :old_method_missing, :method_missing if method_defined?(:method_missing)
define_method(:method_missing) { |*| }
define_method(:method_missing) do |*|
# do nothing
end
end
DependencyCollector.class_eval do
alias_method :old_parse_symbol_spec, :parse_symbol_spec if method_defined?(:parse_symbol_spec)
define_method(:parse_symbol_spec) { |*| }
define_method(:parse_symbol_spec) do |*|
# do nothing
end
end
yield

View File

@ -285,8 +285,7 @@ module Homebrew
boolean: true,
},
HOMEBREW_NO_EMOJI: {
description: "If set, do not print `HOMEBREW_INSTALL_BADGE` on a successful build." \
"\n\n *Note:* Will only try to print emoji on OS X Lion or newer.",
description: "If set, do not print `HOMEBREW_INSTALL_BADGE` on a successful build.",
boolean: true,
},
HOMEBREW_NO_ENV_HINTS: {

View File

@ -1,12 +0,0 @@
# typed: strict
# frozen_string_literal: true
# Utility method extensions for String.
class String
extend T::Sig
sig { returns(String) }
def undent
gsub(/^.{#{(slice(/^ +/) || '').length}}/, "")
end
end

View File

@ -8,7 +8,6 @@ require_relative "cask/constants/stanza"
require_relative "cask/ast/stanza"
require_relative "cask/ast/cask_header"
require_relative "cask/ast/cask_block"
require_relative "cask/extend/string"
require_relative "cask/extend/node"
require_relative "cask/mixin/cask_help"
require_relative "cask/mixin/on_homepage_stanza"

View File

@ -4382,11 +4382,6 @@ class Hash
def deep_transform_values!(&block); end
end
module Homebrew
MAX_PORT = ::T.let(nil, ::T.untyped)
MIN_PORT = ::T.let(nil, ::T.untyped)
end
module Homebrew::API::Analytics
extend ::T::Private::Methods::SingletonMethodHooks
end
@ -5461,9 +5456,6 @@ class Object
def to_yaml(options=T.unsafe(nil)); end
APPLE_GEM_HOME = ::T.let(nil, ::T.untyped)
APPLY_A = ::T.let(nil, ::T.untyped)
APPLY_B = ::T.let(nil, ::T.untyped)
APPLY_C = ::T.let(nil, ::T.untyped)
ARGF = ::T.let(nil, ::T.untyped)
ARGV = ::T.let(nil, ::T.untyped)
BUG_REPORTS_URL = ::T.let(nil, ::T.untyped)
@ -5529,12 +5521,8 @@ class Object
OPTION_DESC_WIDTH = ::T.let(nil, ::T.untyped)
ORIGINAL_PATHS = ::T.let(nil, ::T.untyped)
OS_VERSION = ::T.let(nil, ::T.untyped)
PATCH_A_CONTENTS = ::T.let(nil, ::T.untyped)
PATCH_A_SHA256 = ::T.let(nil, ::T.untyped)
PATCH_B_CONTENTS = ::T.let(nil, ::T.untyped)
PATCH_B_SHA256 = ::T.let(nil, ::T.untyped)
PATCH_URL_A = ::T.let(nil, ::T.untyped)
PATCH_URL_B = ::T.let(nil, ::T.untyped)
RUBY18 = ::T.let(nil, ::T.untyped)
RUBY19 = ::T.let(nil, ::T.untyped)
RUBY_BIN = ::T.let(nil, ::T.untyped)
@ -5557,9 +5545,7 @@ class Object
TARGET_DOC_PATH = ::T.let(nil, ::T.untyped)
TARGET_MAN_PATH = ::T.let(nil, ::T.untyped)
TESTBALL_PATCHES_SHA256 = ::T.let(nil, ::T.untyped)
TESTBALL_PATCHES_URL = ::T.let(nil, ::T.untyped)
TESTBALL_SHA256 = ::T.let(nil, ::T.untyped)
TESTBALL_URL = ::T.let(nil, ::T.untyped)
TEST_DIRECTORIES = ::T.let(nil, ::T.untyped)
TEST_FIXTURE_DIR = ::T.let(nil, ::T.untyped)
TEST_SHA1 = ::T.let(nil, ::T.untyped)

View File

@ -13,7 +13,9 @@ describe CacheStoreDatabase do
cache_store = instance_double(described_class, "cache_store", write_if_dirty!: nil)
expect(described_class).to receive(:new).with(type).and_return(cache_store)
expect(cache_store).to receive(:write_if_dirty!)
described_class.use(type) { |_db| }
described_class.use(type) { |_db|
# do nothing
}
end
end

View File

@ -84,7 +84,10 @@ describe Cask::Cmd::List, :cask do
end
describe "lists json" do
let(:casks) { ["local-caffeine", "local-transmission", "multiple-versions", "third-party/tap/third-party-cask"] }
let(:casks) {
["local-caffeine", "local-transmission", "multiple-versions", "with-languages",
"third-party/tap/third-party-cask"]
}
let(:expected_output) {
<<~EOS
[
@ -124,7 +127,10 @@ describe Cask::Cmd::List, :cask do
},
"conflicts_with": null,
"container": null,
"auto_updates": null
"auto_updates": null,
"languages": [
]
},
{
"token": "local-transmission",
@ -155,7 +161,10 @@ describe Cask::Cmd::List, :cask do
},
"conflicts_with": null,
"container": null,
"auto_updates": null
"auto_updates": null,
"languages": [
]
},
{
"token": "multiple-versions",
@ -189,7 +198,10 @@ describe Cask::Cmd::List, :cask do
},
"conflicts_with": null,
"container": null,
"auto_updates": null
"auto_updates": null,
"languages": [
]
},
{
"token": "third-party-cask",
@ -220,7 +232,45 @@ describe Cask::Cmd::List, :cask do
},
"conflicts_with": null,
"container": null,
"auto_updates": null
"auto_updates": null,
"languages": [
]
},
{
"token": "with-languages",
"full_token": "with-languages",
"tap": "homebrew/cask",
"name": [
],
"desc": null,
"homepage": "https://brew.sh/",
"url": "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip",
"appcast": null,
"version": "1.2.3",
"versions": {
},
"installed": "1.2.3",
"outdated": false,
"sha256": "xyz789",
"artifacts": [
{
"app": [
"Caffeine.app"
]
}
],
"caveats": null,
"depends_on": {
},
"conflicts_with": null,
"container": null,
"auto_updates": null,
"languages": [
"zh",
"en-US"
]
}
]
EOS
@ -257,7 +307,7 @@ describe Cask::Cmd::List, :cask do
it "of given Casks" do
expect {
described_class.run("--json", "local-caffeine", "local-transmission", "multiple-versions",
"third-party/tap/third-party-cask")
"third-party/tap/third-party-cask", "with-languages")
}.to output(expected_output).to_stdout
end
end

View File

@ -18,7 +18,9 @@ describe Formula do
sha256 TESTBALL_SHA256
end
f.brew {}
f.brew {
# do nothing
}
}.not_to raise_error
end
@ -28,7 +30,9 @@ describe Formula do
sha256 "dcbf5f44743b74add648c7e35e414076632fa3b24463d68d1f6afc5be77024f8"
end
f.brew {}
f.brew {
# do nothing
}
}.to raise_error(ChecksumMismatchError)
end
end

View File

@ -22,7 +22,9 @@ describe CompilerFailure do
end
it "can be given an empty block" do
failure = described_class.create(:clang) {}
failure = described_class.create(:clang) {
# do nothing
}
expect(failure).to fail_with(
instance_double(CompilerSelector::Compiler, "Compiler", type: :clang, name: :clang, version: 600),
)

View File

@ -89,9 +89,12 @@ describe "Exception" do
let(:mod) do
Module.new do
# These are defined within an anonymous module to avoid polluting the global namespace.
# rubocop:disable RSpec/LeakyConstantDeclaration
class Bar < Requirement; end
class Baz < Formula; end
# rubocop:enable RSpec/LeakyConstantDeclaration
end
end

View File

@ -9,16 +9,15 @@ module Homebrew
include described_class
describe "#free_port" do
# IANA suggests user port from 1024 to 49151
# and dynamic port for 49152 to 65535
# http://www.iana.org/assignments/port-numbers
MIN_PORT = 1024
MAX_PORT = 65535
it "returns a free TCP/IP port" do
# IANA suggests user port from 1024 to 49151
# and dynamic port for 49152 to 65535
# http://www.iana.org/assignments/port-numbers
min_port = 1024
max_port = 65535
port = free_port
expect(port).to be_between(MIN_PORT, MAX_PORT)
expect(port).to be_between(min_port, max_port)
expect { TCPServer.new(port).close }.not_to raise_error
end
end

View File

@ -872,7 +872,11 @@ describe Formula do
end
expect(Set.new(f2.recursive_requirements)).to eq(Set[])
expect(Set.new(f2.recursive_requirements {})).to eq(Set[xcode])
expect(
f2.recursive_requirements {
# do nothing
}.to_set,
).to eq(Set[xcode])
requirements = f2.recursive_requirements do |_dependent, requirement|
Requirement.prune if requirement.is_a?(XcodeRequirement)

View File

@ -80,7 +80,11 @@ describe Formula do
end
it "fails when Formula is empty" do
expect { formula {} }.to raise_error(FormulaSpecificationError)
expect {
formula {
# do nothing
}
}.to raise_error(FormulaSpecificationError)
end
end
end

View File

@ -4,22 +4,29 @@
require "formula"
describe "patching" do
TESTBALL_URL = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
TESTBALL_PATCHES_URL = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1-patches.tgz"
PATCH_URL_A = "file://#{TEST_FIXTURE_DIR}/patches/noop-a.diff"
PATCH_URL_B = "file://#{TEST_FIXTURE_DIR}/patches/noop-b.diff"
PATCH_A_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-a.diff").freeze
PATCH_B_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-b.diff").freeze
APPLY_A = "noop-a.diff"
APPLY_B = "noop-b.diff"
APPLY_C = "noop-c.diff"
def formula(name = "formula_name", path: Formulary.core_path(name), spec: :stable, alias_path: nil, &block)
let(:formula_subclass) {
Class.new(Formula) {
# These are defined within an anonymous class to avoid polluting the global namespace.
# rubocop:disable RSpec/LeakyConstantDeclaration
TESTBALL_URL = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1.tbz"
TESTBALL_PATCHES_URL = "file://#{TEST_FIXTURE_DIR}/tarballs/testball-0.1-patches.tgz"
PATCH_URL_A = "file://#{TEST_FIXTURE_DIR}/patches/noop-a.diff"
PATCH_URL_B = "file://#{TEST_FIXTURE_DIR}/patches/noop-b.diff"
PATCH_A_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-a.diff").freeze
PATCH_B_CONTENTS = File.read("#{TEST_FIXTURE_DIR}/patches/noop-b.diff").freeze
APPLY_A = "noop-a.diff"
APPLY_B = "noop-b.diff"
APPLY_C = "noop-c.diff"
# rubocop:enable RSpec/LeakyConstantDeclaration
url TESTBALL_URL
sha256 TESTBALL_SHA256
class_eval(&block)
}.new(name, path, spec, alias_path: alias_path)
}
}
def formula(name = "formula_name", path: Formulary.core_path(name), spec: :stable, alias_path: nil, &block)
formula_subclass.class_eval(&block)
formula_subclass.new(name, path, spec, alias_path: alias_path)
end
matcher :be_patched do

View File

@ -93,7 +93,9 @@ describe Pathname do
end
it "preserves permissions" do
File.open(file, "w", 0100777) {}
File.open(file, "w", 0100777) {
# do nothing
}
file.atomic_write("CONTENT")
expect(file.stat.mode.to_s(8)).to eq((~File.umask & 0100777).to_s(8))
end

View File

@ -11,7 +11,7 @@ describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do
context "when the homepage URL ends with a slash" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh/'
end
@ -23,7 +23,7 @@ describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do
context "when the homepage URL does not end with a slash but has a path" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh/path'
end
@ -35,14 +35,14 @@ describe RuboCop::Cop::Cask::HomepageUrlTrailingSlash do
context "when the homepage URL does not end with a slash and has no path" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh'
end
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
homepage 'https://foo.brew.sh/'
end

View File

@ -12,7 +12,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when auditing `postflight` stanzas" do
context "when there are no on_system blocks" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
foobar
@ -26,7 +26,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when there is an `on_intel` block" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
on_intel do
@ -37,7 +37,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
if Hardware::CPU.intel?
@ -64,7 +64,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when there is an `on_monterey` block" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
on_monterey do
@ -75,7 +75,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
if MacOS.version == :monterey
@ -102,7 +102,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when there is an `on_monterey :or_older` block" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
on_monterey :or_older do
@ -113,7 +113,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
postflight do
if MacOS.version <= :monterey
@ -143,7 +143,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when auditing `sha256` stanzas inside on_arch blocks" do
context "when there are no on_arch blocks" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
end
@ -155,7 +155,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when the proper `sha256` stanza is used" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
sha256 arm: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94",
intel: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
@ -168,7 +168,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when the `sha256` stanza needs to be removed from the on_arch blocks" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
on_intel do
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
@ -180,7 +180,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
#{" "}
sha256 arm: "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b", intel: "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
@ -188,7 +188,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
CASK
end
let(:offense_source) do
<<-CASK.undent
<<~CASK
on_arm do
sha256 "8c62a2b791cf5f0da6066a0a4b6e85f62949cd60975da062df44adf887f4370b"
end
@ -213,7 +213,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when there is only one on_arch block" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
on_intel do
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
@ -227,7 +227,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when there is also a `version` stanza inside the on_arch blocks" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
on_intel do
version "1.0.0"
@ -246,7 +246,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when there is also a `version` stanza inside only a single on_arch block" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
on_intel do
version "2.0.0"
@ -266,7 +266,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when auditing loose `Hardware::CPU` method calls" do
context "when there is a `Hardware::CPU.arm?` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if Hardware::CPU.arm? && other_condition
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
@ -291,7 +291,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when there is a `Hardware::CPU.intel?` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if Hardware::CPU.intel? && other_condition
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
@ -316,7 +316,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when there is a `Hardware::CPU.arch` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
@ -342,7 +342,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when auditing loose `MacOS.version` method calls" do
context "when there is a `MacOS.version ==` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if MacOS.version == :catalina
version "1.0.0"
@ -367,7 +367,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when there is a `MacOS.version <=` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if MacOS.version <= :catalina
version "1.0.0"
@ -392,7 +392,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when there is a `MacOS.version >=` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if MacOS.version >= :catalina
version "1.0.0"
@ -417,7 +417,7 @@ describe RuboCop::Cop::Cask::OnSystemConditionals do
context "when there is a `MacOS.version` reference" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version "1.2.3"
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"

View File

@ -18,7 +18,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when there is only one stanza" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
end
@ -30,7 +30,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when no stanzas are incorrectly grouped" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -43,7 +43,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when no stanzas or variable assignments are incorrectly grouped" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm64", intel: "x86_64"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
@ -59,7 +59,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when one stanza is incorrectly grouped" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
@ -68,7 +68,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -92,7 +92,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when the arch stanza is incorrectly grouped" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm64", intel: "x86_64"
version :latest
@ -101,7 +101,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm64", intel: "x86_64"
@ -127,7 +127,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when one variable assignment is incorrectly grouped" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm64", intel: "x86_64"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
@ -137,7 +137,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm64", intel: "x86_64"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
@ -164,7 +164,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when many stanzas are incorrectly grouped" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -181,7 +181,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -232,7 +232,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when many stanzas and variable assignments are incorrectly grouped" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm64", intel: "x86_64"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
@ -253,7 +253,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm64", intel: "x86_64"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
@ -320,7 +320,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when caveats stanza is incorrectly grouped" do
let(:source) do
format(<<-CASK.undent, caveats: caveats.strip)
format(<<~CASK, caveats: caveats.strip)
cask 'foo' do
version :latest
sha256 :no_check
@ -332,7 +332,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
CASK
end
let(:correct_source) do
format(<<-CASK.undent, caveats: caveats.strip)
format(<<~CASK, caveats: caveats.strip)
cask 'foo' do
version :latest
sha256 :no_check
@ -355,8 +355,8 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when caveats is a heredoc" do
let(:caveats) do
<<-CAVEATS.undent
caveats <<-EOS.undent
<<~CAVEATS
caveats <<~EOS
This is a multiline caveat.
Let's hope it doesn't cause any problems!
@ -369,7 +369,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when caveats is a block" do
let(:caveats) do
<<-CAVEATS.undent
<<~CAVEATS
caveats do
puts 'This is a multiline caveat.'
@ -384,7 +384,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when the postflight stanza is incorrectly grouped" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -398,7 +398,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -420,7 +420,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when a stanza has a comment" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -437,7 +437,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -462,7 +462,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
context "when a stanza has a comment and there is a variable assignment" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm64", intel: "x86_64"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
@ -481,7 +481,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm64", intel: "x86_64"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
@ -509,7 +509,7 @@ describe RuboCop::Cop::Cask::StanzaGrouping do
# TODO: detect incorrectly grouped stanzas in nested expressions
context "when stanzas are nested in a conditional expression" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if true
version :latest

View File

@ -11,7 +11,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when there is only one stanza" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
end
@ -23,7 +23,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when no stanzas are out of order" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm", intel: "x86_64"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
@ -39,7 +39,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when one pair of stanzas is out of order" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
sha256 :no_check
version :latest
@ -47,7 +47,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -77,7 +77,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when the arch stanza is out of order" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -86,7 +86,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm", intel: "x86_64"
version :latest
@ -123,7 +123,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when an arch variable assignment is out of order" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm", intel: "x86_64"
sha256 :no_check
@ -133,7 +133,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm", intel: "x86_64"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
@ -165,7 +165,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when an arch variable assignment is above the arch stanza" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
arch arm: "arm", intel: "x86_64"
@ -175,7 +175,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm", intel: "x86_64"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
@ -207,7 +207,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when many stanzas are out of order" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
url 'https://foo.brew.sh/foo.zip'
uninstall :quit => 'com.example.foo',
@ -219,7 +219,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -266,7 +266,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when a stanza appears multiple times" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
name 'Foo'
url 'https://foo.brew.sh/foo.zip'
@ -279,7 +279,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -299,7 +299,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when a stanza has a comment" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
# comment with an empty line between
@ -313,7 +313,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check # comment on same line
@ -332,7 +332,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when a variable assignment is out of order with a comment" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -347,7 +347,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin" # comment on same line
version :latest
@ -367,7 +367,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when the caveats stanza is out of order" do
let(:source) do
format(<<-CASK.undent, caveats: caveats.strip)
format(<<~CASK, caveats: caveats.strip)
cask 'foo' do
name 'Foo'
url 'https://foo.brew.sh/foo.zip'
@ -379,7 +379,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
CASK
end
let(:correct_source) do
format(<<-CASK.undent, caveats: caveats.strip)
format(<<~CASK, caveats: caveats.strip)
cask 'foo' do
version :latest
sha256 :no_check
@ -399,8 +399,8 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when caveats is a heredoc" do
let(:caveats) do
<<-CAVEATS.undent
caveats <<-EOS.undent
<<~CAVEATS
caveats <<~EOS
This is a multiline caveat.
Let's hope it doesn't cause any problems!
@ -413,7 +413,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when caveats is a block" do
let(:caveats) do
<<-CAVEATS.undent
<<~CAVEATS
caveats do
puts 'This is a multiline caveat.'
@ -428,7 +428,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
context "when the postflight stanza is out of order" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
name 'Foo'
url 'https://foo.brew.sh/foo.zip'
@ -442,7 +442,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version :latest
sha256 :no_check
@ -462,7 +462,7 @@ describe RuboCop::Cop::Cask::StanzaOrder do
# TODO: detect out-of-order stanzas in nested expressions
context "when stanzas are nested in a conditional expression" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
if true
sha256 :no_check

View File

@ -11,7 +11,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
context "when url version interpolation does not include version.before_comma or version.after_comma" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version '1.1'
url 'https://foo.brew.sh/foo-\#{version}.dmg'
@ -24,7 +24,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
context "when the url uses csv" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version '1.1,111'
url 'https://foo.brew.sh/foo-\#{version.csv.first}.dmg'
@ -37,7 +37,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
context "when the url uses version.before_comma" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version '1.1,111'
url 'https://foo.brew.sh/foo-\#{version.before_comma}.dmg'
@ -45,7 +45,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version '1.1,111'
url 'https://foo.brew.sh/foo-\#{version.csv.first}.dmg'
@ -70,7 +70,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
context "when the url uses version.after_comma" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version '1.1,111'
url 'https://foo.brew.sh/foo-\#{version.after_comma}.dmg'
@ -78,7 +78,7 @@ describe RuboCop::Cop::Cask::UrlLegacyCommaSeparators do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
version '1.1,111'
url 'https://foo.brew.sh/foo-\#{version.csv.second}.dmg'

View File

@ -11,7 +11,7 @@ describe RuboCop::Cop::Cask::Variables do
context "when there are no variables" do
let(:source) do
<<-CASK.undent
<<~CASK
cask "foo" do
version :latest
end
@ -23,7 +23,7 @@ describe RuboCop::Cop::Cask::Variables do
context "when there is an arch stanza" do
let(:source) do
<<-CASK.undent
<<~CASK
cask "foo" do
arch arm: "darwin-arm64", intel: "darwin"
end
@ -35,7 +35,7 @@ describe RuboCop::Cop::Cask::Variables do
context "when there is a non-arch variable that uses the arch conditional" do
let(:source) do
<<-CASK.undent
<<~CASK
cask "foo" do
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
end
@ -47,14 +47,14 @@ describe RuboCop::Cop::Cask::Variables do
context "when there is an arch variable" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"
end
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "darwin-arm64", intel: "darwin"
end
@ -78,14 +78,14 @@ describe RuboCop::Cop::Cask::Variables do
context "when there is an arch variable that doesn't use strings" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch = Hardware::CPU.intel? ? :darwin : :darwin_arm64
end
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: :darwin_arm64, intel: :darwin
end
@ -109,14 +109,14 @@ describe RuboCop::Cop::Cask::Variables do
context "when there is an arch with an empty string" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch = Hardware::CPU.intel? ? "" : "arm64"
end
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "arm64"
end
@ -140,14 +140,14 @@ describe RuboCop::Cop::Cask::Variables do
context "when there is a non-arch variable" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
folder = Hardware::CPU.intel? ? "darwin" : "darwin-arm64"
end
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
end
@ -171,14 +171,14 @@ describe RuboCop::Cop::Cask::Variables do
context "when there is a non-arch variable with an empty string" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
folder = Hardware::CPU.intel? ? "amd64" : ""
end
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
folder = on_arch_conditional intel: "amd64"
end
@ -202,7 +202,7 @@ describe RuboCop::Cop::Cask::Variables do
context "when there is an arch and a non-arch variable" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"
folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"
@ -210,7 +210,7 @@ describe RuboCop::Cop::Cask::Variables do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
arch arm: "darwin-arm64", intel: "darwin"
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
@ -242,7 +242,7 @@ describe RuboCop::Cop::Cask::Variables do
context "when there are two non-arch variables" do
let(:source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
folder = Hardware::CPU.arm? ? "darwin-arm64" : "darwin"
platform = Hardware::CPU.intel? ? "darwin": "darwin-arm64"
@ -250,7 +250,7 @@ describe RuboCop::Cop::Cask::Variables do
CASK
end
let(:correct_source) do
<<-CASK.undent
<<~CASK
cask 'foo' do
folder = on_arch_conditional arm: "darwin-arm64", intel: "darwin"
platform = on_arch_conditional arm: "darwin-arm64", intel: "darwin"

View File

@ -8,7 +8,9 @@ cask "with-postflight-multi" do
pkg "MyFancyPkg/Fancy.pkg"
postflight do
# do nothing
end
postflight do
# do nothing
end
end

View File

@ -8,5 +8,6 @@ cask "with-postflight" do
pkg "MyFancyPkg/Fancy.pkg"
postflight do
# do nothing
end
end

View File

@ -8,7 +8,9 @@ cask "with-preflight-multi" do
pkg "MyFancyPkg/Fancy.pkg"
preflight do
# do nothing
end
preflight do
# do nothing
end
end

View File

@ -8,5 +8,6 @@ cask "with-preflight" do
pkg "MyFancyPkg/Fancy.pkg"
preflight do
# do nothing
end
end

View File

@ -8,7 +8,9 @@ cask "with-uninstall-postflight-multi" do
pkg "MyFancyPkg/Fancy.pkg"
uninstall_postflight do
# do nothing
end
uninstall_postflight do
# do nothing
end
end

View File

@ -8,5 +8,6 @@ cask "with-uninstall-postflight" do
pkg "MyFancyPkg/Fancy.pkg"
uninstall_postflight do
# do nothing
end
end

View File

@ -8,7 +8,9 @@ cask "with-uninstall-preflight-multi" do
pkg "MyFancyPkg/Fancy.pkg"
uninstall_preflight do
# do nothing
end
uninstall_preflight do
# do nothing
end
end

View File

@ -8,5 +8,6 @@ cask "with-uninstall-preflight" do
pkg "MyFancyPkg/Fancy.pkg"
uninstall_preflight do
# do nothing
end
end

View File

@ -70,7 +70,7 @@ module Utils
pid = fork do
exec curl, *args,
"--silent", "--output", "/dev/null",
"https://www.google-analytqics.com/collect"
"https://www.google-analytics.com/collect"
end
Process.detach T.must(pid)
end

View File

@ -35,8 +35,8 @@ $:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bindata-2.4.14/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/msgpack-1.6.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/msgpack-1.6.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/bootsnap-1.15.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bootsnap-1.15.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/bootsnap-1.16.0")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/bootsnap-1.16.0/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/extensions/universal-darwin-21/#{Gem.extension_api_version}/byebug-11.1.3")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/byebug-11.1.3/lib")
$:.unshift File.expand_path("#{__dir__}/../#{RUBY_ENGINE}/#{Gem.ruby_api_version}/gems/coderay-1.1.3/lib")

View File

@ -2192,8 +2192,6 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
- `HOMEBREW_NO_EMOJI`
<br>If set, do not print `HOMEBREW_INSTALL_BADGE` on a successful build.
*Note:* Will only try to print emoji on OS X Lion or newer.
- `HOMEBREW_NO_ENV_HINTS`
<br>If set, do not print any hints about changing Homebrew's behaviour with environment variables.

View File

@ -1,5 +1,5 @@
title: Homebrew Documentation
description: Documentation for the missing package manager for macOS.
description: Documentation for the missing package manager for macOS (or Linux).
remote_theme: Homebrew/brew.sh

View File

@ -3220,9 +3220,6 @@ If set, disable all use of legacy compatibility code\.
.br
If set, do not print \fBHOMEBREW_INSTALL_BADGE\fR on a successful build\.
.
.IP
\fINote:\fR Will only try to print emoji on OS X Lion or newer\.
.
.TP
\fBHOMEBREW_NO_ENV_HINTS\fR
.