blob: d4c9036f3b42ac010a1585b0bca6f1b90a471dbb (
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
(.module:
[lux (#- Name)
[abstract
[monad (#+ do)]]
[control
[pipe (#+ do>)]
["." try (#+ Try)]
["." io (#+ IO)]
[parser
["." cli (#+ program:)]
["<c>" code]]
[security
["!" capability]]
[concurrency
["." promise (#+ Promise)]]]
[data
[binary (#+ Binary)]
["." text
["%" format (#+ format)]
["." encoding]]
[format
["." xml]]
[collection
["." set]]]
[tool
[compiler
[language
[lux
["." syntax]]]]]
[world
["." file (#+ Path)]]]
["." / #_
[action (#+ Action)]
["#" profile]
["#." project (#+ Project)]
["#." input]
["#." parser]
["#." pom]
["#." cli]
["#." cache]
["#." dependency #_
["#" resolution]]
["#." command
["#/." clean]
["#/." pom]
["#/." install]
["#/." build]
["#/." test]
["#/." auto]
["#/." deploy]]])
(def: (fetch-dependencies! profile)
(-> /.Profile (Promise Any))
(do promise.monad
[outcome (do (try.with promise.monad)
[cache (/cache.read-all (file.async file.default)
(set.to-list (get@ #/.dependencies profile))
/dependency.empty)
resolution (promise.future
(/dependency.resolve-all (set.to-list (get@ #/.repositories profile))
(set.to-list (get@ #/.dependencies profile))
cache))]
(/cache.write-all (file.async file.default)
resolution))]
(wrap (case outcome
(#try.Success _)
(log! "Successfully resolved dependencies!")
(#try.Failure error)
(log! (format "Could not resolve dependencies:" text.new-line
error))))))
(program: [{[profile operation] /cli.command}]
(do {! io.monad}
[?profile (/input.read io.monad file.default profile)]
(case ?profile
(#try.Success profile)
(case operation
#/cli.Clean
(exec (/command/clean.do! (file.async file.default) profile)
(wrap []))
#/cli.POM
(exec (/command/pom.do! (file.async file.default) profile)
(wrap []))
#/cli.Dependencies
(exec (..fetch-dependencies! profile)
(wrap []))
#/cli.Install
(exec (/command/install.do! (file.async file.default) profile)
(wrap []))
(#/cli.Deploy repository user password)
(exec (/command/deploy.do! repository user password profile)
(wrap []))
(#/cli.Compilation compilation)
(case compilation
#/cli.Build (exec (/command/build.do! profile)
(wrap []))
#/cli.Test (exec (/command/test.do! profile)
(wrap [])))
(#/cli.Auto auto)
(exec (case auto
#/cli.Build (/command/auto.do! /command/build.do! profile)
#/cli.Test (/command/auto.do! /command/test.do! profile))
(wrap [])))
(#try.Failure error)
(wrap (log! error)))))
|