rubylink-checking

Use of link-Checker (ruby)


Has anyone used the link-checker gem?

I don't want to use it in a project I want to write a small script to test links on a web app.

I cant seem to figure out how to use it. Trying to require it doesn't work but saying gem 'link-checker' does result in true.

I'm getting nowhere trying to play with it in IRB. Can someone let me know what I am missing?


Solution

  • Did you read the documentation? Link-checker is a small script designed to check links already.

    That page shows examples of it running from the command-line, not from inside IRB or Ruby code. In other words, it is a command-line app, not code you require:

    Usage:

    Just give it the target that you want it to scan. For example, if you have an Octopress site then your output HTML is in the public directory, so call it with:

    check-links 'public'
    

    Or if you want to check the links on a live site, then give it a URL instead:

    check-links 'http://www.ryanalynporter.com'
    

    If you don’t pass any target, then the default is to scan the “./” directory. If you have a Jekyll site that you deploy to GitHub Pages, then you can check the links with just:

    check-links