aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/pom.lux
blob: 71d8a9223ea858b53a0404f43e4a7f26bb0b6c51 (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
(.require
 [library
  [lux (.except)
   [abstract
    [monad (.only do)]]
   [control
    ["[0]" try (.only Try) (.use "[1]#[0]" functor)]
    [concurrency
     ["[0]" async (.only Async) (.use "[1]#[0]" monad)]]]
   [data
    [text
     ["%" \\format (.only format)]
     [encoding
      ["[0]" utf8]]]
    [format
     ["[0]" xml]]]
   [world
    ["[0]" file]
    ["[0]" console (.only Console)]]]]
 ["[0]" ///
  [command (.only Command)]
  ["[1][0]" action]
  ["[1][0]" pom]])

(def .public success
  (format "Successfully created POM file: " ///pom.file))

(def .public (do! console fs profile)
  (-> (Console Async) (file.System Async) (Command Any))
  (do ///action.monad
    [content (|> (///pom.write profile)
                 (try#each (|>> (at xml.codec encoded)
                                (at utf8.codec encoded)))
                 async#in)
     _ (at fs write ///pom.file content)]
    (is (Async (Try Any))
        (console.write_line ..success console))))