0 | module Pack.Database.TOML
2 | import Data.SortedMap
3 | import Idris.Package.Types
4 | import Libraries.Utils.Path
6 | import Pack.Core.TOML
7 | import Pack.Core.Types
8 | import Pack.Database.Types
13 | FromTOML MetaCommit where fromTOML = tmap fromString
15 | git : FromTOML c => File Abs -> TomlValue -> Either TOMLErr (Package_ c)
19 | (valAt "commit" f v)
21 | (optValAt "packagePath" f False v)
22 | (maybeValAt "test" f v)
23 | (maybeValAt "notice" f v)
26 | local : File Abs -> TomlValue -> Either TOMLErr (Package_ c)
31 | (optValAt "packagePath" f False v)
32 | (maybeValAt "test" f v)
35 | package : FromTOML c => File Abs -> TomlValue -> Either TOMLErr (Package_ c)
36 | package f v = valAt {a = String} "type" f v >>=
40 | "local" => local f v
41 | _ => Left $
WrongType ["type"] "Package Type"
44 | FromTOML c => FromTOML (Package_ c) where fromTOML = package
49 | idrisRepo = "https://github.com/idris-lang/Idris2.git"
52 | v0 = MkPkgVersion (0:::[0,0])
55 | FromTOML MetaDB where
58 | (optValAt "idris2.url" f idrisRepo v)
59 | (valAt "idris2.commit" f v)
61 | (optValAt "db" f empty v)