Class: YuiMinifier
- Inherits:
-
CdnFu::Minifier
- Object
- CdnFu::Minifier
- YuiMinifier
- Defined in:
- lib/cdn_fu/minifiers/yui_minifier.rb
Instance Method Summary collapse
-
#minify(file_list) ⇒ Object
Essentially iterate through through the files and if minify is specified call it.
-
#validate ⇒ Object
Custom validate method ensures that the jar specified will actually work.
Methods inherited from CdnFu::Minifier
#attribute_validate, optional_attributes, required_attributes, #validate_and_minify
Instance Method Details
#minify(file_list) ⇒ Object
Essentially iterate through through the files and if minify is specified call it.
5 6 7 8 9 |
# File 'lib/cdn_fu/minifiers/yui_minifier.rb', line 5 def minify(file_list) file_list.each do |cf_file| one_minification(cf_file) if cf_file.minify? end end |
#validate ⇒ Object
Custom validate method ensures that the jar specified will actually work.
12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/cdn_fu/minifiers/yui_minifier.rb', line 12 def validate if @yui_jar_path if File.exists?(@yui_jar_path) output = `java -jar #{@yui_jar_path} 2>&1` if output !~ /java -jar yuicompressor-x\.y\.z\.jar/ raise CdnFu::ConfigError,"Invalid YUI Compressor jar specified in cdn_fu.rb" end else raise CdnFu::ConfigError,"YUI Compressor jar specified in cdn_fu.rb does not exist" end else raise CdnFu::ConfigError,"You must specify a yui_jar_path for YUI Compressor" end end |