class SLA::Command
Public Instance Methods
execute(url, checker, formatter)
click to toggle source
# File lib/sla/command.rb, line 56 def execute(url, checker, formatter) page = Page.new url checker.check page do |action, page| success = formatter.handle action, page sleep ENV['SLA_SLEEP'].to_f if ENV['SLA_SLEEP'] end formatter.footer unless formatter.success? or ENV['SLA_ALLOW_FAILS'] raise BrokenLinks end end
run()
click to toggle source
# File lib/sla/command.rb, line 32 def run WebCache.life = args['--cache'] WebCache.dir = args['--cache-dir'] if args['--cache-dir'] max_depth = args['--depth'].to_i url = args['URL'] ignore = args['--ignore'] ignore = ignore.split " " if ignore check_external = args['--external'] checker = Checker.new max_depth: max_depth, ignore: ignore, check_external: check_external formatter = if args['--verbose'] Formatters::Verbose.new elsif args['--simple'] Formatters::Simple.new else Formatters::TTY.new end execute url, checker, formatter end