Load formulae from their aliases using the API #13871
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #13856
This PR modifies
Formulary
to handle loading formulae from their alias names via the API. Like the non-api method, I've added a separateAliasAPILoader
to handle the additional steps that are necessary when loading from an alias.In order for this to work best, I've added an
all_aliases
method toAPI::Formula
. Since retrieving this information requires going through the entire collection of API formulae (including all of their data) I've linked this toall_formulae
. So calling one of these methods will load both typical formulae and aliases into their respective instance variables, allowing us to cache both at the same time and eliminate the need to go through a second time.Finally, this also fixes the issue @MikeMcQuaid reported in Slack where non-core formulae weren't allowed to build from source when trying to use the API.