comparison vext.sml @ 1721:bf8a5ce8fb62 vext

Update vext; providers -> services
author Chris Cannam
date Wed, 28 Jun 2017 13:20:05 +0100
parents 434be2f0509e
children b97b2b7af50c
comparison
equal deleted inserted replaced
1720:3505d9536367 1721:bf8a5ce8fb62
31 Particular Programs Ltd shall not be used in advertising or 31 Particular Programs Ltd shall not be used in advertising or
32 otherwise to promote the sale, use or other dealings in this 32 otherwise to promote the sale, use or other dealings in this
33 Software without prior written authorization. 33 Software without prior written authorization.
34 *) 34 *)
35 35
36 val vext_version = "0.9.1" 36 val vext_version = "0.9.2"
37 37
38 38
39 datatype vcs = 39 datatype vcs =
40 HG | 40 HG |
41 GIT 41 GIT
42 42
43 datatype source = 43 datatype source =
44 URL of string | 44 URL_SOURCE of string |
45 PROVIDER of { 45 SERVICE_SOURCE of {
46 service : string, 46 service : string,
47 owner : string option, 47 owner : string option,
48 repo : string option 48 repo : string option
49 } 49 }
50 50
984 anon = lookup_optional_string pjson ["anon"], 984 anon = lookup_optional_string pjson ["anon"],
985 auth = lookup_optional_string pjson ["auth"] 985 auth = lookup_optional_string pjson ["auth"]
986 } 986 }
987 } 987 }
988 val loaded = 988 val loaded =
989 case lookup_optional json ["providers"] of 989 case lookup_optional json ["services"] of
990 NONE => [] 990 NONE => []
991 | SOME (Json.OBJECT pl) => map (fn (k, v) => load v k) pl 991 | SOME (Json.OBJECT pl) => map (fn (k, v) => load v k) pl
992 | _ => raise Fail "Object expected for providers in config" 992 | _ => raise Fail "Object expected for services in config"
993 val newly_loaded = 993 val newly_loaded =
994 List.filter (fn p => not (List.exists (fn pp => #service p = 994 List.filter (fn p => not (List.exists (fn pp => #service p =
995 #service pp) 995 #service pp)
996 previously_loaded)) 996 previously_loaded))
997 loaded 997 loaded
1067 SOME { login, ... } => SOME login 1067 SOME { login, ... } => SOME login
1068 | NONE => NONE 1068 | NONE => NONE
1069 1069
1070 fun remote_url (context : context) vcs source libname = 1070 fun remote_url (context : context) vcs source libname =
1071 case source of 1071 case source of
1072 URL u => u 1072 URL_SOURCE u => u
1073 | PROVIDER { service, owner, repo } => 1073 | SERVICE_SOURCE { service, owner, repo } =>
1074 provider_url { vcs = vcs, 1074 provider_url { vcs = vcs,
1075 service = service, 1075 service = service,
1076 owner = owner, 1076 owner = owner,
1077 repo = case repo of 1077 repo = case repo of
1078 SOME r => r 1078 SOME r => r
1385 "hg" => HG 1385 "hg" => HG
1386 | "git" => GIT 1386 | "git" => GIT
1387 | other => raise Fail ("Unknown version-control system \"" ^ 1387 | other => raise Fail ("Unknown version-control system \"" ^
1388 other ^ "\""), 1388 other ^ "\""),
1389 source = case (url, service, owner, repo) of 1389 source = case (url, service, owner, repo) of
1390 (SOME u, NONE, _, _) => URL u 1390 (SOME u, NONE, _, _) => URL_SOURCE u
1391 | (NONE, SOME ss, owner, repo) => 1391 | (NONE, SOME ss, owner, repo) =>
1392 PROVIDER { service = ss, owner = owner, repo = repo } 1392 SERVICE_SOURCE { service = ss, owner = owner, repo = repo }
1393 | _ => raise Fail ("Must have exactly one of service " ^ 1393 | _ => raise Fail ("Must have exactly one of service " ^
1394 "or url string"), 1394 "or url string"),
1395 pin = case lock_pin of 1395 pin = case lock_pin of
1396 SOME p => PINNED p 1396 SOME p => PINNED p
1397 | NONE => 1397 | NONE =>