Skip to content

Commit

Permalink
realized that the zip option is unnecessary.
Browse files Browse the repository at this point in the history
  • Loading branch information
nevrome committed Feb 11, 2025
1 parent c992bd9 commit 8183ab1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
4 changes: 2 additions & 2 deletions src/Poseidon/CLI/OptparseApplicativeParsers.hs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ parseArchiveConfigCLI = ArchiveConfig <$> OP.some parseArchiveSpec
in case parts of
[name, fp] -> do
let fps = splitOn "," fp
return $ ArchiveSpec name fps Nothing Nothing Nothing False
return $ ArchiveSpec name fps Nothing Nothing Nothing
_ -> Left $ "could not parse archive and base directory " ++ str ++
". Please use format name=path1,path2,... "

Check warning on line 834 in src/Poseidon/CLI/OptparseApplicativeParsers.hs

View check run for this annotation

Codecov / codecov/patch

src/Poseidon/CLI/OptparseApplicativeParsers.hs#L830-L834

Added lines #L830 - L834 were not covered by tests

Expand All @@ -839,7 +839,7 @@ parseArchiveConfigPath = OP.strOption (
OP.metavar "FILE" <>
OP.help "Path to a .yml config file for the server archive configuration. \

Check warning on line 840 in src/Poseidon/CLI/OptparseApplicativeParsers.hs

View check run for this annotation

Codecov / codecov/patch

src/Poseidon/CLI/OptparseApplicativeParsers.hs#L837-L840

Added lines #L837 - L840 were not covered by tests
\This file must include a list of \"archives:\", each with the fields\
\ \"name\", \"paths\", \"description\", \"URL\", \"dataURL\", and \"zip\"."
\ \"name\", \"paths\", \"description\", \"URL\" and \"dataURL\"."
)

parseMaybeArchiveName :: OP.Parser (Maybe String)
Expand Down
6 changes: 2 additions & 4 deletions src/Poseidon/CLI/Serve.hs
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ data ArchiveSpec = ArchiveSpec
, _archSpecDescription :: Maybe String
, _archSpecURL :: Maybe String
, _archSpecDataURL :: Maybe String
, _archSpecZip :: Bool
} deriving (Show)

Check warning on line 93 in src/Poseidon/CLI/Serve.hs

View check run for this annotation

Codecov / codecov/patch

src/Poseidon/CLI/Serve.hs#L90-L93

Added lines #L90 - L93 were not covered by tests

instance FromJSON ArchiveSpec where
Expand All @@ -100,13 +99,12 @@ instance FromJSON ArchiveSpec where
<*> v .:? "description"
<*> v .:? "URL"
<*> v .:? "dataURL"

Check warning on line 101 in src/Poseidon/CLI/Serve.hs

View check run for this annotation

Codecov / codecov/patch

src/Poseidon/CLI/Serve.hs#L95-L101

Added lines #L95 - L101 were not covered by tests
<*> v .: "zip"

type ZipStore = [(PacNameAndVersion, FilePath)] -- maps PackageName+Version to a zipfile-path

type ArchiveName = String

type ArchiveStore a = [(ArchiveSpec, a)] -- a generic lookup table from an archive name to an item
type ArchiveStore a = [(ArchiveSpec, a)] -- a generic lookup table from an archive specification to an item
-- we have two concrete ones: ArchiveStore [PoseidonPackage] and ArchiveStore ZipStore

getArchiveSpecs :: ArchiveStore a -> [ArchiveSpec]
Expand Down Expand Up @@ -254,7 +252,7 @@ runServer (ServeOptions archBaseDirs maybeZipPath port ignoreChecksums certFiles
archiveName <- captureParam "archive_name"
spec <- getArchiveSpecByName archiveName archiveStore
let maybeArchiveDataURL = _archSpecDataURL spec
archiveZip = _archSpecZip spec
archiveZip = isJust maybeZipPath
latestPacs <- selectLatest <$> getArchiveContentByName archiveName archiveStore
let mapMarkers = concatMap (prepMappable archiveName) latestPacs
archivePage archiveName maybeArchiveDataURL archiveZip mapMarkers latestPacs

Check warning on line 258 in src/Poseidon/CLI/Serve.hs

View check run for this annotation

Codecov / codecov/patch

src/Poseidon/CLI/Serve.hs#L251-L258

Added lines #L251 - L258 were not covered by tests
Expand Down
4 changes: 2 additions & 2 deletions test/PoseidonGoldenTests/GoldenTestsRunCommands.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1207,11 +1207,11 @@ archives = Left $ ArchiveConfig [
"test/testDat/testPackages/ancient/Lamnidis_2018"
, "test/testDat/testPackages/ancient/Lamnidis_2018_newVersion"
, "test/testDat/testPackages/ancient/Wang_2020"
] Nothing Nothing Nothing False
] Nothing Nothing Nothing
, ArchiveSpec "testArchive2" [
"test/testDat/testPackages/ancient/Schiffels_2016"
, "test/testDat/testPackages/ancient/Schmid_2028"
] Nothing Nothing Nothing False
] Nothing Nothing Nothing
]

-- Note: We here use our test server (no SSL and different port). The reason is that
Expand Down

0 comments on commit 8183ab1

Please sign in to comment.