Class: Blueprint::Validator
- Inherits:
-
Object
- Object
- Blueprint::Validator
- Defined in:
- lib/template/css/blueprint/lib/blueprint/validator.rb
Overview
Validates generated CSS against the W3 using Java
Instance Attribute Summary collapse
-
#error_count ⇒ Object
readonly
Returns the value of attribute error_count.
Instance Method Summary collapse
-
#initialize ⇒ Validator
constructor
A new instance of Validator.
-
#validate ⇒ Object
Validates all three CSS files.
Constructor Details
#initialize ⇒ Validator
Returns a new instance of Validator.
6 7 8 |
# File 'lib/template/css/blueprint/lib/blueprint/validator.rb', line 6 def initialize @error_count = 0 end |
Instance Attribute Details
#error_count ⇒ Object (readonly)
Returns the value of attribute error_count.
4 5 6 |
# File 'lib/template/css/blueprint/lib/blueprint/validator.rb', line 4 def error_count @error_count end |
Instance Method Details
#validate ⇒ Object
Validates all three CSS files
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/template/css/blueprint/lib/blueprint/validator.rb', line 11 def validate java_path = `which java`.rstrip raise "You do not have a Java installed, but it is required." if java_path.blank? output_header Blueprint::CSS_FILES.keys.each do |file_name| css_output_path = File.join(Blueprint::BLUEPRINT_ROOT_PATH, file_name) puts "\n\n Testing #{css_output_path}" puts " Output ============================================================\n\n" @error_count += 1 if !system("#{java_path} -jar '#{Blueprint::VALIDATOR_FILE}' -e '#{css_output_path}'") end end |