-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add routes rake task to display annotated routes #68
base: master
Are you sure you want to change the base?
Conversation
routes
rake task to display annotated routes@app.plugin :route_list | ||
routes = @app.route_list | ||
|
||
# determine the max lengths of our output strings so we can display a nice list of routes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This part (including the width method) is inspired by ActionDispatch:: Routing:: ConsoleFormatter
and I wonder if it's worth moving this out to something like that, though I doubt this code will need to be reused in a different context yet.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is fine to leave inline now until we need to use it in a 2nd place 👍
Nice work getting this in place, @dNitza! Solving this has been something that's been nagging at me for a while (look at the timestamp on #5!). I remember trying roda-route_list way back in the day and feeling dissatisfied with how it had to use a file to store its data. I felt like this would let things get out of sync. But I guess Jeremy Evans has probably thought this through a little more than me and since this plugin exists, we should actually commit to trying it for a while 😄 If we're going to do this, then I think there are a few other things we should handle:
Then, as a bonus, something like this would be nice:
|
Oh neat! Yeah the file thing was a bit weird to me too which is why I didn't look into |
This PR adds in a rake task to render out a list of annotated routes using roda-route_list.
The task itself currently does a number of things and I have left it as a single procedure so we can discuss what is happening without having to look in multiple places.
Example annotation:
# route[optional_name]: GET|POST /segment/:param
Example output: