Skip to content

Commit

Permalink
Merge remote-tracking branch 'Olympic1/Curse'
Browse files Browse the repository at this point in the history
Merge pull request #1897 Add Curse to Resources
Add changelog entry for #1893
  • Loading branch information
politas committed Sep 15, 2016
2 parents c6eab79 + 769a511 commit 5361c58
Show file tree
Hide file tree
Showing 10 changed files with 74 additions and 15 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ All notable changes to this project will be documented in this file.

## Unreleased

### Bugfixes
- [GUI] Reduce MinimumSize for main window to 1280x700 (#1893 by: politas; reviewed: Postremus, techman83, ayan4m1, Olympic1)

### Features
- [Multiple] Add Curse to resources (#1897 by: Olympic1; reviewed: ayan4m1, politas)

## v1.20.0

### Bugfixes
Expand Down
11 changes: 10 additions & 1 deletion CKAN.schema
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@
"type" : "string",
"format" : "uri"
},
"curse" : {
"description" : "Project on Curse",
"type" : "string",
"format" : "uri"
},
"manual" : {
"description" : "Mod's manual",
"type" : "string",
Expand Down Expand Up @@ -325,7 +330,10 @@
"description" : "A license.",
"enum" : [
"public-domain",
"AFL-3.0",
"AGPL-3.0",
"Apache", "Apache-1.0", "Apache-2.0",
"APSL-2.0",
"Artistic", "Artistic-1.0", "Artistic-2.0",
"BSD-2-clause", "BSD-3-clause", "BSD-4-clause",
"ISC",
Expand All @@ -343,7 +351,8 @@
"GFDL-1.0", "GFDL-1.1", "GFDL-1.2", "GFDL-1.3",
"GFDL-NIV-1.0", "GFDL-NIV-1.1", "GFDL-NIV-1.2", "GFDL-NIV-1.3",
"LPPL-1.0", "LPPL-1.1", "LPPL-1.2", "LPPL-1.3c",
"MPL-1.1",
"MPL-1.0", "MPL-1.1",
"Ms-PL", "Ms-RL",
"Perl",
"Python-2.0",
"QPL-1.0",
Expand Down
2 changes: 2 additions & 0 deletions Cmdline/Action/Show.cs
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ public int ShowMod(CkanModule module)
user.RaiseMessage("- spacedock: {0}", Uri.EscapeUriString(module.resources.spacedock.ToString()));
if (module.resources.repository != null)
user.RaiseMessage("- repository: {0}", Uri.EscapeUriString(module.resources.repository.ToString()));
if (module.resources.curse != null)
user.RaiseMessage("- curse: {0}", Uri.EscapeUriString(module.resources.curse.ToString()));
}

// Compute the CKAN filename.
Expand Down
16 changes: 14 additions & 2 deletions Core/Exporters/DelimeterSeperatedValueExporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ public void Export(IRegistryQuerier registry, Stream stream)
"repository",
"homepage",
"bugtracker",
"spacedock"
"spacedock",
"curse"
);

foreach (var mod in registry.InstalledModules.OrderBy(i => i.Module.name))
Expand All @@ -74,7 +75,8 @@ public void Export(IRegistryQuerier registry, Stream stream)
WriteRepository(mod.Module.resources),
WriteHomepage(mod.Module.resources),
WriteBugtracker(mod.Module.resources),
WriteSpaceDock(mod.Module.resources)
WriteSpaceDock(mod.Module.resources),
WriteCurse(mod.Module.resources)
);
}
}
Expand Down Expand Up @@ -125,6 +127,16 @@ private string WriteSpaceDock(ResourcesDescriptor resources)
return string.Empty;
}

private string WriteCurse(ResourcesDescriptor resources)
{
if (resources != null && resources.curse != null)
{
return QuoteIfNecessary(resources.curse.ToString());
}

return string.Empty;
}

private string QuoteIfNecessary(string value)
{
if (value != null && value.IndexOf(_delimter, StringComparison.Ordinal) >= 0)
Expand Down
3 changes: 3 additions & 0 deletions Core/Types/CkanModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public class ResourcesDescriptor

[JsonConverter(typeof(JsonOldResourceUrlConverter))]
public Uri spacedock;

[JsonConverter(typeof(JsonOldResourceUrlConverter))]
public Uri curse;
}

public class DownloadHashesDescriptor
Expand Down
6 changes: 5 additions & 1 deletion GUI/GUIMod.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ public GUIMod(CkanModule mod, IRegistryQuerier registry, KspVersion current_ksp_

Abstract = mod.@abstract;

// If we have homepage provided use that, otherwise use the spacedock page or the github repo so that users have somewhere to get more info than just the abstract.
// If we have a homepage provided, use that; otherwise use the spacedock page, curse page or the github repo so that users have somewhere to get more info than just the abstract.

Homepage = "N/A";
if (mod.resources != null)
Expand All @@ -144,6 +144,10 @@ public GUIMod(CkanModule mod, IRegistryQuerier registry, KspVersion current_ksp_
{
Homepage = mod.resources.spacedock.ToString();
}
else if (mod.resources.curse != null)
{
Homepage = mod.resources.curse.ToString();
}
else if (mod.resources.repository != null)
{
Homepage = mod.resources.repository.ToString();
Expand Down
2 changes: 1 addition & 1 deletion GUI/MainModInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private void UpdateModInfo(GUIMod gui_module)
Util.Invoke(MetadataModuleAbstractLabel, () => MetadataModuleAbstractLabel.Text = module.@abstract);
Util.Invoke(MetadataIdentifierLabel, () => MetadataIdentifierLabel.Text = module.identifier);

// If we have homepage provided use that, otherwise use the spacedock page or the github repo so that users have somewhere to get more info than just the abstract.
// If we have a homepage provided, use that; otherwise use the spacedock page, curse page or the github repo so that users have somewhere to get more info than just the abstract.
Util.Invoke(MetadataModuleHomePageLinkLabel,
() => MetadataModuleHomePageLinkLabel.Text = gui_module.Homepage.ToString());

Expand Down
2 changes: 1 addition & 1 deletion Netkan/Transformers/AvcTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ public Metadata Transform(Metadata metadata)
{
// In practice, the version specified in .version files tends to be unreliable, with authors
// forgetting to update it when new versions are released. Therefore if we have a version
// specified from another source such as SpaceDock or a GitHub tag, don't overwrite it.
// specified from another source such as SpaceDock, curse or a GitHub tag, don't overwrite it.
json.SafeAdd("version", avc.version.ToString());
}

Expand Down
11 changes: 6 additions & 5 deletions Netkan/Transformers/PropertySortTransformer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,12 @@ internal sealed class PropertySortTransformer : ITransformer
{
{ "homepage", 0 },
{ "spacedock", 1 },
{ "repository", 2 },
{ "bugtracker", 3 },
{ "ci", 4 },
{ "license", 5 },
{ "manual", 6 }
{ "curse", 2 },
{ "repository", 3 },
{ "bugtracker", 4 },
{ "ci", 5 },
{ "license", 6 },
{ "manual", 7 }
};

public string Name { get { return "property_sort"; } }
Expand Down
30 changes: 26 additions & 4 deletions Spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ reference CKAN client that will read this file.
For compatibility with pre-release clients, and the v1.0 client, the special
*integer* `1` should be used.

This document describes the CKAN specification 'v1.16'. Changes since spec `1`
are marked with **v1.2** through to **v1.16** respectively. For maximum
This document describes the CKAN specification 'v1.20'. Changes since spec `1`
are marked with **v1.2** through to **v1.20** respectively. For maximum
compatibility, using older spec versions is preferred when newer features are
not required.

Expand Down Expand Up @@ -451,16 +451,18 @@ are described. Unless specified otherwise, these are URLs:
- `repository` : The repository where the module source can be found.
- `ci` : (**v1.6**) Continuous Integration (e.g. Jenkins) Server where the module is being built. `x_ci` is an alias used in netkan.
- `spacedock` : The mod on SpaceDock.
- `curse` : (**v1.20**) The mod on Curse.
- `manual` : The mod's manual, if it exists.

Example resources:

"resources" : {
"homepage" : "http://tinyurl.com/DogeCoinFlag",
"homepage" : "https://tinyurl.com/DogeCoinFlag",
"bugtracker" : "https://github.com/pjf/DogeCoinFlag/issues",
"repository" : "http://github.com/pjf/DogeCoinFlag",
"repository" : "https://github.com/pjf/DogeCoinFlag",
"ci" : "https://ksp.sarbian.com/jenkins/DogecoinFlag"
"spacedock" : "https://spacedock.info/mod/269/Dogecoin%20Flag"
"curse" : "https://kerbal.curseforge.com/projects/220221"
}

While all currently defined resources are all URLs, future revisions of the spec may provide for more complex types.
Expand Down Expand Up @@ -577,13 +579,32 @@ When used, the following fields will be auto-filled if not already present:
- `resources.x_screenshot`
- `ksp_version`

###### `#/ckan/curse/:cid`

Indicates that data should be fetched from Curse, using the `:cid` provided. For example: `#/ckan/curse/220221`.

When used, the following fields will be auto-filled if not already present:

- `name`
- `license`
- `author`
- `version`
- `download`
- `download_size`
- `download_hash`
- `download_content_type`
- `resources.curse`
- `ksp_version`

###### `#/ckan/github/:user/:repo[/asset_match/:filter_regexp]`

Indicates that data should be fetched from GitHub, using the `:user` and `:repo` provided.
For example: `#/ckan/github/pjf/DogeCoinFlag`.

When used, the following fields will be auto-filled if not already present:

- `name`
- `abstract`
- `author`
- `version`
- `download`
Expand Down Expand Up @@ -805,6 +826,7 @@ The possible values of `before` and `after` are:
- `optimus_prime`
- `property_sort`
- `spacedock`
- `curse`
- `strip_netkan_metadata`
- `version_edit`
- `versioned_override`
Expand Down

0 comments on commit 5361c58

Please sign in to comment.