-
Notifications
You must be signed in to change notification settings - Fork 50
Markdown docs from source files #9
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
base: master
Are you sure you want to change the base?
Conversation
Wow this is amazing, thank you! |
This is great! Good work... Okay so to get things working I had to:
going to work some more on it tomorrow. do you want to commit? |
@matteodepalo That makes sense, I'll refactor it.
|
i am using ENV='test' a couple of things to note…
let me know if there’s anything you would like me to test. |
|
For 2) I'd like to see it as an option. Keeping separate files helps readability and caching. |
in_comment = false | ||
comment_lines = [] | ||
|
||
File.open(File.join(folder, file_name.pluralize.underscore + '_controller.rb'), 'r').each do |line| |
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.
There is an issue with this because if you put your controllers into a separate folder, for example app/controllers/api
it blows up.
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.
That's what the Configuration is for.
However, I'll be happy with a better way to determine the file location. One option is to take it from the described_class
if the spec is written as
describe Api::ArenasController do
...
end
which would work for the controller (action) docs. Not sure how to leverage this for models although they are usually all in one folder even if you have multiple api versions.
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.
Good point, didn't notice that config option.
I don't think there is a need to be smarter about determining the location since in request specs you usually write describe 'Arenas Requests'
instead of specifying the controller class.
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.
Well, about Arenas Requests
... I changed it to read as Group Arena
since that's what is then generated into the blueprint and I'm not sure ... Requests
is a rspec (community) standard.
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.
Yeah in any case it's usually strings.
Anyone still interested in this? I'd love to see this become reality. |
We're actively using it internally (latest changes at https://github.com/chute/rspec_api_blueprint/tree/feat/markdown-docs). Will try to find some time probably next weekend to refactor the code a finish the PR. |
I was going to pull and rebase this, but it's going to be tough because the PR has no tests :( |
I started writing some tests on my branch, let me review and push them. |
I just started using this gem, I see the dates of this comment is this gem still being maintained? |
@ChrisCPO Not very much maintained although it's still being used. You can pull the latest from https://github.com/chute/rspec_api_blueprint/tree/feat/markdown-docs but it comes with no warranty ;) |
Still WIP, opening the PR for feedback on design changes I made for the sake of clarity/simplification.
Also would like to add tests before merging (currently have them almost working locally).