Class: Rake::Pipeline::Matcher

Inherits:
Rake::Pipeline show all
Defined in:
lib/rake-pipeline/matcher.rb

Overview

A Matcher is a type of pipeline that restricts its filters to a particular pattern.

A Matcher’s pattern is a File glob.

For instance, to restrict filters to operating on JavaScript files in the app directory, the Matcher’s inputs should include “app”, and its glob would be “*.js”.

In general, you should not use Matcher directly. Instead use DSL#match in the block passed to build.

Direct Known Subclasses

RejectMatcher

Constant Summary

Constants inherited from Rake::Pipeline

VERSION

Instance Attribute Summary collapse

Attributes inherited from Rake::Pipeline

#filters, #input_files, #inputs, #output_root, #project, #rake_tasks, #tmpdir

Instance Method Summary collapse

Methods inherited from Rake::Pipeline

#add_filters, #add_input, build, #build, #copy, #fingerprint, #initialize, #invoke, #last_manifest, #manifest, #rake_application, #rake_application=, #setup, #setup_filters

Constructor Details

This class inherits a constructor from Rake::Pipeline

Instance Attribute Details

#globObject

Returns the value of attribute glob.



18
19
20
# File 'lib/rake-pipeline/matcher.rb', line 18

def glob
  @glob
end

#pipelineRake::Pipeline

Returns the Rake::Pipeline that contains this matcher.

Returns:



22
23
24
# File 'lib/rake-pipeline/matcher.rb', line 22

def pipeline
  @pipeline
end

Instance Method Details

#finalizevoid

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Override Rake::Pipeline#finalize to do nothing. We want to pass on our unmatched inputs to the next part of the pipeline.



57
58
# File 'lib/rake-pipeline/matcher.rb', line 57

def finalize
end

#output_filesArray<FileWrapper>

A list of the output files that invoking this pipeline will generate. This will include the outputs of files matching the glob and any inputs that did not match the glob.

This will make those inputs available to any additional filters or matchers.

Returns:



46
47
48
49
50
# File 'lib/rake-pipeline/matcher.rb', line 46

def output_files
  super + input_files.reject do |file|
    file.path =~ @pattern
  end
end