aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/deploy/snapshot.lux
blob: 1a6b047683be104d87f39128758096bbcf36245e (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
... This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
... If a copy of the MPL was not distributed with this file, You can obtain one at https://mozilla.org/MPL/2.0/.

(.require
 [library
  [lux (.except)
   [abstract
    [monad (.only do)]]
   [control
    [function
     [predicate (.only Predicate)]]
    [concurrency
     ["[0]" async (.only Async)]]]
   [data
    ["[0]" binary
     ["[1]" \\format]]
    ["[0]" text (.only)
     [encoding
      ["[0]" utf8]]]
    [collection
     ["[0]" set]]
    [format
     ["[0]" tar]
     ["[0]" xml]]]
   [meta
    [compiler
     [meta
      ["[0]" export]]]]
   [world
    [console (.only Console)]
    ["[0]" file]]]]
 ["[0]" ////
  [command (.only Command)]
  ["/" profile]
  ["[1][0]" action]
  ["[1][0]" pom]
  ["[1][0]" package]
  ["[1][0]" dependency
   ["[1]/[0]" deployment]
   ["[1]/[0]" status]]
  ["[1][0]" repository (.only Repository)
   ["[1]/[0]" origin]]
  ["[1][0]" artifact (.only Artifact)
   ["[1]/[0]" type]]])

(def .public snapshot?
  (Predicate Artifact)
  (|>> (the ////artifact.#version)
       (text.contains? "-SNAPSHOT")))

(def .public (do! console remote fs artifact profile)
  (-> (Console Async) (Repository Async) (file.System Async) Artifact (Command Any))
  (do [! ////action.monad]
    [library (|> profile
                 (the /.#sources)
                 set.list
                 (export.library fs)
                 (of ! each (binary.result tar.format)))
     pom (of async.monad in (////pom.write profile))
     _ (////dependency/deployment.one
        remote
        [artifact ////artifact/type.lux_library]
        (let [pom_data (|> pom
                           (of xml.codec encoded)
                           (of 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)]]))]
    (in [])))