Sha256: fce876e6dd512787df556251f3d758a8f1565890ef85b1d74b7023e3f59e9544
Contents?: true
Size: 1.46 KB
Versions: 3
Compression:
Stored size: 1.46 KB
Contents
require 'fileutils' module Headhunter class Runner ASSETS_PATH = 'public/assets' attr_accessor :results def initialize(root) @root = root @temporary_assets = [] precompile_assets! @html_validator = HtmlValidator.new @css_hunter = CssHunter.new(stylesheets) @css_validator = CssValidator.new(stylesheets) end def process(url, html) @html_validator.validate(url, html) @css_hunter.process(url, html) end def clean_up! print "Headhunter is removing precompiled assets...".yellow remove_assets! puts " done!".yellow end def report puts [ @html_validator.statistics, @css_validator.statistics, @css_hunter.statistics ].join "\n\n" puts end private def precompile_assets! print "Headhunter is removing eventually existing assets...".yellow remove_assets! # Remove existing assets! This seems to be necessary to make sure that they don't exist twice, see http://stackoverflow.com/questions/20938891 sleep 1 puts " done!".yellow sleep 1 print "Headhunter is precompiling assets...".yellow system 'rake assets:precompile HEADHUNTER=false &> /dev/null' puts " done!\n".yellow end def remove_assets! FileUtils.rm_r ASSETS_PATH if File.exist?(ASSETS_PATH) end def stylesheets Dir["#{::Rails.root}/#{ASSETS_PATH}/*.css"] end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
headhunter-0.1.7 | lib/headhunter/runner.rb |
headhunter-0.1.6 | lib/headhunter/runner.rb |
headhunter-0.1.5 | lib/headhunter/runner.rb |