Permalink
Browse files

Use consistent naming for filter classes.

  • Loading branch information...
1 parent bfeaa1b commit 9ea725631e19f257a69b51c1a3bbffd516e48343 @dudleyf dudleyf committed Dec 31, 2011
@@ -10,14 +10,14 @@ module Filters
end
require "rake-pipeline-web-filters/version"
-require "rake-pipeline-web-filters/cache_buster"
+require "rake-pipeline-web-filters/cache_buster_filter"
require "rake-pipeline-web-filters/filter_with_dependencies"
-require "rake-pipeline-web-filters/markdown_compiler"
+require "rake-pipeline-web-filters/markdown_filter"
require "rake-pipeline-web-filters/minispade_filter"
-require "rake-pipeline-web-filters/sass_compiler"
+require "rake-pipeline-web-filters/sass_filter"
require "rake-pipeline-web-filters/tilt_filter"
-require "rake-pipeline-web-filters/coffee_script_compiler"
-require "rake-pipeline-web-filters/yui_javascript_compressor"
-require "rake-pipeline-web-filters/yui_css_compressor"
+require "rake-pipeline-web-filters/coffee_script_filter"
+require "rake-pipeline-web-filters/yui_javascript_filter"
+require "rake-pipeline-web-filters/yui_css_filter"
require "rake-pipeline-web-filters/uglify_filter"
require "rake-pipeline-web-filters/helpers"
@@ -7,9 +7,9 @@ module Rake::Pipeline::Web::Filters
# input "app/assets"
# output "public"
#
- # filter Rake::Pipeline::Web::Filters::CacheBuster
+ # filter Rake::Pipeline::Web::Filters::CacheBusterFilter
# end
- class CacheBuster < Rake::Pipeline::Filter
+ class CacheBusterFilter < Rake::Pipeline::Filter
# @return [Proc] the default cache key generator, which
# takes the MD5 hash of the input's file name and contents.
@@ -1,7 +1,7 @@
module Rake::Pipeline::Web::Filters
# A filter that compiles CoffeeScript to JavaScript.
- class CoffeeScriptCompiler < Rake::Pipeline::Filter
- # By default, the CoffeeScriptCompiler converts inputs
+ class CoffeeScriptFilter < Rake::Pipeline::Filter
+ # By default, the CoffeeScriptFilter converts inputs
# with the extension +.coffee+ to +.js+.
#
# @param [Proc] block the output name generator block
@@ -5,7 +5,7 @@ module Rake::Pipeline::Web::Filters
# Instead of:
# !!!ruby
# match("*.scss") do
- # filter Rake::Pipeline::Web::Filters::SassCompiler, :syntax => :sass
+ # filter Rake::Pipeline::Web::Filters::SassFilter, :syntax => :sass
# end
#
# You can do:
@@ -20,10 +20,10 @@ def minispade(*args, &block)
filter(Rake::Pipeline::Web::Filters::MinispadeFilter, *args, &block)
end
- # Add a new {SassCompiler} to the pipeline.
- # @see SassCompiler#initialize
+ # Add a new {SassFilter} to the pipeline.
+ # @see SassFilter#initialize
def sass(*args, &block)
- filter(Rake::Pipeline::Web::Filters::SassCompiler, *args, &block)
+ filter(Rake::Pipeline::Web::Filters::SassFilter, *args, &block)
end
alias_method :scss, :sass
@@ -33,34 +33,34 @@ def tilt(*args, &block)
filter(Rake::Pipeline::Web::Filters::TiltFilter, *args, &block)
end
- # Add a new {MarkdownCompiler} to the pipeline.
- # @see MarkdownCompiler#initialize
+ # Add a new {MarkdownFilter} to the pipeline.
+ # @see MarkdownFilter#initialize
def markdown(*args, &block)
- filter(Rake::Pipeline::Web::Filters::MarkdownCompiler, *args, &block)
+ filter(Rake::Pipeline::Web::Filters::MarkdownFilter, *args, &block)
end
- # Add a new {CacheBuster} to the pipeline.
- # @see CacheBuster#initialize
+ # Add a new {CacheBusterFilter} to the pipeline.
+ # @see CacheBusterFilter#initialize
def cache_buster(&block)
- filter(Rake::Pipeline::Web::Filters::CacheBuster, &block)
+ filter(Rake::Pipeline::Web::Filters::CacheBusterFilter, &block)
end
- # Add a new {CoffeeScriptCompiler} to the pipeline.
- # @see CoffeeScriptCompiler#initialize
+ # Add a new {CoffeeScriptFilter} to the pipeline.
+ # @see CoffeeScriptFilter#initialize
def coffee_script(&block)
- filter(Rake::Pipeline::Web::Filters::CoffeeScriptCompiler, &block)
+ filter(Rake::Pipeline::Web::Filters::CoffeeScriptFilter, &block)
end
- # Add a new {YUIJavaScriptCompressor} to the pipeline.
- # @see YUIJavaScriptCompressor#initialize
+ # Add a new {YUIJavaScriptFilter} to the pipeline.
+ # @see YUIJavaScriptFilter#initialize
def yui_javascript(*args, &block)
- filter(Rake::Pipeline::Web::Filters::YUIJavaScriptCompressor, *args, &block)
+ filter(Rake::Pipeline::Web::Filters::YUIJavaScriptFilter, *args, &block)
end
- # Add a new {YUICssCompressor} to the pipeline.
- # @see YUICssCompressor#initialize
+ # Add a new {YUICssFilter} to the pipeline.
+ # @see YUICssFilter#initialize
def yui_css(*args, &block)
- filter(Rake::Pipeline::Web::Filters::YUICssCompressor, *args, &block)
+ filter(Rake::Pipeline::Web::Filters::YUICssFilter, *args, &block)
end
# Add a new {UglifyFilter} to the pipeline.
@@ -10,10 +10,10 @@ module Rake::Pipeline::Web::Filters
#
# # Compile each .md file under the app/assets
# # directory.
- # filter Rake::Pipeline::Web::Filters::MarkdownCompiler
+ # filter Rake::Pipeline::Web::Filters::MarkdownFilter
# end
#
- class MarkdownCompiler < Rake::Pipeline::Filter
+ class MarkdownFilter < Rake::Pipeline::Filter
# @param [Hash] options options to pass to the markdown
# compiler
@@ -16,9 +16,9 @@ module Rake::Pipeline::Web::Filters
#
# # Compile each SCSS file under the app/assets
# # directory.
- # filter Rake::Pipeline::Web::Filters::SassCompiler
+ # filter Rake::Pipeline::Web::Filters::SassFilter
# end
- class SassCompiler < Rake::Pipeline::Filter
+ class SassFilter < Rake::Pipeline::Filter
include Rake::Pipeline::Web::Filters::FilterWithDependencies
# @return [Hash] a hash of options to pass to Sass
@@ -14,9 +14,9 @@ module Rake::Pipeline::Web::Filters
#
# # Compress each CSS file under the app/assets
# # directory.
- # filter Rake::Pipeline::Web::Filters::YUICssCompressor
+ # filter Rake::Pipeline::Web::Filters::YUICssFilter
# end
- class YUICssCompressor < Rake::Pipeline::Filter
+ class YUICssFilter < Rake::Pipeline::Filter
include Rake::Pipeline::Web::Filters::FilterWithDependencies
# @return [Hash] a hash of options to pass to the
@@ -14,9 +14,9 @@ module Rake::Pipeline::Web::Filters
#
# # Compress each JS file under the app/assets
# # directory.
- # filter Rake::Pipeline::Web::Filters::YUIJavaScriptCompressor
+ # filter Rake::Pipeline::Web::Filters::YUIJavaScriptFilter
# end
- class YUIJavaScriptCompressor < Rake::Pipeline::Filter
+ class YUIJavaScriptFilter < Rake::Pipeline::Filter
include Rake::Pipeline::Web::Filters::FilterWithDependencies
# @return [Hash] a hash of options to pass to the
@@ -1,7 +1,7 @@
-describe "CacheBuster" do
+describe "CacheBusterFilter" do
MemoryFileWrapper = Rake::Pipeline::SpecHelpers::MemoryFileWrapper
- CacheBuster = Rake::Pipeline::Web::Filters::CacheBuster
+ CacheBusterFilter = Rake::Pipeline::Web::Filters::CacheBusterFilter
let(:content) { "it doesn't matter" }
@@ -23,7 +23,7 @@ def setup_filter(filter)
describe 'DEFAULT_KEY_GENERATOR' do
- subject { CacheBuster::DEFAULT_KEY_GENERATOR }
+ subject { CacheBusterFilter::DEFAULT_KEY_GENERATOR }
it "returns the MD5 hash of the input's file name and contents" do
expected = Digest::MD5.new << input_file.path << content
@@ -35,11 +35,11 @@ def setup_filter(filter)
describe 'with the default cache key strategy' do
let(:output_file) {
- key = CacheBuster::DEFAULT_KEY_GENERATOR.call(input_file)
+ key = CacheBusterFilter::DEFAULT_KEY_GENERATOR.call(input_file)
MemoryFileWrapper.new output_root, "file-#{key}.txt", 'UTF-8'
}
- subject { setup_filter CacheBuster.new }
+ subject { setup_filter CacheBusterFilter.new }
it 'outputs to the MD5 hash of the file name and contents' do
subject.output_files.should == [ output_file ]
@@ -62,7 +62,7 @@ def setup_filter(filter)
}
subject do
- setup_filter(CacheBuster.new() { 'foo' })
+ setup_filter(CacheBusterFilter.new() { 'foo' })
end
it 'uses the custom key strategy' do
@@ -1,5 +1,5 @@
-describe "CoffeeScriptCompiler" do
- CoffeeScriptCompiler = Rake::Pipeline::Web::Filters::CoffeeScriptCompiler
+describe "CoffeeScriptFilter" do
+ CoffeeScriptFilter = Rake::Pipeline::Web::Filters::CoffeeScriptFilter
let(:coffee_input) { <<-COFFEE }
x = 1;
@@ -35,7 +35,7 @@ def setup_filter(filter)
end
it "generates output" do
- filter = setup_filter CoffeeScriptCompiler.new
+ filter = setup_filter CoffeeScriptFilter.new
filter.output_files.should == [output_file("input.js")]
@@ -49,12 +49,12 @@ def setup_filter(filter)
describe "naming output files" do
it "translates .coffee extensions to .js by default" do
- filter = setup_filter CoffeeScriptCompiler.new
+ filter = setup_filter CoffeeScriptFilter.new
filter.output_files.first.path.should == "input.js"
end
it "accepts a block to customize output file names" do
- filter = setup_filter(CoffeeScriptCompiler.new { |input| "octopus" })
+ filter = setup_filter(CoffeeScriptFilter.new { |input| "octopus" })
filter.output_files.first.path.should == "octopus"
end
end
View
@@ -23,7 +23,7 @@ def filter
describe "#sass" do
it "creates a SassCompiler" do
dsl.sass
- filter.should be_kind_of(Rake::Pipeline::Web::Filters::SassCompiler)
+ filter.should be_kind_of(Rake::Pipeline::Web::Filters::SassFilter)
end
end
@@ -37,35 +37,35 @@ def filter
describe "#markdown" do
it "creates a MarkdownCompiler" do
dsl.markdown
- filter.should be_kind_of(Rake::Pipeline::Web::Filters::MarkdownCompiler)
+ filter.should be_kind_of(Rake::Pipeline::Web::Filters::MarkdownFilter)
end
end
describe "#cache_buster" do
it "creates a CacheBuster" do
dsl.cache_buster
- filter.should be_kind_of(Rake::Pipeline::Web::Filters::CacheBuster)
+ filter.should be_kind_of(Rake::Pipeline::Web::Filters::CacheBusterFilter)
end
end
describe "#coffee_script" do
it "creates a CoffeeScriptCompiler" do
dsl.coffee_script
- filter.should be_kind_of(Rake::Pipeline::Web::Filters::CoffeeScriptCompiler)
+ filter.should be_kind_of(Rake::Pipeline::Web::Filters::CoffeeScriptFilter)
end
end
describe "#yui_javascript" do
it "creates a YUIJavaScriptCompressor" do
dsl.yui_javascript
- filter.should be_kind_of(Rake::Pipeline::Web::Filters::YUIJavaScriptCompressor)
+ filter.should be_kind_of(Rake::Pipeline::Web::Filters::YUIJavaScriptFilter)
end
end
describe "#yui_css" do
it "creates a YUICssCompressor" do
dsl.yui_css
- filter.should be_kind_of(Rake::Pipeline::Web::Filters::YUICssCompressor)
+ filter.should be_kind_of(Rake::Pipeline::Web::Filters::YUICssFilter)
end
end
@@ -1,5 +1,5 @@
-describe "MarkdownCompiler" do
- MarkdownCompiler = Rake::Pipeline::Web::Filters::MarkdownCompiler
+describe "MarkdownFilter" do
+ MarkdownFilter = Rake::Pipeline::Web::Filters::MarkdownFilter
let(:markdown_input) { <<-MARKDOWN }
## This is an H2
@@ -39,7 +39,7 @@ def setup_filter(filter)
end
it "generates output" do
- filter = setup_filter MarkdownCompiler.new
+ filter = setup_filter MarkdownFilter.new
filter.output_files.should == [output_file("page.html")]
@@ -53,18 +53,18 @@ def setup_filter(filter)
describe "naming output files" do
it "translates .md extensions to .html by default" do
- filter = setup_filter MarkdownCompiler.new
+ filter = setup_filter MarkdownFilter.new
filter.output_files.first.path.should == "page.html"
end
it "accepts a block to customize output file names" do
- filter = setup_filter(MarkdownCompiler.new { |input| "octopus" })
+ filter = setup_filter(MarkdownFilter.new { |input| "octopus" })
filter.output_files.first.path.should == "octopus"
end
end
it "passes options to the Markdown compiler" do
- filter = setup_filter(MarkdownCompiler.new(:autolink => true))
+ filter = setup_filter(MarkdownFilter.new(:autolink => true))
filter.input_files = [input_file("page.md", markdown_input)]
tasks = filter.generate_rake_tasks
tasks.each(&:invoke)
@@ -73,7 +73,7 @@ def setup_filter(filter)
end
it "accepts a :compiler option" do
- filter = setup_filter(MarkdownCompiler.new(:compiler => proc { |text, options| text }))
+ filter = setup_filter(MarkdownFilter.new(:compiler => proc { |text, options| text }))
filter.input_files = [input_file("page.md", markdown_input)]
tasks = filter.generate_rake_tasks
tasks.each(&:invoke)
@@ -1,5 +1,5 @@
-describe "SassCompiler" do
- SassCompiler = Rake::Pipeline::Web::Filters::SassCompiler
+describe "SassFilter" do
+ SassFilter = Rake::Pipeline::Web::Filters::SassFilter
let(:scss_input) { <<-SCSS }
$blue: #3bbfce;
@@ -40,7 +40,7 @@ def setup_filter(filter)
end
it "generates output" do
- filter = setup_filter SassCompiler.new
+ filter = setup_filter SassFilter.new
filter.output_files.should == [output_file("border.css")]
@@ -54,18 +54,18 @@ def setup_filter(filter)
describe "naming output files" do
it "translates .scss extensions to .css by default" do
- filter = setup_filter SassCompiler.new
+ filter = setup_filter SassFilter.new
filter.output_files.first.path.should == "border.css"
end
it "accepts a block to customize output file names" do
- filter = setup_filter(SassCompiler.new { |input| "octopus" })
+ filter = setup_filter(SassFilter.new { |input| "octopus" })
filter.output_files.first.path.should == "octopus"
end
end
it "accepts options to pass to the Sass compiler" do
- filter = setup_filter(SassCompiler.new(:syntax => :sass))
+ filter = setup_filter(SassFilter.new(:syntax => :sass))
filter.input_files = [input_file("border.sass_file", sass_input)]
tasks = filter.generate_rake_tasks
tasks.each(&:invoke)
@@ -74,7 +74,7 @@ def setup_filter(filter)
end
it "compiles files with a .sass extension as sass" do
- filter = setup_filter(SassCompiler.new)
+ filter = setup_filter(SassFilter.new)
filter.input_files = [input_file("border.sass", sass_input)]
tasks = filter.generate_rake_tasks
tasks.each(&:invoke)
@@ -87,7 +87,7 @@ def setup_filter(filter)
c.preferred_syntax = :sass
end
- filter = setup_filter(SassCompiler.new)
+ filter = setup_filter(SassFilter.new)
filter.input_files = [input_file("border.css", scss_input)]
tasks = filter.generate_rake_tasks
tasks.each(&:invoke)
Oops, something went wrong.

0 comments on commit 9ea7256

Please sign in to comment.