aboutsummaryrefslogtreecommitdiff
path: root/stdlib/source/program/aedifex/command/pom.lux
blob: f493092a5e6f9a2140c44d911a3b3be1bcc8e254 (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
(.module:
  [lux #*
   [abstract
    [monad (#+ do)]]
   [control
    ["." try (#+ Try)]
    [security
     ["!" capability]]
    [concurrency
     ["." promise (#+ Promise) ("#@." monad)]]]
   [data
    ["." text
     ["%" format (#+ format)]
     ["." encoding]]
    [format
     ["." xml]]]
   [world
    ["." file (#+ Path File)]]]
  ["." /// #_
   [command (#+ Command)]
   ["#." action (#+ Action)]
   ["#." pom]])

(def: #export (do! fs profile)
  (-> (file.System Promise) (Command Path))
  (do ///action.monad
    [pom (promise@wrap (///pom.write profile))
     file (: (Promise (Try (File Promise)))
             (file.get-file promise.monad fs ///pom.file))
     outcome (|> pom
                 (:: xml.codec encode)
                 encoding.to-utf8
                 (!.use (:: file over-write)))
     #let [_ (log! "Successfully wrote POM file!")]]
    (wrap ///pom.file)))