aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex.lux
diff options
context:
space:
mode:
authorEduardo Julian2020-08-17 21:34:07 -0400
committerEduardo Julian2020-08-17 21:34:07 -0400
commitc9e452617dc14dfe9955dc556640bc07f319224a (patch)
treeaf413cad2aa2ea793b72dab971ed91ff8079b068 /stdlib/source/program/aedifex.lux
parentbea5913a915a0bfd795f9e12b40f1d32716a6cf8 (diff)
Add local repo installation to Aedifex.
Diffstat (limited to '')
-rw-r--r--stdlib/source/program/aedifex.lux48
1 files changed, 33 insertions, 15 deletions
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:)]
["<c>" 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) (<c>.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)))))))