diff options
Diffstat (limited to 'stdlib/source/program/aedifex/pom.lux')
-rw-r--r-- | stdlib/source/program/aedifex/pom.lux | 64 |
1 files changed, 32 insertions, 32 deletions
diff --git a/stdlib/source/program/aedifex/pom.lux b/stdlib/source/program/aedifex/pom.lux index c7d950092..d1787d07c 100644 --- a/stdlib/source/program/aedifex/pom.lux +++ b/stdlib/source/program/aedifex/pom.lux @@ -26,11 +26,11 @@ ## https://maven.apache.org/pom.html -(def: project-tag "project") -(def: dependencies-tag "dependencies") -(def: group-tag "groupId") -(def: artifact-tag "artifactId") -(def: version-tag "version") +(def: project_tag "project") +(def: dependencies_tag "dependencies") +(def: group_tag "groupId") +(def: artifact_tag "artifactId") +(def: version_tag "version") (def: #export file "pom.xml") @@ -48,9 +48,9 @@ (def: (artifact value) (-> Artifact (List XML)) - (list (..property ..group-tag (get@ #//artifact.group value)) - (..property ..artifact-tag (get@ #//artifact.name value)) - (..property ..version-tag (get@ #//artifact.version value)))) + (list (..property ..group_tag (get@ #//artifact.group value)) + (..property ..artifact_tag (get@ #//artifact.name value)) + (..property ..version_tag (get@ #//artifact.version value)))) (def: distribution (-> /.Distribution XML) @@ -95,7 +95,7 @@ (..property "url" url)) (#_.Node ["" "organization"] _.attributes))) - (def: (developer-organization [name url]) + (def: (developer_organization [name url]) (-> /.Organization (List XML)) (list (..property "organization" name) (..property "organizationUrl" url))) @@ -104,7 +104,7 @@ (-> /.Developer (List XML)) (list& (..property "name" name) (..property "email" email) - (|> organization (maybe\map ..developer-organization) (maybe.default (list))))) + (|> organization (maybe\map ..developer_organization) (maybe.default (list))))) (template [<name> <type> <tag>] [(def: <name> @@ -118,11 +118,11 @@ (def: (info value) (-> /.Info (List XML)) ($_ list\compose - (|> value (get@ #/.url) (maybe\map (..property "url")) maybe.to-list) - (|> value (get@ #/.description) (maybe\map (..property "description")) maybe.to-list) + (|> value (get@ #/.url) (maybe\map (..property "url")) maybe.to_list) + (|> value (get@ #/.description) (maybe\map (..property "description")) maybe.to_list) (|> value (get@ #/.licenses) (list\map ..license) (..group "licenses") list) - (|> value (get@ #/.scm) (maybe\map ..scm) maybe.to-list) - (|> value (get@ #/.organization) (maybe\map ..organization) maybe.to-list) + (|> value (get@ #/.scm) (maybe\map ..scm) maybe.to_list) + (|> value (get@ #/.organization) (maybe\map ..organization) maybe.to_list) (|> value (get@ #/.developers) (list\map ..developer) (..group "developers") list) (|> value (get@ #/.contributors) (list\map ..contributor) (..group "contributors") list) )) @@ -133,53 +133,53 @@ (case (get@ #/.identity value) (#.Some identity) (#try.Success - (#_.Node ["" ..project-tag] _.attributes + (#_.Node ["" ..project_tag] _.attributes ($_ list\compose (list ..version) (..artifact identity) - (|> value (get@ #/.repositories) set.to-list (list\map ..repository) (..group "repositories") list) - (|> value (get@ #/.dependencies) set.to-list (list\map ..dependency) (..group ..dependencies-tag) list) + (|> value (get@ #/.repositories) set.to_list (list\map ..repository) (..group "repositories") list) + (|> value (get@ #/.dependencies) set.to_list (list\map ..dependency) (..group ..dependencies_tag) list) ))) _ - (exception.throw /.no-identity []))) + (exception.throw /.no_identity []))) -(def: parse-property +(def: parse_property (Parser [Tag Text]) (<>.and <xml>.tag (<xml>.children <xml>.text))) -(def: parse-dependency +(def: parse_dependency (Parser Dependency) (do {! <>.monad} - [properties (\ ! map (dictionary.from-list name.hash) - (<xml>.children (<>.some ..parse-property)))] + [properties (\ ! map (dictionary.from_list name.hash) + (<xml>.children (<>.some ..parse_property)))] (<| <>.lift - try.from-maybe + try.from_maybe (do maybe.monad - [group (dictionary.get ["" ..group-tag] properties) - artifact (dictionary.get ["" ..artifact-tag] properties) - version (dictionary.get ["" ..version-tag] properties)] + [group (dictionary.get ["" ..group_tag] properties) + artifact (dictionary.get ["" ..artifact_tag] properties) + version (dictionary.get ["" ..version_tag] properties)] (wrap {#//dependency.artifact {#//artifact.group group #//artifact.name artifact #//artifact.version version} #//dependency.type (|> properties (dictionary.get ["" "type"]) - (maybe.default //artifact/type.lux-library))}))))) + (maybe.default //artifact/type.lux_library))}))))) -(def: parse-dependencies +(def: parse_dependencies (Parser (List Dependency)) (do {! <>.monad} - [_ (<xml>.node ["" ..dependencies-tag])] - (<xml>.children (<>.some ..parse-dependency)))) + [_ (<xml>.node ["" ..dependencies_tag])] + (<xml>.children (<>.some ..parse_dependency)))) (def: #export parser (Parser /.Profile) (do {! <>.monad} - [_ (<xml>.node ["" ..project-tag])] + [_ (<xml>.node ["" ..project_tag])] (<xml>.children (do ! - [dependencies (<xml>.somewhere ..parse-dependencies) + [dependencies (<xml>.somewhere ..parse_dependencies) _ (<>.some <xml>.ignore)] (wrap (|> (\ /.monoid identity) (update@ #/.dependencies (function (_ empty) |