Class: Rake::Pipeline::DSL::ProjectDSL
- Inherits:
-
Object
- Object
- Rake::Pipeline::DSL::ProjectDSL
- Defined in:
- lib/rake-pipeline/dsl/project_dsl.rb
Overview
This class exists purely to provide a convenient DSL for configuring a project.
All instance methods of ProjectDSL are available in the context the block passed to Rake::Pipeline::Project.
Project.build.
When configuring a project, you must provide an output root and a series of files using at least one #input block.
Instance Attribute Summary collapse
-
#project ⇒ Project
readonly
The project the DSL should configure.
Class Method Summary collapse
-
.evaluate(project, &block) ⇒ void
Configure a project with a passed in block.
Instance Method Summary collapse
-
#after_filter(klass, *args, &block) ⇒ Object
Add a filter to every input block.
-
#before_filter(klass, *args, &block) ⇒ Object
Add a filter to every input block.
-
#initialize(project) ⇒ void
constructor
Create a new ProjectDSL to configure a project.
-
#input(*inputs, &block) ⇒ Object
(also: #inputs)
Add a new pipeline with the given inputs to the project.
- #map(path, &block) ⇒ Object
-
#output(root) ⇒ void
Specify the default output directory for the project.
-
#tmpdir(root) ⇒ void
Specify the location of the root temporary directory.
Constructor Details
#initialize(project) ⇒ void
Create a new Rake::Pipeline::DSL::ProjectDSL to configure a project.
33 34 35 36 37 38 39 |
# File 'lib/rake-pipeline/dsl/project_dsl.rb', line 33 def initialize(project) @project = project @before_filters = [] @after_filters = [] @project.before_filters = @before_filters @project.after_filters = @after_filters end |
Instance Attribute Details
#project ⇒ Project (readonly)
Returns the project the DSL should configure.
14 15 16 |
# File 'lib/rake-pipeline/dsl/project_dsl.rb', line 14 def project @project end |
Class Method Details
.evaluate(project, &block) ⇒ void
This method returns an undefined value.
Configure a project with a passed in block.
24 25 26 |
# File 'lib/rake-pipeline/dsl/project_dsl.rb', line 24 def self.evaluate(project, &block) new(project).instance_eval(&block) end |
Instance Method Details
#after_filter(klass, *args, &block) ⇒ Object
Add a filter to every input block. The parameters to after_filter
are the same as the parameters to Rake::Pipeline::DSL::PipelineDSL#filter.
Filters will be executed after the specified filters in insertion order.
61 62 63 |
# File 'lib/rake-pipeline/dsl/project_dsl.rb', line 61 def after_filter(klass, *args, &block) @after_filters.push [klass, args, block] end |
#before_filter(klass, *args, &block) ⇒ Object
Add a filter to every input block. The parameters to before_filter
are the same as the parameters to Rake::Pipeline::DSL::PipelineDSL#filter.
Filters will be executed before the specified filters in reverse of insertion order.
49 50 51 |
# File 'lib/rake-pipeline/dsl/project_dsl.rb', line 49 def before_filter(klass, *args, &block) @before_filters.unshift [klass, args, block] end |
#input(*inputs, &block) ⇒ Object Also known as: inputs
Add a new pipeline with the given inputs to the project.
93 94 95 96 97 98 99 |
# File 'lib/rake-pipeline/dsl/project_dsl.rb', line 93 def input(*inputs, &block) # Allow pipelines without a specified block. This is possible # if before and after filters are all that are needed for a # given input. block = proc {} unless block_given? project.build_pipeline(*inputs, &block) end |
#map(path, &block) ⇒ Object
102 103 104 |
# File 'lib/rake-pipeline/dsl/project_dsl.rb', line 102 def map(path, &block) project.maps[path] = block end |
#output(root) ⇒ void
This method returns an undefined value.
Specify the default output directory for the project.
Pipelines created in this project will place their outputs here unless the value is overriden in their #input block.
73 74 75 |
# File 'lib/rake-pipeline/dsl/project_dsl.rb', line 73 def output(root) project.default_output_root = root end |
#tmpdir(root) ⇒ void
This method returns an undefined value.
Specify the location of the root temporary directory.
Pipelines will store intermediate build artifacts in a subdirectory of this directory.
This defaults to “tmp” in the current working directory.
86 87 88 |
# File 'lib/rake-pipeline/dsl/project_dsl.rb', line 86 def tmpdir(root) project.tmpdir = root end |