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.
You are not logged in. Please login or register.
Rails Forum - Ruby on Rails Help and Discussion Forum » Other Rails Programming » 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.
rake routes >> filename.txt
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?
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.
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.
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)
Hosting provided by aTech Media