(.module: [lux (#- Name) [abstract [monad (#+ do)]] [control [pipe (#+ do>)] ["." try (#+ Try)] ["." io (#+ IO)] [parser ["." cli (#+ program:)] ["" code]] [security ["!" capability]] [concurrency ["." promise (#+ Promise)]]] [data [binary (#+ Binary)] ["." text ["%" format (#+ format)] ["." encoding]] [format ["." xml]] [collection ["." set]]] [tool [compiler [language [lux ["." syntax]]]]] [world ["." file (#+ Path)]]] ["." / #_ [action (#+ Action)] ["#" profile] ["#." project (#+ Project)] ["#." input] ["#." parser] ["#." pom] ["#." cli] ["#." cache] ["#." dependency #_ ["#" resolution]] ["#." command ["#/." clean] ["#/." pom] ["#/." install] ["#/." build] ["#/." test] ["#/." auto] ["#/." deploy]]]) (def: (fetch-dependencies! profile) (-> /.Profile (Promise Any)) (do promise.monad [outcome (do (try.with promise.monad) [cache (/cache.read-all (file.async file.default) (set.to-list (get@ #/.dependencies profile)) /dependency.empty) resolution (promise.future (/dependency.resolve-all (set.to-list (get@ #/.repositories profile)) (set.to-list (get@ #/.dependencies profile)) cache))] (/cache.write-all (file.async file.default) resolution))] (wrap (case outcome (#try.Success _) (log! "Successfully resolved dependencies!") (#try.Failure error) (log! (format "Could not resolve dependencies:" text.new-line error)))))) (program: [{[profile operation] /cli.command}] (do {! io.monad} [?profile (/input.read io.monad file.default profile)] (case ?profile (#try.Success profile) (case operation #/cli.Clean (exec (/command/clean.do! (file.async file.default) profile) (wrap [])) #/cli.POM (exec (/command/pom.do! (file.async file.default) profile) (wrap [])) #/cli.Dependencies (exec (..fetch-dependencies! profile) (wrap [])) #/cli.Install (exec (/command/install.do! (file.async file.default) profile) (wrap [])) (#/cli.Deploy repository user password) (exec (/command/deploy.do! repository user password profile) (wrap [])) (#/cli.Compilation compilation) (case compilation #/cli.Build (exec (/command/build.do! profile) (wrap [])) #/cli.Test (exec (/command/test.do! profile) (wrap []))) (#/cli.Auto auto) (exec (case auto #/cli.Build (/command/auto.do! /command/build.do! profile) #/cli.Test (/command/auto.do! /command/test.do! profile)) (wrap []))) (#try.Failure error) (wrap (log! error)))))