Skip to content
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

Handle KSP-AVC krefs #2517

Merged
merged 1 commit into from
Oct 12, 2018
Merged

Conversation

HebaruSan
Copy link
Member

@HebaruSan HebaruSan commented Aug 26, 2018

Motivation

ExtraPlanetaryLaunchpads's netkan currently uses a $kref property with a hard coded URL. This means that we have to update the netkan manually every time there's a new release.

This mod has a publicly hosted remote .version file at http://taniwha.org/~bill/EL.version

The KSP-AVC spec says:

  • DOWNLOAD - Optional
    Web address where the latest version can be downloaded.
    This is only used from the remote version file.

In principle this should let us pick up new versions automatically, but currently that functionality doesn't exist.

Changes

Now Netkan will support this format:

    "$kref": "#/ckan/ksp-avc/http://taniwha.org/~bill/EL.version",

The Id part of the $kref gives a URL to check for a .version file, which contains a DOWNLOAD property that points to the latest version of the mod.

To accomplish this, a new AvcKrefTransformer class is added (the awkward name is because there's already an AvcTransformer which handles $vref, which needs to remain separate and is called too late to handle a $kref properly). The remaining AVC properties are added to AvcVersion, and used by the new transformer to set metadata properties. Setting the download property allows the remaining transformers to download the file and index it.

To set version and ksp_version / _min / _max, AvcTransformer's logic for this is split out into a public static function for sharing.

In testing, the above $kref generated a .ckan file for ExtraPlanetaryLaunchpads 6.0.0 that exactly matches the one already in the index.

Fixes #286. Fixes #1765.

@HebaruSan HebaruSan added Enhancement New features or functionality Pull request Netkan Issues affecting the netkan data labels Aug 26, 2018
@politas
Copy link
Member

politas commented Oct 7, 2018

#2516 is merged - Can you update Netkan/Validators/KrefValidator.cs in this and also add an update to Spec.md for the new valid $kref? Actually, while you're updating Spec.md, the Curse Kref info is out of date, too, isn't it?

@HebaruSan HebaruSan force-pushed the feature/ksp-avc-krefs branch from c31e7c4 to 9d75a52 Compare October 7, 2018 03:23
@HebaruSan
Copy link
Member Author

Thanks for the reminder, updated the validator and the spec.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement New features or functionality Netkan Issues affecting the netkan data
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants