Class: Rake::Pipeline::DSL
- Inherits:
-
Object
- Object
- Rake::Pipeline::DSL
- Defined in:
- lib/rake-pipeline/dsl.rb
Overview
Instance Attribute Summary (collapse)
-
- (Pipeline) pipeline
readonly
The pipeline the DSL should configure.
Class Method Summary (collapse)
-
+ (void) evaluate(pipeline, &block)
Configure a pipeline with a passed in block.
Instance Method Summary (collapse)
-
- (void) filter(filter_class, string = nil, &block)
Add a filter to the pipeline.
-
- (void) initialize(pipeline)
constructor
Create a new DSL to configure a pipeline.
-
- (void) input(root, glob = "**/*")
Define the input location and files for the pipeline.
-
- (Matcher) match(pattern, &block)
Apply a number of filters, but only to files matching a particular pattern.
-
- (void) output(root)
Specify the output directory for the pipeline.
-
- (void) tmpdir(root)
Specify the location of the temporary directory.
Constructor Details
- (void) initialize(pipeline)
Create a new Rake::Pipeline::DSL to configure a pipeline.
35 36 37 |
# File 'lib/rake-pipeline/dsl.rb', line 35 def initialize(pipeline) @pipeline = pipeline end |
Instance Attribute Details
- (Pipeline) pipeline (readonly)
The pipeline the DSL should configure
13 14 15 |
# File 'lib/rake-pipeline/dsl.rb', line 13 def pipeline @pipeline end |
Class Method Details
+ (void) evaluate(pipeline, &block)
This method returns an undefined value.
Configure a pipeline with a passed in block.
23 24 25 26 27 28 |
# File 'lib/rake-pipeline/dsl.rb', line 23 def self.evaluate(pipeline, &block) new(pipeline).instance_eval(&block) copy_filter = Rake::Pipeline::ConcatFilter.new copy_filter.output_name_generator = proc { |input| input } pipeline.add_filter(copy_filter) end |
Instance Method Details
- (void) filter(filter_class, string = nil, &block)
This method returns an undefined value.
Add a filter to the pipeline.
In addition to a filter class, #filter takes a block that describes how the filter should map input files to output files.
By default, the block maps an input file into an output file with the same name.
You can also specify a String, which will map all input files into the same output file. This is useful when you want to concatenate a list of files together.
81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/rake-pipeline/dsl.rb', line 81 def filter(filter_class, string=nil, &block) block ||= if string proc { string } else proc { |input| input } end filter = filter_class.new filter.output_name_generator = block pipeline.add_filter(filter) end |
- (void) input(root, glob = "**/*")
This method returns an undefined value.
Define the input location and files for the pipeline.
54 55 56 57 |
# File 'lib/rake-pipeline/dsl.rb', line 54 def input(root, glob="**/*") pipeline.input_root = root pipeline.input_glob = glob end |
- (Matcher) match(pattern, &block)
Apply a number of filters, but only to files matching a particular pattern.
Inside the block passed to match, you may specify any number of filters that should be applied to files matching the pattern.
124 125 126 127 128 129 |
# File 'lib/rake-pipeline/dsl.rb', line 124 def match(pattern, &block) matcher = pipeline.copy(Matcher, &block) matcher.glob = pattern pipeline.add_filter matcher matcher end |
- (void) output(root)
This method returns an undefined value.
Specify the output directory for the pipeline.
135 136 137 |
# File 'lib/rake-pipeline/dsl.rb', line 135 def output(root) pipeline.output_root = root end |
- (void) tmpdir(root)
This method returns an undefined value.
Specify the location of the temporary directory. Filters will store intermediate build artifacts here.
This defaults "tmp" in the current working directory.
147 148 149 |
# File 'lib/rake-pipeline/dsl.rb', line 147 def tmpdir(root) pipeline.tmpdir = root end |