Topic: Rake routes output to file?

Is there a way to send rake results to a file? I'd like to do a 'rake routes' from command line and have the output added to a file.

Re: Rake routes output to file?

rake routes >> filename.txt

Re: Rake routes output to file?

LOL, that was fun. I don't know why I would ever need to do that, but I love one line answers. Any idea why this would be necessary?

Re: Rake routes output to file?

I could see it being helpful.  Instead of re-running rake routes each time, assuming the routes haven't changed, you could just open a routes.txt file and see the routes.

Re: Rake routes output to file?

Thanks MusicMan. I find it useful to have a text file with my routes to refer to rather than having to run rake routes every time.

Re: Rake routes output to file?

I set this up to export to a log file. It's not exactly a log, but it seems like a nice place to tuck the file away. I wrote a bash alias 'routelog' to update the file. Just add this line to the beginning of your "~/.profile" file from your favorite command line text editor.

alias routelog='rm ./log/routes.log && rake routes >> ./log/routes.log'

This only works if you are in the main directory of your project. There is probably a better way to do this, but I think this is pretty explicit about what it's doing and I can use it in any project without configuration.

Any suggestions for a cleaner solution?

Last edited by chickenbake (2013-01-01 03:10:12)