aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/deploy.lux
blob: 1f5ccc441b839c1c03db70685673e4802f7018d9 (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
(.module:
  [lux #*
   [abstract
    [monad (#+ do)]]
   [control
    [concurrency
     ["." promise (#+ Promise) ("#\." monad)]]]
   [data
    [binary (#+ Binary)]
    [text
     ["." encoding]]
    [collection
     ["." set]]
    [format
     ["." binary]
     ["." tar]
     ["." xml]]]
   [world
    ["." file]]]
  [program
   [compositor
    ["." export]]]
  ["." /// #_
   [repository (#+ Identity Repository)]
   [command (#+ Command)]
   ["/" profile]
   ["#." action (#+ Action)]
   ["#." pom]
   ["#." hash]
   ["#." artifact (#+ Artifact)
    ["#/." extension (#+ Extension)]]])

(def: #export (do! repository fs identity artifact profile)
  (-> (Repository Promise) (file.System Promise) Identity Artifact (Command Any))
  (let [deploy! (: (-> Extension Binary (Action Any))
                   (\ repository upload identity artifact))]
    (do {! ///action.monad}
      [library (|> profile
                   (get@ #/.sources)
                   set.to-list
                   (export.library fs)
                   (\ ! map (binary.run tar.writer)))
       pom (promise\wrap (///pom.write profile))
       _ (deploy! ///artifact/extension.pom (|> pom (\ xml.codec encode) encoding.to-utf8))
       _ (deploy! ///artifact/extension.lux-library library)
       _ (deploy! ///artifact/extension.sha-1 (///hash.data (///hash.sha-1 library)))
       _ (deploy! ///artifact/extension.md5 (///hash.data (///hash.md5 library)))
       #let [_ (log! "Successfully deployed!")]]
      (wrap []))))