Skip to content

Commit

Permalink
Merge pull request #148 from pjf/114_bugtracker
Browse files Browse the repository at this point in the history
Added resources.bugtracker to CKAN.Module.
  • Loading branch information
AlexanderDzhoganov committed Oct 24, 2014
2 parents fce3329 + 8eacade commit 6d92cde
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 5 deletions.
5 changes: 5 additions & 0 deletions CKAN.schema
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@
"type" : "string",
"format" : "uri"
},
"bugtracker" : {
"description" : "Mod bugtracker",
"type" : "string",
"format" : "uri"
},
"github" : {
"description" : "Project on github",
"type" : "object",
Expand Down
5 changes: 3 additions & 2 deletions CKAN/CKAN/Module.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public class BundledModuleDescriptor : InstallableDescriptor
public class GitHubResourceDescriptor
{
public bool releases;
public string url;
public Uri url;
}

public class KerbalStuffResourceDescriptor
Expand All @@ -45,7 +45,8 @@ public class KerbalStuffResourceDescriptor
public class ResourcesDescriptor
{
public GitHubResourceDescriptor github;
public string homepage;
public Uri homepage;
public Uri bugtracker;

public KerbalStuffResourceDescriptor kerbalstuff;
}
Expand Down
4 changes: 2 additions & 2 deletions CKAN/GUI/MainModInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ private void UpdateModInfo(CkanModule module)
if (module.resources != null && module.resources.homepage != null)
{
Util.Invoke(MetadataModuleHomePageLinkLabel,
() => MetadataModuleHomePageLinkLabel.Text = module.resources.homepage);
() => MetadataModuleHomePageLinkLabel.Text = module.resources.homepage.ToString());
}

if (module.resources != null && module.resources.github != null && module.resources.github.url != null)
{
Util.Invoke(MetadataModuleGitHubLinkLabel,
() => MetadataModuleGitHubLinkLabel.Text = module.resources.github.url);
() => MetadataModuleGitHubLinkLabel.Text = module.resources.github.url.ToString());
}

Util.Invoke(MetadataModuleReleaseStatusLabel, () => MetadataModuleReleaseStatusLabel.Text = module.release_status);
Expand Down
9 changes: 9 additions & 0 deletions CKAN/Tests/CKAN/Module.cs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@ public void StandardName()
Assert.AreEqual(module.StandardName(), "kOS-0.14.zip");
}

[Test]
public void MetaData()
{
CkanModule module = CkanModule.FromJson (TestData.kOS_014 ());

// TODO: Test all the metadata here!
Assert.AreEqual("https://github.com/KSP-KOS/KOS/issues", module.resources.bugtracker.ToString());
}

}
}

1 change: 1 addition & 0 deletions CKAN/Tests/TestData.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public static string kOS_014()
""resources"" : {
""homepage"" : ""http://forum.kerbalspaceprogram.com/threads/68089-0-23-kOS-Scriptable-Autopilot-System-v0-11-2-13"",
""manual"" : ""http://ksp-kos.github.io/KOS_DOC/"",
""bugtracker"": ""https://github.com/KSP-KOS/KOS/issues"",
""github"" : {
""url"" : ""https://github.com/KSP-KOS/KOS"",
""releases"" : true
Expand Down
4 changes: 3 additions & 1 deletion Spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ for its installation or indexing. Presently the following fields
are described:

- `homepage` is a URL that goes to the preferred landing page for the mod.
- `bugtracker` is a URL that goes to the mod's bugtracker if it exists.
- `github` is an object which *must* contain a `url` pointing to the
github page for the project. It *may* include a `releases` key
with a boolean value (which defaults to false) indicating if github releases
Expand All @@ -381,7 +382,8 @@ are described:
Example resources:

"resources" : {
"homepage" : "http://tinyurl.com/DogeCoinFlag",
"homepage" : "http://tinyurl.com/DogeCoinFlag",
"bugtracker" : "https://github.com/pjf/DogeCoinFlag/issues",
"github" : {
"url" : "http://github.com/pjf/DogeCoinFlag",
"releases" : "true"
Expand Down

0 comments on commit 6d92cde

Please sign in to comment.