Class: SLA::Command
- Inherits:
-
MisterBin::Command
- Object
- MisterBin::Command
- SLA::Command
- Includes:
- Colsole
- Defined in:
- lib/sla/command.rb
Instance Method Summary collapse
Instance Method Details
#execute(url, checker, formatter) ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 |
# 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. unless formatter.success? or ENV['SLA_ALLOW_FAILS'] raise BrokenLinks end end |
#run ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# 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 |