class Accesslint::Ci::Scanner
Attributes
host[R]
options[R]
Public Class Methods
new(host:, options: {})
click to toggle source
# File lib/accesslint/ci/scanner.rb, line 13 def initialize(host:, options: {}) @host = host @options = options end
perform(*args)
click to toggle source
# File lib/accesslint/ci/scanner.rb, line 9 def self.perform(*args) new(*args).perform end
Public Instance Methods
perform()
click to toggle source
# File lib/accesslint/ci/scanner.rb, line 18 def perform create_log_file `#{crawl_site}` File.read(LOG_FILE) end
Private Instance Methods
acceptable_file_types()
click to toggle source
# File lib/accesslint/ci/scanner.rb, line 57 def acceptable_file_types %w( css html ).join(",") end
crawl_site()
click to toggle source
# File lib/accesslint/ci/scanner.rb, line 38 def crawl_site <<-SHELL (log_dir=$PWD && cd /tmp && wget #{host} 2>&1 \ --accept #{acceptable_file_types} \ --delete-after \ --no-directories \ --recursive \ -erobots=off \ | grep '^--' \ | awk '{ print $3 }' \ | grep -v '.css' \ | grep -v '.txt' \ | sort \ | uniq \ | xargs -n1 -P10 -t accesslint \ >> $log_dir/#{LOG_FILE}) SHELL end
create_log_file()
click to toggle source
# File lib/accesslint/ci/scanner.rb, line 30 def create_log_file FileUtils::mkdir_p("tmp") if File.exists?(LOG_FILE) FileUtils::rm(LOG_FILE) end end