This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-09-21
Channels
- # alda (1)
- # bangalore-clj (1)
- # beginners (7)
- # boot (88)
- # carry (2)
- # cider (8)
- # cljs-dev (60)
- # cljsjs (2)
- # cljsrn (45)
- # clojure (255)
- # clojure-belgium (5)
- # clojure-boston (1)
- # clojure-dusseldorf (3)
- # clojure-greece (49)
- # clojure-italy (10)
- # clojure-russia (30)
- # clojure-spec (78)
- # clojure-uk (11)
- # clojurebridge (1)
- # clojurescript (80)
- # cursive (14)
- # datomic (33)
- # defnpodcast (4)
- # devcards (2)
- # dirac (15)
- # editors (23)
- # emacs (5)
- # events (11)
- # funcool (1)
- # hoplon (1)
- # juxt (1)
- # luminus (2)
- # mount (7)
- # off-topic (15)
- # om (152)
- # om-next (2)
- # onyx (17)
- # parinfer (1)
- # proton (38)
- # re-frame (35)
- # reagent (110)
- # rum (3)
- # spacemacs (3)
- # specter (51)
- # test-check (2)
- # testing (5)
- # untangled (234)
is copy-files
a kosher way to copy one directory to another in a task?
https://github.com/boot-clj/boot/blob/2.5.2/boot/pod/src/boot/file.clj#L172
(deftask foo []
(fn [next-task]
(fn [file-set]
(boot-file/copy-files "public/" (str "public/" (env :ver 0) "/"))
(next-task file-set))))
@micha “public/“ is in resources/public. and my :resource-path is set to “resources”.
i did find a boot-copy
task but it seems its not maintained and is using deprecated api 😕
got a better suggestion on how to copy everything from public -> public/some-number/ ?
but it has a bug currently, see https://github.com/boot-clj/boot/issues/502
the easiest thing to do in your case i think is to make a temp dir, copy the files into there
(deftask foo []
(let [tmp (tmp-dir!)]
(with-pre-wrap fs
(let [ins (->> fs
(output-files)
(by-re #{#"^public/"}))]
(empty-dir! tmp)
(doseq [in ins]
(io/copy (tmp-file in) (io/file tmp "public" tag)))
(-> fs (add-resource tmp) (rm ins) commit!)))))
and finally you commit!
to sync with the underlying filesystem and pass the result to the next task
oh another question, what if i only need these copied file to be present for another boot task called bar
? instead of committing them, could i run bar
after altering the filesystem?
so it runs in the context of this modified filesystem, but its not one we pass to the next task? or is that an anitpattern?
(deftask foo []
(let [tmp (tmp-dir!)]
(with-pre-wrap fs
(let [ins (->> fs
(input-files)
(by-re #{#"^public/"}))]
(empty-dir! tmp)
(doseq [in ins]
(let [[path file] ((juxt tmp-path tmp-file) in)
relpath (.replaceAll path "^public/" "")]
(io/copy file (io/file tmp "public" tag relpath))))
(-> fs (add-resource tmp) commit!)))))
if you'd like to make a github issue for the sift --copy option, we can make it happen for 2.7.0
@richiardiandrea made https://github.com/micha/json-table/tree/key-wildcard if you're interested - adds . and ^k operators to jt
@alandipert: I am ! I will check it out
Is there a way to get the latest version of a dependency (including snapshots)? "LATEST"
seems to ignore snapshots.
@alandipert you still need to have a %
at the end for "gets" right?
kk I should patch that 😄
ok digging
ooooh there it is ... yeah makes sense...
so up to there user to discern what he/she wants and less logic in the code, it makes sense, less ambiguity
the key wildcard looks great for exploring