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
#run ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/sla/command.rb', line 42 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 run! url, checker, formatter end |
#run!(url, checker, formatter) ⇒ Object
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/sla/command.rb', line 66 def run!(url, checker, formatter) initial_page = Page.new url checker.check initial_page do |action, page| formatter.handle action, page sleep ENV['SLA_SLEEP'].to_f if ENV['SLA_SLEEP'] end formatter. return if formatter.success? || ENV['SLA_ALLOW_FAILS'] raise BrokenLinks end |