From c9e452617dc14dfe9955dc556640bc07f319224a Mon Sep 17 00:00:00 2001 From: Eduardo Julian Date: Mon, 17 Aug 2020 21:34:07 -0400 Subject: Add local repo installation to Aedifex. --- stdlib/source/program/aedifex.lux | 48 +++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 15 deletions(-) (limited to 'stdlib/source/program/aedifex.lux') diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux index fd269f71f..6909704dd 100644 --- a/stdlib/source/program/aedifex.lux +++ b/stdlib/source/program/aedifex.lux @@ -10,7 +10,9 @@ ["." cli (#+ program:)] ["" code]] [security - ["!" capability]]] + ["!" capability]] + [concurrency + ["." promise]]] [data [binary (#+ Binary)] ["." text @@ -28,7 +30,9 @@ ["." / #_ ["#" project] ["#." parser] - ["#." pom]]) + ["#." pom] + ["#." cli] + ["#." local]]) (def: (read-file! path) (-> Path (IO (Try Binary))) @@ -67,22 +71,36 @@ [..read-code] [(list) (.run /parser.project)]))) -(program: [project-file] +(program: [{command /cli.command}] (do {@ io.monad} - [data (..read-file! project-file)] + [data (..read-file! /.file)] (case data (#try.Success data) (case (..project data) - (#try.Success value) - (do @ - [outcome (..write-pom! /pom.file value)] - (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))))) + (#try.Success project) + (case command + #/cli.POM + (do @ + [outcome (..write-pom! /pom.file project)] + (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))))) + + #/cli.Install + (exec (do promise.monad + [outcome (/local.install (file.async file.system) project)] + (wrap (case outcome + (#try.Success _) + (log! "Successfully installed locally!") + + (#try.Failure error) + (log! (format "Could not install locally:" text.new-line + error))))) + (wrap []))) (#try.Failure error) (wrap (log! (format "Invalid format file:" text.new-line @@ -90,4 +108,4 @@ (#try.Failure error) (wrap (log! (format "Could not read file: " - (%.text project-file))))))) + (%.text /.file))))))) -- cgit v1.2.3