aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex
diff options
context:
space:
mode:
authorEduardo Julian2020-10-31 20:26:37 -0400
committerEduardo Julian2020-10-31 20:26:37 -0400
commit69272f598d831e89da83bdc8c9290d5607dfb14d (patch)
tree4915f241708344209d4c35ccdc8b8e57bab68e4c /stdlib/source/program/aedifex
parenteea741e9b4a47ae09832311d6d61f0bd6024f673 (diff)
Re-named the directory for my bookmarks to better reflect what they are.
Diffstat (limited to '')
-rw-r--r--stdlib/source/program/aedifex.lux15
-rw-r--r--stdlib/source/program/aedifex/command/install.lux62
-rw-r--r--stdlib/source/program/aedifex/local.lux18
-rw-r--r--stdlib/source/program/aedifex/shell.lux19
4 files changed, 73 insertions, 41 deletions
diff --git a/stdlib/source/program/aedifex.lux b/stdlib/source/program/aedifex.lux
index d8d855bd0..f3f222d90 100644
--- a/stdlib/source/program/aedifex.lux
+++ b/stdlib/source/program/aedifex.lux
@@ -42,23 +42,12 @@
["#" resolution]]
["#." command
["#/." pom]
+ ["#/." install]
["#/." 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
@@ -95,7 +84,7 @@
(wrap []))
#/cli.Install
- (exec (..install! profile)
+ (exec (/command/install.do! (file.async file.default) profile)
(wrap []))
(#/cli.Deploy repository user password)
diff --git a/stdlib/source/program/aedifex/command/install.lux b/stdlib/source/program/aedifex/command/install.lux
new file mode 100644
index 000000000..818283cc5
--- /dev/null
+++ b/stdlib/source/program/aedifex/command/install.lux
@@ -0,0 +1,62 @@
+(.module:
+ [lux #*
+ [abstract
+ [monad (#+ do)]]
+ [control
+ ["." try (#+ Try)]
+ ["." exception]
+ [concurrency
+ ["." promise (#+ Promise)]]
+ [security
+ ["!" capability]]]
+ [data
+ [binary (#+ Binary)]
+ [text
+ ["%" format (#+ format)]
+ ["." encoding]]
+ [collection
+ ["." set]]
+ [format
+ ["." binary]
+ ["." tar]
+ ["." xml]]]
+ [world
+ ["." file (#+ Path File)]]]
+ [program
+ [compositor
+ ["." export]]]
+ ["." /// #_
+ ["/" profile (#+ Profile)]
+ ["#." action (#+ Action)]
+ ["#." command (#+ Command)]
+ ["#." local]
+ ["#." pom]
+ ["#." artifact (#+ Artifact)
+ ["#/." extension]]])
+
+(def: (save! system content file)
+ (-> (file.System Promise) Binary Path (Promise (Try Any)))
+ (do (try.with promise.monad)
+ [file (: (Promise (Try (File Promise)))
+ (file.get-file promise.monad system file))]
+ (!.use (:: file over-write) [content])))
+
+(def: #export (do! system profile)
+ (-> (file.System Promise) (Command Any))
+ (case (get@ #/.identity profile)
+ (#.Some identity)
+ (do ///action.monad
+ [package (export.library system (set.to-list (get@ #/.sources profile)))
+ repository (: (Promise (Try Path))
+ (file.make-directories promise.monad system (///local.path system identity)))
+ #let [artifact-name (format repository (:: system separator) (///artifact.identity identity))]
+ _ (..save! system (binary.run tar.writer package)
+ (format artifact-name ///artifact/extension.lux-library))
+ pom (:: promise.monad wrap (///pom.write profile))
+ _ (..save! system (|> pom (:: xml.codec encode) encoding.to-utf8)
+ (format artifact-name ///artifact/extension.pom))
+ #let [_ (log! "Successfully installed locally!")]]
+ (wrap []))
+
+ _
+ (:: promise.monad wrap (exception.throw /.no-identity []))))
diff --git a/stdlib/source/program/aedifex/local.lux b/stdlib/source/program/aedifex/local.lux
index 7a4cf070e..3c06f0222 100644
--- a/stdlib/source/program/aedifex/local.lux
+++ b/stdlib/source/program/aedifex/local.lux
@@ -58,24 +58,6 @@
(file.get-file promise.monad system file))]
(!.use (:: file over-write) [content])))
-(def: #export (install system profile)
- (-> (file.System Promise) Profile (Promise (Try Any)))
- (case (get@ #/.identity profile)
- (#.Some identity)
- (do (try.with promise.monad)
- [repository (: (Promise (Try Path))
- (file.make-directories promise.monad system (..path system identity)))
- #let [artifact-name (format repository (:: system separator) (//artifact.identity identity))]
- package (export.library system (set.to-list (get@ #/.sources profile)))
- _ (..save! system (binary.run tar.writer package)
- (format artifact-name //artifact/extension.lux-library))
- pom (:: promise.monad wrap (//pom.write profile))]
- (..save! system (|> pom (:: xml.codec encode) encoding.to-utf8)
- (format artifact-name //artifact/extension.pom)))
-
- _
- (:: promise.monad wrap (exception.throw /.no-identity []))))
-
(def: #export (cache system [artifact type] package)
(-> (file.System Promise) Dependency Package (Promise (Try Any)))
(do (try.with promise.monad)
diff --git a/stdlib/source/program/aedifex/shell.lux b/stdlib/source/program/aedifex/shell.lux
index 5ef30cf91..0215c08da 100644
--- a/stdlib/source/program/aedifex/shell.lux
+++ b/stdlib/source/program/aedifex/shell.lux
@@ -44,17 +44,16 @@
(#static getRuntime [] #io java/lang/Runtime)
(exec [java/lang/String #? [java/lang/String] java/io/File] #io #try java/lang/Process))
-(exception: #export (failure-to-execute-command {working-directory Text} {command Text} {error Text})
- (exception.report
- ["Working Directory" (%.text working-directory)]
- ["Command" (%.text command)]
- ["Error" (%.text error)]))
+(template [<exception>]
+ [(exception: #export (<exception> {working-directory Text} {command Text} {error Text})
+ (exception.report
+ ["Working directory" (%.text working-directory)]
+ ["Command" (%.text command)]
+ ["Error" (%.text error)]))]
-(exception: #export (failure-during-command-execution {working-directory Text} {command Text} {error Text})
- (exception.report
- ["Working Directory" (%.text working-directory)]
- ["Command" (%.text command)]
- ["Error" (%.text error)]))
+ [failure-to-execute-command]
+ [failure-during-command-execution]
+ )
(exception: #export (abnormal-exit {working-directory Text} {command Text} {code Int})
(exception.report