aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/deploy.lux
blob: 787496543163d6fd36c783fa4266d6fd33bf9501 (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
(.module:
  [library
   [lux "*"
    [abstract
     [monad {"+" [do]}]]
    [control
     [pipe {"+" [do>]}]
     ["." try {"+" [Try]}]
     [concurrency
      ["." async {"+" [Async]} ("#\." monad)]]
     ["<>" parser
      ["<.>" xml]]]
    [data
     [binary {"+" [Binary]}]
     [text
      ["%" format {"+" [format]}]
      [encoding
       ["." utf8]]]
     [collection
      ["." set]]
     [format
      ["." binary]
      ["." tar]
      ["." xml]]]
    [time
     ["." instant {"+" [Instant]}]]
    [world
     ["." file]
     ["." console {"+" [Console]}]]]]
  [program
   [compositor
    ["." export]]]
  ["." // "_"
   ["#." clean]
   ["/#" // "_"
    [command {"+" [Command]}]
    ["/" profile]
    ["#." action {"+" [Action]}]
    ["#." pom]
    ["#." hash]
    ["#." package]
    ["#." dependency
     ["#/." deployment]
     ["#/." status {"+" [Status]}]]
    ["#." repository {"+" [Repository]}
     [identity {"+" [Identity]}]
     ["#/." remote]
     ["#/." origin]]
    ["#." metadata
     ["#/." artifact]
     ["#/." snapshot]]
    ["#." artifact {"+" [Artifact]}
     ["#/." extension {"+" [Extension]}]
     ["#/." type]]]])

(def: .public success
  "Successfully deployed the project.")

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