获取rails应用程序中URLS的完整列表

Lau*_*ung 8 url ruby-on-rails listings

如何获得我的rails应用程序可以生成的所有URL的完整列表?

我不希望我获得的路由形成rake路由,而是希望获得与我的应用程序中所有动态生成的页面相对应的actul URL ...

这甚至可能吗?

(背景:我这样做是因为我想要一个完整的URL列表,用于我想做的一些负载测试,它必须覆盖整个应用程序的广度)

kch*_*kch 10

我能够使用以下命令生成有用的输出:

$ wget --spider -r -nv -nd -np http://localhost:3209/ 2>&1 | ack -o '(?<=URL:)\S+'
http://localhost:3209/
http://localhost:3209/robots.txt
http://localhost:3209/agenda/2008/08
http://localhost:3209/agenda/2008/10
http://localhost:3209/agenda/2008/09/01
http://localhost:3209/agenda/2008/09/02
http://localhost:3209/agenda/2008/09/03
^C
Run Code Online (Sandbox Code Playgroud)

wget参数的快速参考:

# --spider                  don't download anything.
# -r,  --recursive          specify recursive download.
# -nv, --no-verbose         turn off verboseness, without being quiet.
# -nd, --no-directories     don't create directories.
# -np, --no-parent          don't ascend to the parent directory.
Run Code Online (Sandbox Code Playgroud)

关于 ack

ack就像grep使用正则perl表达式,它更完整/更强大.

-o告诉ack我只输出匹配的子字符串,我使用的模式查找前面的任何非空格'URL:'