(.module: [lux #* [abstract [monad (#+ do)]] [control ["." exception (#+ exception:)] [concurrency ["." promise ("#@." monad)]]] [data [binary (#+ Binary)] [text ["%" format (#+ format)] ["." encoding]] [collection ["." dictionary (#+ Dictionary)] ["." set]] [format ["." binary] ["." tar] ["." xml]]] [world ["." file]]] [program [compositor ["." export]]] ["." /// #_ ["/" profile (#+ Profile)] ["//" upload (#+ User Password)] ["#." action (#+ Action)] ["#." command (#+ Command)] ["#." dependency] ["#." pom] ["#." hash]]) (exception: #export (cannot-find-repository {repository Text} {options (Dictionary Text ///dependency.Repository)}) (exception.report ["Repository" (%.text repository)] ["Options" (exception.enumerate (function (_ [name repo]) (format (%.text name) " := " (%.text repo))) (dictionary.entries options))])) (def: #export (do! repository user password profile) (-> Text User Password (Command Any)) (case [(get@ #/.identity profile) (dictionary.get repository (get@ #/.deploy-repositories profile))] [#.None _] (promise@wrap (exception.throw /.no-identity [])) [_ #.None] (promise@wrap (exception.throw ..cannot-find-repository [repository (get@ #/.deploy-repositories profile)])) [(#.Some identity) (#.Some repository)] (let [deploy! (: (-> ///dependency.Type Binary (Action Any)) (function (_ type content) (promise.future (//.upload repository user password {#///dependency.artifact identity #///dependency.type type} content))))] (do {@ ///action.monad} [library (:: @ map (binary.run tar.writer) (export.library (file.async file.system) (set.to-list (get@ #/.sources profile)))) pom (promise@wrap (///pom.project profile)) _ (deploy! ///dependency.pom (|> pom (:: xml.codec encode) encoding.to-utf8)) _ (deploy! ///dependency.lux-library library) _ (deploy! "sha1" (///hash.sha1 library)) _ (deploy! "md5" (///hash.md5 library))] (wrap [])))))