gpt4 book ai didi

ruby - 使用链接检查器( ruby )

转载 作者:数据小太阳 更新时间:2023-10-29 08:39:14 26 4
gpt4 key购买 nike

有没有人用过link-checker gem

我不想在我想编写一个小脚本来测试 Web 应用程序上的链接的项目中使用它。

我似乎不知道如何使用它。尝试 require 它不起作用,但说 gem 'link-checker' 确实会导致 true。

我在 IRB 中尝试使用它毫无进展。有人可以让我知道我错过了什么吗?

最佳答案

你读过the documentation吗? ?链接检查器一个旨在检查链接的小脚本。

该页面显示了它从命令行运行的示例,而不是从 IRB 或 Ruby 代码内部运行的示例。换句话说,它是一个命令行应用程序,而不是您需要的代码:

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

关于ruby - 使用链接检查器( ruby ),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14901169/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com