Merge pull request #9403 from MikeMcQuaid/deprecate-cask-requirements
Deprecate cask requirements.
This commit is contained in:
commit
010ae37420
@ -87,7 +87,6 @@ class Build
|
|||||||
ENV.keg_only_deps = keg_only_deps
|
ENV.keg_only_deps = keg_only_deps
|
||||||
ENV.deps = formula_deps
|
ENV.deps = formula_deps
|
||||||
ENV.run_time_deps = run_time_deps
|
ENV.run_time_deps = run_time_deps
|
||||||
ENV.x11 = reqs.any? { |rq| rq.is_a?(X11Requirement) }
|
|
||||||
ENV.setup_build_environment(
|
ENV.setup_build_environment(
|
||||||
formula: formula,
|
formula: formula,
|
||||||
cc: args.cc,
|
cc: args.cc,
|
||||||
|
@ -27,8 +27,7 @@ module Cask
|
|||||||
arm64: { type: :arm, bits: 64 },
|
arm64: { type: :arm, bits: 64 },
|
||||||
}.freeze
|
}.freeze
|
||||||
|
|
||||||
attr_accessor :java
|
attr_reader :arch, :cask, :formula, :java, :macos, :x11
|
||||||
attr_reader :arch, :cask, :formula, :macos, :x11
|
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
super({})
|
super({})
|
||||||
@ -83,9 +82,17 @@ module Cask
|
|||||||
@arch.concat(arches.map { |arch| VALID_ARCHES[arch] })
|
@arch.concat(arches.map { |arch| VALID_ARCHES[arch] })
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def java=(arg)
|
||||||
|
odeprecated "depends_on :java", "depends_on a specific Java formula"
|
||||||
|
|
||||||
|
@java = arg
|
||||||
|
end
|
||||||
|
|
||||||
def x11=(arg)
|
def x11=(arg)
|
||||||
raise "invalid 'depends_on x11' value: #{arg.inspect}" unless [true, false].include?(arg)
|
raise "invalid 'depends_on x11' value: #{arg.inspect}" unless [true, false].include?(arg)
|
||||||
|
|
||||||
|
odeprecated "depends_on :x11", "depends_on specific X11 formula(e)"
|
||||||
|
|
||||||
@x11 = arg
|
@x11 = arg
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -36,10 +36,7 @@ module Homebrew
|
|||||||
|
|
||||||
ENV.activate_extensions!(env: args.env)
|
ENV.activate_extensions!(env: args.env)
|
||||||
|
|
||||||
if superenv?(args.env)
|
ENV.deps = Formula.installed.select { |f| f.keg_only? && f.opt_prefix.directory? } if superenv?(args.env)
|
||||||
ENV.set_x11_env_if_installed
|
|
||||||
ENV.deps = Formula.installed.select { |f| f.keg_only? && f.opt_prefix.directory? }
|
|
||||||
end
|
|
||||||
ENV.setup_build_environment
|
ENV.setup_build_environment
|
||||||
if superenv?(args.env)
|
if superenv?(args.env)
|
||||||
# superenv stopped adding brew's bin but generally users will want it
|
# superenv stopped adding brew's bin but generally users will want it
|
||||||
|
@ -209,7 +209,9 @@ module Stdenv
|
|||||||
end
|
end
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def x11; end
|
def x11
|
||||||
|
odeprecated "ENV.x11", "depends_on specific X11 formula(e)"
|
||||||
|
end
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
sig { params(map: T::Hash[Symbol, String]).void }
|
sig { params(map: T::Hash[Symbol, String]).void }
|
||||||
|
@ -343,7 +343,9 @@ module Superenv
|
|||||||
end
|
end
|
||||||
|
|
||||||
sig { void }
|
sig { void }
|
||||||
def set_x11_env_if_installed; end
|
def set_x11_env_if_installed
|
||||||
|
odeprecated "ENV.set_x11_env_if_installed"
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
require "extend/os/extend/ENV/super"
|
require "extend/os/extend/ENV/super"
|
||||||
|
@ -6,6 +6,11 @@ require "requirement"
|
|||||||
class OsxfuseRequirement < Requirement
|
class OsxfuseRequirement < Requirement
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
|
|
||||||
|
def initialize(tags = [])
|
||||||
|
odeprecated "depends_on :osxfuse", 'on_linux do; depends_on "libfuse"; end'
|
||||||
|
super(tags)
|
||||||
|
end
|
||||||
|
|
||||||
download "https://github.com/libfuse/libfuse"
|
download "https://github.com/libfuse/libfuse"
|
||||||
|
|
||||||
satisfy(build_env: false) do
|
satisfy(build_env: false) do
|
||||||
|
@ -4,35 +4,12 @@
|
|||||||
module Stdenv
|
module Stdenv
|
||||||
# @private
|
# @private
|
||||||
|
|
||||||
undef homebrew_extra_pkg_config_paths, x11
|
undef homebrew_extra_pkg_config_paths
|
||||||
|
|
||||||
def homebrew_extra_pkg_config_paths
|
def homebrew_extra_pkg_config_paths
|
||||||
["#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.sdk_version}"]
|
["#{HOMEBREW_LIBRARY}/Homebrew/os/mac/pkgconfig/#{MacOS.sdk_version}"]
|
||||||
end
|
end
|
||||||
|
|
||||||
def x11
|
|
||||||
# There are some config scripts here that should go in the PATH
|
|
||||||
append_path "PATH", MacOS::XQuartz.bin.to_s
|
|
||||||
|
|
||||||
# Append these to PKG_CONFIG_LIBDIR so they are searched
|
|
||||||
# *after* our own pkgconfig directories, as we dupe some of the
|
|
||||||
# libs in XQuartz.
|
|
||||||
append_path "PKG_CONFIG_LIBDIR", "#{MacOS::XQuartz.lib}/pkgconfig"
|
|
||||||
append_path "PKG_CONFIG_LIBDIR", "#{MacOS::XQuartz.share}/pkgconfig"
|
|
||||||
|
|
||||||
append "LDFLAGS", "-L#{MacOS::XQuartz.lib}"
|
|
||||||
append_path "CMAKE_PREFIX_PATH", MacOS::XQuartz.prefix.to_s
|
|
||||||
append_path "CMAKE_INCLUDE_PATH", MacOS::XQuartz.include.to_s
|
|
||||||
append_path "CMAKE_INCLUDE_PATH", "#{MacOS::XQuartz.include}/freetype2"
|
|
||||||
|
|
||||||
append "CPPFLAGS", "-I#{MacOS::XQuartz.include}"
|
|
||||||
append "CPPFLAGS", "-I#{MacOS::XQuartz.include}/freetype2"
|
|
||||||
|
|
||||||
append_path "ACLOCAL_PATH", "#{MacOS::XQuartz.share}/aclocal"
|
|
||||||
|
|
||||||
append "CFLAGS", "-I#{MacOS::XQuartz.include}" unless MacOS::CLT.installed?
|
|
||||||
end
|
|
||||||
|
|
||||||
def setup_build_environment(**options)
|
def setup_build_environment(**options)
|
||||||
generic_setup_build_environment(**options)
|
generic_setup_build_environment(**options)
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ module Superenv
|
|||||||
homebrew_extra_cmake_include_paths,
|
homebrew_extra_cmake_include_paths,
|
||||||
homebrew_extra_cmake_library_paths,
|
homebrew_extra_cmake_library_paths,
|
||||||
homebrew_extra_cmake_frameworks_paths,
|
homebrew_extra_cmake_frameworks_paths,
|
||||||
determine_cccfg, set_x11_env_if_installed
|
determine_cccfg
|
||||||
|
|
||||||
def homebrew_extra_paths
|
def homebrew_extra_paths
|
||||||
paths = []
|
paths = []
|
||||||
@ -105,10 +105,6 @@ module Superenv
|
|||||||
s.freeze
|
s.freeze
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_x11_env_if_installed
|
|
||||||
ENV.x11 = MacOS::XQuartz.installed?
|
|
||||||
end
|
|
||||||
|
|
||||||
# @private
|
# @private
|
||||||
def setup_build_environment(**options)
|
def setup_build_environment(**options)
|
||||||
formula = options[:formula]
|
formula = options[:formula]
|
||||||
|
@ -6,6 +6,11 @@ require "requirement"
|
|||||||
class OsxfuseRequirement < Requirement
|
class OsxfuseRequirement < Requirement
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
|
|
||||||
|
def initialize(tags = [])
|
||||||
|
odeprecated "depends_on :osxfuse"
|
||||||
|
super(tags)
|
||||||
|
end
|
||||||
|
|
||||||
download "https://osxfuse.github.io/"
|
download "https://osxfuse.github.io/"
|
||||||
|
|
||||||
satisfy(build_env: false) { self.class.binary_osxfuse_installed? }
|
satisfy(build_env: false) { self.class.binary_osxfuse_installed? }
|
||||||
|
@ -2526,9 +2526,6 @@ class Formula
|
|||||||
# depends_on "sqlite" if MacOS.version >= :catalina
|
# depends_on "sqlite" if MacOS.version >= :catalina
|
||||||
# depends_on xcode: :build # If the formula really needs full Xcode to compile.
|
# depends_on xcode: :build # If the formula really needs full Xcode to compile.
|
||||||
# depends_on macos: :mojave # Needs at least macOS Mojave (10.14) to run.
|
# depends_on macos: :mojave # Needs at least macOS Mojave (10.14) to run.
|
||||||
# depends_on x11: :optional # X11/XQuartz components.
|
|
||||||
# depends_on :osxfuse # Permits the use of the upstream signed binary or our cask.
|
|
||||||
# depends_on :tuntap # Does the same thing as above. This is vital for Yosemite and later.</pre>
|
|
||||||
# <pre># It is possible to only depend on something if
|
# <pre># It is possible to only depend on something if
|
||||||
# # `build.with?` or `build.without? "another_formula"`:
|
# # `build.with?` or `build.without? "another_formula"`:
|
||||||
# depends_on "postgresql" if build.without? "sqlite"</pre>
|
# depends_on "postgresql" if build.without? "sqlite"</pre>
|
||||||
|
@ -9,6 +9,11 @@ require "requirement"
|
|||||||
class TuntapRequirement < Requirement
|
class TuntapRequirement < Requirement
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
|
|
||||||
|
def initialize(tags = [])
|
||||||
|
odeprecated "depends_on :tuntap"
|
||||||
|
super(tags)
|
||||||
|
end
|
||||||
|
|
||||||
fatal true
|
fatal true
|
||||||
cask "tuntap"
|
cask "tuntap"
|
||||||
satisfy(build_env: false) { self.class.binary_tuntap_installed? }
|
satisfy(build_env: false) { self.class.binary_tuntap_installed? }
|
||||||
|
@ -8,16 +8,18 @@ require "requirement"
|
|||||||
# @api private
|
# @api private
|
||||||
class X11Requirement < Requirement
|
class X11Requirement < Requirement
|
||||||
extend T::Sig
|
extend T::Sig
|
||||||
|
|
||||||
include Comparable
|
include Comparable
|
||||||
|
|
||||||
|
def initialize(tags = [])
|
||||||
|
odeprecated "depends_on :x11", "depends_on specific X11 formula(e)"
|
||||||
|
super(tags)
|
||||||
|
end
|
||||||
|
|
||||||
fatal true
|
fatal true
|
||||||
|
|
||||||
cask "xquartz"
|
cask "xquartz"
|
||||||
download "https://xquartz.macosforge.org"
|
download "https://xquartz.macosforge.org"
|
||||||
|
|
||||||
env { ENV.x11 }
|
|
||||||
|
|
||||||
sig { returns(String) }
|
sig { returns(String) }
|
||||||
def min_version
|
def min_version
|
||||||
"1.12.2"
|
"1.12.2"
|
||||||
|
@ -551,10 +551,6 @@ module RuboCop
|
|||||||
problem "macOS has been 64-bit only since 10.6 so ENV.universal_binary is deprecated."
|
problem "macOS has been 64-bit only since 10.6 so ENV.universal_binary is deprecated."
|
||||||
end
|
end
|
||||||
|
|
||||||
find_instance_method_call(body_node, "ENV", :x11) do
|
|
||||||
problem 'Use "depends_on :x11" instead of "ENV.x11"'
|
|
||||||
end
|
|
||||||
|
|
||||||
find_every_method_call_by_name(body_node, :depends_on).each do |method|
|
find_every_method_call_by_name(body_node, :depends_on).each do |method|
|
||||||
next unless method_called?(method, :new)
|
next unless method_called?(method, :new)
|
||||||
|
|
||||||
|
@ -74,37 +74,4 @@ describe "Satisfy Dependencies and Requirements", :cask do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "depends_on x11" do
|
|
||||||
before do
|
|
||||||
allow(MacOS::XQuartz).to receive(:installed?).and_return(x11_installed)
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when satisfied" do
|
|
||||||
let(:cask) { Cask::CaskLoader.load(cask_path("with-depends-on-x11")) }
|
|
||||||
let(:x11_installed) { true }
|
|
||||||
|
|
||||||
it "does not raise an error" do
|
|
||||||
expect { install }.not_to raise_error
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when not satisfied" do
|
|
||||||
let(:cask) { Cask::CaskLoader.load(cask_path("with-depends-on-x11")) }
|
|
||||||
let(:x11_installed) { false }
|
|
||||||
|
|
||||||
it "does not raise an error" do
|
|
||||||
expect { install }.to raise_error Cask::CaskX11DependencyError
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "when depends_on x11: false" do
|
|
||||||
let(:cask) { Cask::CaskLoader.load(cask_path("with-depends-on-x11-false")) }
|
|
||||||
let(:x11_installed) { false }
|
|
||||||
|
|
||||||
it "does not raise an error" do
|
|
||||||
expect { install }.not_to raise_error
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
@ -410,14 +410,6 @@ describe Cask::DSL, :cask do
|
|||||||
end
|
end
|
||||||
|
|
||||||
describe "depends_on x11" do
|
describe "depends_on x11" do
|
||||||
context "valid" do
|
|
||||||
let(:token) { "with-depends-on-x11" }
|
|
||||||
|
|
||||||
it "is allowed to be specified" do
|
|
||||||
expect(cask.depends_on.x11).not_to be nil
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "invalid depends_on x11 value" do
|
context "invalid depends_on x11 value" do
|
||||||
let(:token) { "invalid/invalid-depends-on-x11-value" }
|
let(:token) { "invalid/invalid-depends-on-x11-value" }
|
||||||
|
|
||||||
|
@ -13,7 +13,6 @@ describe CaskDependent, :needs_macos do
|
|||||||
depends_on formula: "baz"
|
depends_on formula: "baz"
|
||||||
depends_on cask: "foo-cask"
|
depends_on cask: "foo-cask"
|
||||||
depends_on macos: ">= :mojave"
|
depends_on macos: ">= :mojave"
|
||||||
depends_on x11: true
|
|
||||||
end
|
end
|
||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
@ -28,7 +27,7 @@ describe CaskDependent, :needs_macos do
|
|||||||
describe "#requirements" do
|
describe "#requirements" do
|
||||||
it "is the requirements of the cask" do
|
it "is the requirements of the cask" do
|
||||||
expect(dependent.requirements.map(&:name))
|
expect(dependent.requirements.map(&:name))
|
||||||
.to eq %w[foo-cask macos x11]
|
.to eq %w[foo-cask macos]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -39,7 +38,6 @@ describe CaskDependent, :needs_macos do
|
|||||||
setup_test_formula "baz", <<-RUBY
|
setup_test_formula "baz", <<-RUBY
|
||||||
url "https://brew.sh/baz-1.0"
|
url "https://brew.sh/baz-1.0"
|
||||||
depends_on "bar"
|
depends_on "bar"
|
||||||
depends_on :osxfuse
|
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
expect(dependent.recursive_dependencies.map(&:name))
|
expect(dependent.recursive_dependencies.map(&:name))
|
||||||
@ -54,11 +52,10 @@ describe CaskDependent, :needs_macos do
|
|||||||
setup_test_formula "baz", <<-RUBY
|
setup_test_formula "baz", <<-RUBY
|
||||||
url "https://brew.sh/baz-1.0"
|
url "https://brew.sh/baz-1.0"
|
||||||
depends_on "bar"
|
depends_on "bar"
|
||||||
depends_on :osxfuse
|
|
||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
expect(dependent.recursive_requirements.map(&:name))
|
expect(dependent.recursive_requirements.map(&:name))
|
||||||
.to eq(%w[foo-cask macos x11 osxfuse])
|
.to eq(%w[foo-cask macos])
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -27,32 +27,20 @@ describe DependencyCollector do
|
|||||||
end
|
end
|
||||||
|
|
||||||
specify "requirement creation" do
|
specify "requirement creation" do
|
||||||
subject.add :x11
|
subject.add :xcode
|
||||||
expect(find_requirement(X11Requirement)).to be_an_instance_of(X11Requirement)
|
expect(find_requirement(XcodeRequirement)).to be_an_instance_of(XcodeRequirement)
|
||||||
end
|
end
|
||||||
|
|
||||||
it "deduplicates requirements" do
|
it "deduplicates requirements" do
|
||||||
2.times { subject.add :x11 }
|
2.times { subject.add :xcode }
|
||||||
expect(subject.requirements.count).to eq(1)
|
expect(subject.requirements.count).to eq(1)
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "requirement tags" do
|
specify "requirement tags" do
|
||||||
subject.add :x11
|
|
||||||
subject.add xcode: :build
|
subject.add xcode: :build
|
||||||
expect(find_requirement(X11Requirement).tags).to be_empty
|
|
||||||
expect(find_requirement(XcodeRequirement)).to be_a_build_requirement
|
expect(find_requirement(XcodeRequirement)).to be_a_build_requirement
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "x11 without tag" do
|
|
||||||
subject.add :x11
|
|
||||||
expect(find_requirement(X11Requirement).tags).to be_empty
|
|
||||||
end
|
|
||||||
|
|
||||||
specify "x11 with tag" do
|
|
||||||
subject.add x11: :optional
|
|
||||||
expect(find_requirement(X11Requirement)).to be_optional
|
|
||||||
end
|
|
||||||
|
|
||||||
it "doesn't mutate the dependency spec" do
|
it "doesn't mutate the dependency spec" do
|
||||||
spec = { "foo" => :optional }
|
spec = { "foo" => :optional }
|
||||||
copy = spec.dup
|
copy = spec.dup
|
||||||
|
@ -794,17 +794,15 @@ describe Formula do
|
|||||||
f1 = formula "f1" do
|
f1 = formula "f1" do
|
||||||
url "f1-1"
|
url "f1-1"
|
||||||
|
|
||||||
depends_on x11: :recommended
|
|
||||||
depends_on xcode: ["1.0", :optional]
|
depends_on xcode: ["1.0", :optional]
|
||||||
end
|
end
|
||||||
stub_formula_loader(f1)
|
stub_formula_loader(f1)
|
||||||
|
|
||||||
x11 = X11Requirement.new([:recommended])
|
|
||||||
xcode = XcodeRequirement.new(["1.0", :optional])
|
xcode = XcodeRequirement.new(["1.0", :optional])
|
||||||
|
|
||||||
expect(Set.new(f1.recursive_requirements)).to eq(Set[x11])
|
expect(Set.new(f1.recursive_requirements)).to eq(Set[])
|
||||||
|
|
||||||
f1.build = BuildOptions.new(["--with-xcode", "--without-x11"], f1.options)
|
f1.build = BuildOptions.new(["--with-xcode"], f1.options)
|
||||||
|
|
||||||
expect(Set.new(f1.recursive_requirements)).to eq(Set[xcode])
|
expect(Set.new(f1.recursive_requirements)).to eq(Set[xcode])
|
||||||
|
|
||||||
@ -815,14 +813,14 @@ describe Formula do
|
|||||||
depends_on "f1"
|
depends_on "f1"
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(Set.new(f2.recursive_requirements)).to eq(Set[x11])
|
expect(Set.new(f2.recursive_requirements)).to eq(Set[])
|
||||||
expect(Set.new(f2.recursive_requirements {})).to eq(Set[x11, xcode])
|
expect(Set.new(f2.recursive_requirements {})).to eq(Set[xcode])
|
||||||
|
|
||||||
requirements = f2.recursive_requirements do |_dependent, requirement|
|
requirements = f2.recursive_requirements do |_dependent, requirement|
|
||||||
Requirement.prune if requirement.is_a?(X11Requirement)
|
Requirement.prune if requirement.is_a?(XcodeRequirement)
|
||||||
end
|
end
|
||||||
|
|
||||||
expect(Set.new(requirements)).to eq(Set[xcode])
|
expect(Set.new(requirements)).to eq(Set[])
|
||||||
end
|
end
|
||||||
|
|
||||||
specify "#to_hash" do
|
specify "#to_hash" do
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
# typed: false
|
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require "requirements/osxfuse_requirement"
|
|
||||||
|
|
||||||
describe OsxfuseRequirement do
|
|
||||||
subject(:requirement) { described_class.new([]) }
|
|
||||||
|
|
||||||
describe "::binary_osxfuse_installed?", :needs_macos do
|
|
||||||
alias_matcher :have_binary_osxfuse_installed, :be_binary_osxfuse_installed
|
|
||||||
|
|
||||||
it "returns false if fuse.h does not exist" do
|
|
||||||
allow(File).to receive(:exist?).and_return(false)
|
|
||||||
expect(described_class).not_to have_binary_osxfuse_installed
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns false if osxfuse include directory is a symlink" do
|
|
||||||
allow(File).to receive(:exist?).and_return(true)
|
|
||||||
allow(File).to receive(:symlink?).and_return(true)
|
|
||||||
expect(described_class).not_to have_binary_osxfuse_installed
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#modify_build_environment", :needs_macos do
|
|
||||||
it "adds the fuse directories to PKG_CONFIG_PATH" do
|
|
||||||
allow(ENV).to receive(:append_path)
|
|
||||||
requirement.modify_build_environment
|
|
||||||
expect(ENV).to have_received(:append_path).with("PKG_CONFIG_PATH", any_args)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "adds the fuse directories to HOMEBREW_LIBRARY_PATHS" do
|
|
||||||
allow(ENV).to receive(:append_path)
|
|
||||||
requirement.modify_build_environment
|
|
||||||
expect(ENV).to have_received(:append_path).with("HOMEBREW_LIBRARY_PATHS", any_args)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "adds the fuse directories to HOMEBREW_INCLUDE_PATHS" do
|
|
||||||
allow(ENV).to receive(:append_path)
|
|
||||||
requirement.modify_build_environment
|
|
||||||
expect(ENV).to have_received(:append_path).with("HOMEBREW_INCLUDE_PATHS", any_args)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#message" do
|
|
||||||
it "prompts for installation of 'libfuse' on Linux", :needs_linux do
|
|
||||||
expect(requirement.message).to match("libfuse is required for this software")
|
|
||||||
end
|
|
||||||
|
|
||||||
it "prompts for installation of 'osxFuse' on macOS", :needs_macos do
|
|
||||||
expect(requirement.message).to match("osxfuse.github.io")
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -1,44 +0,0 @@
|
|||||||
# typed: false
|
|
||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
require "requirements/x11_requirement"
|
|
||||||
|
|
||||||
describe X11Requirement do
|
|
||||||
subject(:requirement) { described_class.new([]) }
|
|
||||||
|
|
||||||
let(:default_name) { "x11" }
|
|
||||||
|
|
||||||
describe "#name" do
|
|
||||||
it "defaults to x11" do
|
|
||||||
expect(requirement.name).to eq(default_name)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#eql?" do
|
|
||||||
it "returns true if the requirements are equal" do
|
|
||||||
other = described_class.new
|
|
||||||
expect(requirement).to eql(other)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#modify_build_environment" do
|
|
||||||
it "calls ENV#x11" do
|
|
||||||
allow(requirement).to receive(:satisfied?).and_return(true)
|
|
||||||
expect(ENV).to receive(:x11)
|
|
||||||
requirement.modify_build_environment
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
describe "#satisfied?", :needs_macos do
|
|
||||||
it "returns true if X11 is installed" do
|
|
||||||
expect(MacOS::XQuartz).to receive(:version).and_return("2.7.5")
|
|
||||||
expect(MacOS::XQuartz).to receive(:installed?).and_return(true)
|
|
||||||
expect(requirement).to be_satisfied
|
|
||||||
end
|
|
||||||
|
|
||||||
it "returns false if X11 is not installed" do
|
|
||||||
expect(MacOS::XQuartz).to receive(:installed?).and_return(false)
|
|
||||||
expect(requirement).not_to be_satisfied
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -10,10 +10,8 @@ describe Requirements do
|
|||||||
end
|
end
|
||||||
|
|
||||||
it "merges duplicate requirements" do
|
it "merges duplicate requirements" do
|
||||||
subject << X11Requirement.new << X11Requirement.new
|
subject << Requirement.new << Requirement.new
|
||||||
expect(subject.count).to eq(1)
|
expect(subject.count).to eq(1)
|
||||||
subject << Requirement.new
|
|
||||||
expect(subject.count).to eq(2)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1122,19 +1122,6 @@ describe RuboCop::Cop::FormulaAudit::Miscellaneous do
|
|||||||
RUBY
|
RUBY
|
||||||
end
|
end
|
||||||
|
|
||||||
it "deprecated ENV.x11 usage" do
|
|
||||||
expect_offense(<<~RUBY)
|
|
||||||
class Foo < Formula
|
|
||||||
desc "foo"
|
|
||||||
url 'https://brew.sh/foo-1.0.tgz'
|
|
||||||
if build?
|
|
||||||
ENV.x11
|
|
||||||
^^^^^^^ Use "depends_on :x11" instead of "ENV.x11"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
RUBY
|
|
||||||
end
|
|
||||||
|
|
||||||
it "install_name_tool usage instead of ruby-macho" do
|
it "install_name_tool usage instead of ruby-macho" do
|
||||||
expect_offense(<<~RUBY)
|
expect_offense(<<~RUBY)
|
||||||
class Foo < Formula
|
class Foo < Formula
|
||||||
|
@ -1,11 +0,0 @@
|
|||||||
cask "with-depends-on-x11-false" do
|
|
||||||
version "1.2.3"
|
|
||||||
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
|
||||||
|
|
||||||
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
|
|
||||||
homepage "https://brew.sh/with-depends-on-x11-false"
|
|
||||||
|
|
||||||
depends_on x11: false
|
|
||||||
|
|
||||||
app "Caffeine.app"
|
|
||||||
end
|
|
@ -1,11 +0,0 @@
|
|||||||
cask "with-depends-on-x11" do
|
|
||||||
version "1.2.3"
|
|
||||||
sha256 "67cdb8a02803ef37fdbf7e0be205863172e41a561ca446cd84f0d7ab35a99d94"
|
|
||||||
|
|
||||||
url "file://#{TEST_FIXTURE_DIR}/cask/caffeine.zip"
|
|
||||||
homepage "https://brew.sh/with-depends-on-x11"
|
|
||||||
|
|
||||||
depends_on x11: true
|
|
||||||
|
|
||||||
app "Caffeine.app"
|
|
||||||
end
|
|
Loading…
x
Reference in New Issue
Block a user