diff options
Diffstat (limited to '')
-rw-r--r-- | stdlib/source/program/aedifex.lux | 46 | ||||
-rw-r--r-- | stdlib/source/program/aedifex/command/pom.lux | 35 |
2 files changed, 48 insertions, 33 deletions
diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index f23ac26da..327eb8902 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -39,11 +39,12 @@ ["#." local] ["#." dependency #_ ["#" resolution]] - [command - ["#." build] - ["#." test] - ["#." auto] - ["#." deploy]]]) + ["#." command + ["#/." pom] + ["#/." build] + ["#/." test] + ["#/." auto] + ["#/." deploy]]]) (def: (read-file! path) (-> Path (IO (Try Binary))) @@ -65,28 +66,6 @@ (#.Right [end lux-code]) (#try.Success lux-code)))) -(def: (write-pom!' path profile) - (-> Path /.Profile (IO (Try Any))) - (do (try.with io.monad) - [file (!.use (:: file.system file) [path]) - pom (:: io.monad wrap (/pom.write profile))] - (|> pom - (:: xml.codec encode) - encoding.to-utf8 - (!.use (:: file over-write))))) - -(def: (write-pom! profile) - (-> /.Profile (IO Any)) - (do io.monad - [outcome (write-pom!' /pom.file profile)] - (case outcome - (#try.Success value) - (wrap (log! "Successfully wrote POM file!")) - - (#try.Failure error) - (wrap (log! (format "Could not write POM file:" text.new-line - error)))))) - (def: (install! profile) (-> /.Profile (Promise Any)) (do promise.monad @@ -137,7 +116,8 @@ (#try.Success profile) (case operation #/cli.POM - (..write-pom! profile) + (exec (/command/pom.do! (file.async file.system) profile) + (wrap [])) #/cli.Dependencies (exec (..fetch-dependencies! profile) @@ -148,20 +128,20 @@ (wrap [])) (#/cli.Deploy repository user password) - (exec (/deploy.do! repository user password profile) + (exec (/command/deploy.do! repository user password profile) (wrap [])) (#/cli.Compilation compilation) (case compilation - #/cli.Build (exec (/build.do! profile) + #/cli.Build (exec (/command/build.do! profile) (wrap [])) - #/cli.Test (exec (/test.do! profile) + #/cli.Test (exec (/command/test.do! profile) (wrap []))) (#/cli.Auto auto) (exec (case auto - #/cli.Build (/auto.do! /build.do! profile) - #/cli.Test (/auto.do! /test.do! profile)) + #/cli.Build (/command/auto.do! /command/build.do! profile) + #/cli.Test (/command/auto.do! /command/test.do! profile)) (wrap []))) (#try.Failure error) diff --git a/stdlib/source/program/aedifex/command/pom.lux b/stdlib/source/program/aedifex/command/pom.lux new file mode 100644 index 000000000..f493092a5 --- /dev/null +++ b/stdlib/source/program/aedifex/command/pom.lux @@ -0,0 +1,35 @@ +(.module: + [lux #* + [abstract + [monad (#+ do)]] + [control + ["." try (#+ Try)] + [security + ["!" capability]] + [concurrency + ["." promise (#+ Promise) ("#@." monad)]]] + [data + ["." text + ["%" format (#+ format)] + ["." encoding]] + [format + ["." xml]]] + [world + ["." file (#+ Path File)]]] + ["." /// #_ + [command (#+ Command)] + ["#." action (#+ Action)] + ["#." pom]]) + +(def: #export (do! fs profile) + (-> (file.System Promise) (Command Path)) + (do ///action.monad + [pom (promise@wrap (///pom.write profile)) + file (: (Promise (Try (File Promise))) + (file.get-file promise.monad fs ///pom.file)) + outcome (|> pom + (:: xml.codec encode) + encoding.to-utf8 + (!.use (:: file over-write))) + #let [_ (log! "Successfully wrote POM file!")]] + (wrap ///pom.file))) |