diff --git a/PackageStagingArea.sln b/PackageStagingArea.sln
index ef496b8..2cb9c71 100644
--- a/PackageStagingArea.sln
+++ b/PackageStagingArea.sln
@@ -7,6 +7,8 @@ Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "AVPRIndex", "src\AVPRIndex\
EndProject
Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "StagingAreaTests", "StagingAreaTests\StagingAreaTests.fsproj", "{510A5F69-72CD-4CBB-95BF-04E716585488}"
EndProject
+Project("{6EC3EE1D-3C4E-46DD-8F32-0CC8E7565705}") = "IndexTests", "tests\IndexTests\IndexTests.fsproj", "{FA7524A5-3A92-4E33-8E28-726BA2E615D2}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
{510A5F69-72CD-4CBB-95BF-04E716585488}.Debug|Any CPU.Build.0 = Debug|Any CPU
{510A5F69-72CD-4CBB-95BF-04E716585488}.Release|Any CPU.ActiveCfg = Release|Any CPU
{510A5F69-72CD-4CBB-95BF-04E716585488}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FA7524A5-3A92-4E33-8E28-726BA2E615D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FA7524A5-3A92-4E33-8E28-726BA2E615D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FA7524A5-3A92-4E33-8E28-726BA2E615D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FA7524A5-3A92-4E33-8E28-726BA2E615D2}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/StagingAreaTests/StagingAreaTests.fsproj b/StagingAreaTests/StagingAreaTests.fsproj
index 8190076..bc4c359 100644
--- a/StagingAreaTests/StagingAreaTests.fsproj
+++ b/StagingAreaTests/StagingAreaTests.fsproj
@@ -9,6 +9,7 @@
+
@@ -18,6 +19,8 @@
+
+
diff --git a/StagingAreaTests/Utils.fs b/StagingAreaTests/Utils.fs
index f045413..4be820d 100644
--- a/StagingAreaTests/Utils.fs
+++ b/StagingAreaTests/Utils.fs
@@ -29,11 +29,11 @@ type Assert with
//test wether all required fields are present
Assert.NotNull(m)
Assert.NotNull(m.Name)
- Assert.NotEmpty(m.Name)
+ Assert.NotEqual(m.Name, "")
Assert.NotNull(m.Summary)
- Assert.NotEmpty(m.Summary)
+ Assert.NotEqual(m.Summary, "")
Assert.NotNull(m.Description)
- Assert.NotEmpty(m.Description)
+ Assert.NotEqual(m.Description, "")
Assert.NotNull(m.MajorVersion)
Assert.True(m.MajorVersion >= 0)
Assert.NotNull(m.MinorVersion)
diff --git a/StagingAreaTests/playground.fsx b/StagingAreaTests/playground.fsx
new file mode 100644
index 0000000..f5874d0
--- /dev/null
+++ b/StagingAreaTests/playground.fsx
@@ -0,0 +1,34 @@
+#r "nuget: YamlDotNet, 15.1.2"
+#r "../src/AVPRIndex/bin/Debug/net8.0/AVPRIndex.dll"
+
+open AVPRIndex
+open AVPRIndex.Domain
+open AVPRIndex.Frontmatter
+open YamlDotNet.Serialization
+
+open System
+open System.IO
+open System.Text
+
+let yamlDeserializer =
+ DeserializerBuilder()
+ .WithNamingConvention(NamingConventions.PascalCaseNamingConvention.Instance)
+ .Build()
+
+let p = @"C:\Users\schne\source\repos\nfdi4plants\arc-validate-package-registry\src\PackageRegistryService\StagingArea\pride\pride@1.0.0.fsx"
+
+ValidationPackageMetadata.extractFromScript(p)
+
+let f = File.ReadAllText(p).ReplaceLineEndings()
+
+f.ReplaceLineEndings().StartsWith(Frontmatter.frontMatterStart)
+
+f.ReplaceLineEndings().Contains(Frontmatter.frontMatterEnd)
+
+let fm =
+ f.Substring(
+ frontMatterStart.Length,
+ (f.IndexOf(Frontmatter.frontMatterEnd, StringComparison.Ordinal) - frontMatterEnd.Length)
+ )
+
+yamlDeserializer.Deserialize(fm)
\ No newline at end of file
diff --git a/src/AVPRIndex/AVPRIndex.fsproj b/src/AVPRIndex/AVPRIndex.fsproj
index 3942a66..1fb8828 100644
--- a/src/AVPRIndex/AVPRIndex.fsproj
+++ b/src/AVPRIndex/AVPRIndex.fsproj
@@ -16,7 +16,7 @@
git
$([System.IO.File]::ReadAllText("$(MSBuildProjectDirectory)/RELEASE_NOTES.md"))
README.md
- 0.0.3
+ 0.0.4
diff --git a/src/AVPRIndex/Domain.fs b/src/AVPRIndex/Domain.fs
index 0a707b0..cfb2416 100644
--- a/src/AVPRIndex/Domain.fs
+++ b/src/AVPRIndex/Domain.fs
@@ -104,9 +104,9 @@ module Domain =
member val Name = "" with get,set
member val Summary = "" with get,set
member val Description = "" with get,set
- member val MajorVersion = 0 with get,set
- member val MinorVersion = 0 with get,set
- member val PatchVersion = 0 with get,set
+ member val MajorVersion = -1 with get,set
+ member val MinorVersion = -1 with get,set
+ member val PatchVersion = -1 with get,set
// optional fields
member val Publish = false with get,set
member val Authors: Author [] = Array.empty with get,set
diff --git a/src/AVPRIndex/Frontmatter.fs b/src/AVPRIndex/Frontmatter.fs
index 900677e..8c9d278 100644
--- a/src/AVPRIndex/Frontmatter.fs
+++ b/src/AVPRIndex/Frontmatter.fs
@@ -20,7 +20,7 @@ module Frontmatter =
type ValidationPackageMetadata with
static member extractFromScript (scriptPath: string) =
- let script = File.ReadAllText(scriptPath)
+ let script = File.ReadAllText(scriptPath).ReplaceLineEndings()
if script.StartsWith(frontMatterStart, StringComparison.Ordinal) && script.Contains(frontMatterEnd) then
let frontmatter =
script.Substring(
@@ -32,6 +32,7 @@ module Frontmatter =
result
with e as exn ->
printfn $"error parsing package metadata at {scriptPath}. Make sure that all required metadata tags are included."
+ printfn $"Error msg: {e.Message}."
ValidationPackageMetadata()
else
printfn $"script at {scriptPath} has no correctly formatted frontmatter."
diff --git a/src/AVPRIndex/RELEASE_NOTES.md b/src/AVPRIndex/RELEASE_NOTES.md
index 50e4ce0..af033dd 100644
--- a/src/AVPRIndex/RELEASE_NOTES.md
+++ b/src/AVPRIndex/RELEASE_NOTES.md
@@ -1,3 +1,7 @@
+## v0.0.4
+
+- Replace line endings when parsing frontmatter
+
## v0.0.3
- Add create function to Author and OntologyAnnotation (https://github.com/nfdi4plants/arc-validate-package-registry/pull/27)