From e153b011bb94ba95474505c307873616bb493b6d Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Sat, 24 Oct 2020 21:44:21 -0400 Subject: Changed type-parameters for Mixin types. --- stdlib/source/program/aedifex.lux | 46 ++++++++------------------- stdlib/source/program/aedifex/command/pom.lux | 35 ++++++++++++++++++++ 2 files changed, 48 insertions(+), 33 deletions(-) create mode 100644 stdlib/source/program/aedifex/command/pom.lux (limited to 'stdlib/source/program') 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))) -- cgit v1.2.3