aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/install.lux
blob: 3436adf17909307560a347397f3ae953d3cf4bfd (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
(.module:
  [library
   [lux "*"
    [abstract
     [monad {"+" do}]]
    [control
     ["[0]" try {"+" Try}]
     ["[0]" exception]
     [concurrency
      ["[0]" async {"+" Async}]]]
    [data
     [binary {"+" Binary}]
     [text
      [encoding
       ["[0]" utf8]]]
     [collection
      ["[0]" set]]
     [format
      ["[0]" binary]
      ["[0]" tar]
      ["[0]" xml]]]
    [world
     [program {"+" Program}]
     ["[0]" file]
     ["[0]" console {"+" Console}]]]]
  [program
   [compositor
    ["[0]" export]]]
  ["[0]" // "_"
   ["[1][0]" clean]
   ["/[1]" // "_"
    ["/" profile {"+" Profile}]
    ["[1][0]" action {"+" Action}]
    ["[1][0]" command {"+" Command}]
    ["[1][0]" local]
    ["[1][0]" pom]
    ["[1][0]" package]
    [repository {"+" Repository}
     ["[1][0]" origin]]
    ["[1][0]" dependency "_"
     ["[1]/[0]" deployment]
     ["[1]/[0]" status]]
    ["[1][0]" artifact {"+" Artifact}
     ["[1]/[0]" type]]]])

(def: .public success
  "Successfully installed the project locally.")

(def: .public failure
  "Failure: No 'identity' defined for the project.")

(def: .public (do! console fs repository profile)
  (-> (Console Async) (file.System Async) (Repository Async) (Command Any))
  (case (value@ /.#identity profile)
    {.#Some identity}
    (do ///action.monad
      [package (|> profile
                   (value@ /.#sources)
                   set.list
                   (export.library fs))
       pom (|> profile
               ///pom.write
               (# async.monad in))
       _ (///dependency/deployment.one repository
                                       [identity ///artifact/type.lux_library]
                                       (let [pom_data (|> pom
                                                          (# xml.codec encoded)
                                                          (# utf8.codec encoded))]
                                         [///package.#origin {///origin.#Local ""}
                                          ///package.#library (let [library (binary.result tar.writer package)]
                                                                [library (///dependency/status.verified library)])
                                          ///package.#pom [pom
                                                           pom_data
                                                           (///dependency/status.verified pom_data)]]))]
      (console.write_line ..success console))

    _
    (console.write_line ..failure console)))