add a Builder#run method which raises an error unless overridden
This commit is contained in:
parent
e654df008d
commit
7ea0721cc2
@ -54,6 +54,20 @@ module Rscons
|
|||||||
false
|
false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Run the builder to produce a build target.
|
||||||
|
#
|
||||||
|
# @param target [String] Target file name.
|
||||||
|
# @param sources [Array<String>] Source file name(s).
|
||||||
|
# @param cache [Cache] The Cache object.
|
||||||
|
# @param env [Environment] The Environment executing the builder.
|
||||||
|
# @param vars [Hash,VarSet] Extra construction variables.
|
||||||
|
#
|
||||||
|
# @return [String,false]
|
||||||
|
# Name of the target file on success or false on failure.
|
||||||
|
def run(target, sources, cache, env, vars)
|
||||||
|
raise "This method must be overridden in a subclass"
|
||||||
|
end
|
||||||
|
|
||||||
# Check if the cache is up to date for the target and if not execute the
|
# Check if the cache is up to date for the target and if not execute the
|
||||||
# build command.
|
# build command.
|
||||||
#
|
#
|
||||||
|
9
spec/rscons/builder_spec.rb
Normal file
9
spec/rscons/builder_spec.rb
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
module Rscons
|
||||||
|
describe Builder do
|
||||||
|
describe "#run" do
|
||||||
|
it "raises an error if called directly and not through a subclass" do
|
||||||
|
expect{subject.run(:target, :sources, :cache, :env, :vars)}.to raise_error /This method must be overridden in a subclass/
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
x
Reference in New Issue
Block a user