Aryll is a simple library to check for the well-being of URLs. It supports HTTPS and IDN URIs.
Add this line to your application's Gemfile:
gem 'aryll'
And then execute:
$ bundle
Or install it yourself as:
$ gem install aryll
It will check any object that responds to url
:
status = Aryll.check!(my_url)
unless status.ok?
puts status
end
You can ignore 301 permanent redirect that only add a trailing slash like this:
status = Aryll::LinkChecker.check!(url, ignore_trailing_slash_redirects: true)
unless status.ok?
# A redirect from http://example.com/foo to http://example.com/foo/ will be considered ok
end
The following keys are used to translate error messages using the I18n gem:
kauperts.link_checker.errors.timeout
: message when rescueing from Timeout::Errorkauperts.link_checker.errors.generic_network
: message when (currently) rescueing from all other exceptions
Aryll is extracted from a maintenance task made for berlin.kauperts.de by kaupert media gmbh.
Aryll is released under a 3-clause BSD-licence. See the LICENSE file for details.