(.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] ["#." local] ["#." dependency #_ ["#" resolution]] ["#." command ["#/." pom] ["#/." build] ["#/." test] ["#/." auto] ["#/." deploy]]]) (def: (install! profile) (-> /.Profile (Promise Any)) (do promise.monad [outcome (/local.install (file.async file.default) profile)] (wrap (case outcome (#try.Success _) (log! "Successfully installed locally!") (#try.Failure error) (log! (format "Could not install locally:" text.new-line error)))))) (def: (fetch-dependencies! profile) (-> /.Profile (Promise Any)) (do promise.monad [outcome (do (try.with promise.monad) [cache (/local.all-cached (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))] (/local.cache-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.POM (exec (/command/pom.do! (file.async file.default) profile) (wrap [])) #/cli.Dependencies (exec (..fetch-dependencies! profile) (wrap [])) #/cli.Install (exec (..install! 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)))))