blob: 818283cc549361e08440071a9c9a6f4a034c100c (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
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 []))))
|