diff --git a/lib/rscons/builder.rb b/lib/rscons/builder.rb index 241189f..4868552 100644 --- a/lib/rscons/builder.rb +++ b/lib/rscons/builder.rb @@ -54,6 +54,20 @@ module Rscons false end + # Run the builder to produce a build target. + # + # @param target [String] Target file name. + # @param sources [Array] 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 # build command. # diff --git a/spec/rscons/builder_spec.rb b/spec/rscons/builder_spec.rb new file mode 100644 index 0000000..7515956 --- /dev/null +++ b/spec/rscons/builder_spec.rb @@ -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