Merge pull request #16640 from dduugg/finalize-sigs
Finalize methods that do not support overrides
This commit is contained in:
commit
aa58637201
@ -61,8 +61,15 @@ class Requirement
|
|||||||
s
|
s
|
||||||
end
|
end
|
||||||
|
|
||||||
# Overriding {#satisfied?} is unsupported.
|
# Pass a block or boolean to the satisfy DSL method instead of overriding.
|
||||||
# Pass a block or boolean to the satisfy DSL method instead.
|
sig(:final) {
|
||||||
|
params(
|
||||||
|
env: T.nilable(String),
|
||||||
|
cc: T.nilable(String),
|
||||||
|
build_bottle: T::Boolean,
|
||||||
|
bottle_arch: T.nilable(String),
|
||||||
|
).returns(T::Boolean)
|
||||||
|
}
|
||||||
def satisfied?(env: nil, cc: nil, build_bottle: false, bottle_arch: nil)
|
def satisfied?(env: nil, cc: nil, build_bottle: false, bottle_arch: nil)
|
||||||
satisfy = self.class.satisfy
|
satisfy = self.class.satisfy
|
||||||
return true unless satisfy
|
return true unless satisfy
|
||||||
@ -76,8 +83,8 @@ class Requirement
|
|||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
# Overriding {#fatal?} is unsupported.
|
# Pass a boolean to the fatal DSL method instead of overriding.
|
||||||
# Pass a boolean to the fatal DSL method instead.
|
sig(:final) { returns(T::Boolean) }
|
||||||
def fatal?
|
def fatal?
|
||||||
self.class.fatal || false
|
self.class.fatal || false
|
||||||
end
|
end
|
||||||
@ -92,8 +99,15 @@ class Requirement
|
|||||||
parent
|
parent
|
||||||
end
|
end
|
||||||
|
|
||||||
# Overriding {#modify_build_environment} is unsupported.
|
# Pass a block to the env DSL method instead of overriding.
|
||||||
# Pass a block to the env DSL method instead.
|
sig(:final) {
|
||||||
|
params(
|
||||||
|
env: T.nilable(String),
|
||||||
|
cc: T.nilable(String),
|
||||||
|
build_bottle: T::Boolean,
|
||||||
|
bottle_arch: T.nilable(String),
|
||||||
|
).void
|
||||||
|
}
|
||||||
def modify_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil)
|
def modify_build_environment(env: nil, cc: nil, build_bottle: false, bottle_arch: nil)
|
||||||
satisfied?(env: env, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch)
|
satisfied?(env: env, cc: cc, build_bottle: build_bottle, bottle_arch: bottle_arch)
|
||||||
instance_eval(&env_proc) if env_proc
|
instance_eval(&env_proc) if env_proc
|
||||||
|
|||||||
@ -177,7 +177,7 @@ RSpec.describe Requirement do
|
|||||||
let(:klass) { Class.new(described_class) }
|
let(:klass) { Class.new(described_class) }
|
||||||
|
|
||||||
it "returns nil" do
|
it "returns nil" do
|
||||||
expect(requirement.modify_build_environment).to be_nil
|
expect { requirement.modify_build_environment }.not_to raise_error
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user