-
Notifications
You must be signed in to change notification settings - Fork 414
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
Config file #310
Config file #310
Conversation
Paths specified from cmd line are relative to working dir. Paths specified in a config file are relative to the file’s parent dir.
Also split the confusing create-and-apply-side-effects PodspecDocumenter.configure method into two
Perusing my open PRs, I noticed the CI failure on this one. The failure is due to the command line now showing “jam out to your fresh new docs in [absolute path]” instead of “…docs in [relative path].” That probably makes more sense, given that the config can now specify a surprising output path. However, I could update the code to print the output path relative to the working directory if the former is underneath the latter. |
@pcantrell relative path for child directories would be preferable imho |
Some of its warnings were fair, but on the whole, I do not think this commit improves the code.
I definitely share your disdain for rubocop, @pcantrell and have occasionally made changes to |
Any thoughts on this one? Were you waiting for me to tweak Rubocop? |
Wow, I finally read through your original comment and through the code, very nice work Paul! Extremely thorough explanation of your choices along the way too. I'm not too concerned about any of the points of consideration you brought up. They're mostly all existing issues rather than new problems introduced by this change. This should be documented in the readme and added to the changelog. Otherwise, implementation-wise this looks quite nice! Some tests using a config file rather than command line arguments would be appreciated too. I think just modifying the MiscJazzyFeatures integration test to use a config file rather than the arguments would be sufficient. |
Thanks! Glad it looks all right. Sorry if the thorough explanation was too thorough, but I wanted to get all those thoughts down before they wandered out of my head and off to the magical land of Important Things Paul Forgot. Happy to add some docs, a changelog note, and tests. You could just add Siesta to your regression suite, since it now uses the config file (off my fork), but modifying MiscJazzyFeatures seems easy enough! |
@pcantrell you have access to the integration specs repo, actually. |
I’ve added a note in the readme (which points to the newly extensive command-line help) and the changelog. I adjusted the Rubocop rules to suit my taste, but feel free to veto any of those changes. I’ll wait to marge/rebase and to update the integration specs until #326 is merged, since I’ll have to redo them at that point anyway. |
I updated the integration specs by moving the command-line options for misc_jazzy_features into a config file. While I was at it, I added custom categories to misc_jazzy_features, because it seems like that should be tested (and can be, now that there’s a config file). AFAIK, this one is now ready to merge. |
This is awesome, @pcantrell! There are merge conflicts now (certainly because of #338), but those should hopefully be easy to resolve. |
Merged, and I’m getting massive spec failures on some of the spec projects (though others build just fine). Errors look like this:
I’m investigating, but that error message ring a bell for anyone else? |
Figured it out. Just a matter of the integration specs submodule getting out of sync during my merge. I think this is once again ready to merge — and I do hope we can merge it soon, because keeping this branch up to date is getting quite unwieldy! |
👍 woohoo 🎉 |
💃🏻🎂🍻🎤 … though I’m sure that years from now, I’ll look back wistfully on the halcyon days of keeping this branch up to date. Maybe. |
I know it's not always pleasant, or trivial, to keep your PRs up to date, but I really appreciate the work you put in!! |
And likewise. Maintaining a project (OSS or not) is a lot of work. Everyone wants to ride the horses, but nobody wants to clean the stables! |
I've been using the Maybe I overlooked something, otherwise I at least would be very pleased if you could add it in some future release. |
Here's the jazzy config file we discussed in #281. Brain dump follows.
I considered the simple approach of manually copying values out of a config file one at a time. However, this leads to a lot of redundant enumeration of option names in code already suffering from that problem, which would doubtless cause name synchronization headaches in the future.
I thus opted (←intentional pun) instead for a generalized config structure that unifies command line options, config file options, default values, and Ruby attribute declarations. (Much more DRY, but feel free to call overkill on that.)
Notes on the approach:
.jazzy.yaml
file in the source directory, or any of its ancestors. You can override that with the--config
command line option.--version
and--help
. Options can be config file only. This is now the case withcustom_categories
; the separate categories file is gone.Jazzy::Config
, not the command line options. (I thought they read better in that context, but could be convinced otherwise.)foo
accessor inJazzy::Config
now has a correspondingfoo_configured
to indicate whether it was explicitly specified in config, or merely contains a default value.jazzy --help config
to get help on all configuration options. You can also search for specific options, e.g.jazzy --help author
Array(...)
in this code. So there, Paul!Here’s what the resulting config file looks like.
Things to consider:
Jazzy::Config
attr accessors — and I left them all as is. Since those names are being promoted from implementation detail to public configuration, it’s probably worth taking a pass to review them for clarity & consistency.excluded_files
to be resolved relative tosource_directory
. I’m concerned this would be confusing, since it’s an exception; however, theexcluded_files
attribute is more or less useless in a config file if the file isn’t in fixed relation to the project directory (which happens if the docs are in a separate branch or repo).excluded_files
should probably support globs.podspec
option is confusing. Jazzy detects and uses values from a podspec with the default name; however, it only does the special podspec-based build if the podspec is explicitly specified, even if there’s one present with the default naming. (Do I have that right?) This option is currently undocumented, and needs documenting from somebody who understands it (i.e. not me).--source-directory A
command line option can point jazzy to a.jazzy.yaml
file inA
which then overridessource_directory
toB
. In that situation, jazzy would ignoreB/.jazzy.yaml
, because the config file’s location has already been resolved. I’d say that’s esoteric enough that we can live with it?OK, that about covers it. Let me know what you think when you get a chance.