Allow multiple doc paths
This pull request adds the ability to specify multiple doc paths. This is useful when you have multiple groups of documentation generated by RAD, for instance when your API has multiple versions, or both a public and private API.
If the config.doc_path value is a string, then Apitome will function as it always has - by default, it will load docs from doc/api when accessing http://localhost:3000/api/docs. However, config.doc_path can also be set to a Hash with keys that map to group names and values that map to each group's unique RAD doc_path.
For example, with the following configuration:
Apitome.setup do |config|
...
config.doc_path = { default: 'doc/api', v2: 'doc/api/v2', v3: 'doc/api/v3' }
end
The following paths are accessible:
http://localhost:3000/api/docs # this gets docs from ./doc/api
http://localhost:3000/api/docs/v2 # this gets docs from ./doc/api/v2
http://localhost:3000/api/docs/v3 # this gets docs from ./doc/api/v3
To default the "all docs" path to the most recent version of documentation, you could set default to doc/api/v3.
The routes generated for the documentation mirror the additional doc paths that are specified, so rake routes will show all versions specified in the Apitome configuration.
nice!
This would be great to see added, any idea why the build breaks?
Can anyone confirm that this branch is working? I don't have time to look into what's up with CI this weekend.
@jejacks0n something is wrong with travis here. I've merged this PR to my own fork and it works as expected. Running rspec or rake does not give any output, except a warning about SimpleCov.
It would be awesome if you could get this in to apitome. Let me know if I can help out further.
Plans to have this merged?
I'll rebase this and see if maybe the CI passes this time...
The test seems to be failing because the CodeClimate test reporter is deprecated. That's...silly. I'm removing that to see if the specs actually pass, and leave it up to the maintainer to decide if it's okay to merge with the removed test reporter.
Now it looks like there's missing dependencies for the tests...this appears to be an issue in master. I'm getting the feeling that this is an abandoned project, judging by the commit history and pending ignored pull requests. @jejacks0n is this library being maintained?
A bit. I'm using it at the moment, and so might do some things with it. I wasn't using it for a while, and so was leaving it up to the community.
@jejacks0n yeah, I know how it goes. If we can get the tests passing on the master branch, there's a few pending pull requests that the lib could benefit from.
Nice work on this! I would love to see this merged, but it seems things have gone a bit stale around here. Is anyone actively maintaining this repo and servicing PRs? It's easy enough to use other forks, but that's hard to maintain in the long run. @jejacks0n, are you open to servicing PRs like this one or adding contributors who have availability to do so?
I don't have a lot of spare time at the moment, but @jsmartt, you're welcome to jump in and get freshen things up. =) Thanks for the offer, and yeah, sometimes there's time and sometimes there's not -- thanks for understanding.