Fork me on GitHub
#boot
<
2016-07-06
>
richiardiandrea17:07:29

For the intrepid and very curious, I create a boot task (with my conventions, sorry) for cider-diet: https://gist.github.com/arichiardi/86ccc450e243e9964e723d73f2f1db2c

richiardiandrea17:07:14

Usage: boot fast-repl

richiardiandrea17:07:33

Improvements are more then welcome šŸ˜‰

richiardiandrea17:07:22

I will maybe end up in lambone, I will be testing it in these days (it feels like 8 seconds startup time)

richiardiandrea17:07:58

first flaw found, env vars are not visible in the inner process

timothypratley19:07:14

I'm using a tenzing template. (serve) seems to use the resources directory. I would prefer it to use resources/public. What do I need to change to tell boot to use the subdirectory?

martinklepsch19:07:52

You'll need to move the .cljs.edn file as well then šŸ™‚

timothypratley20:07:40

So adding a :dir option to serve worked, in that I can load index.html

(deftask development []
   (task-options! cljs {:optimizations :none :source-map true}}
                  reload {:on-jsload 'voterx.main/render}
                  serve {:dir "resources/public"})
   identity)
But trying to set the cljs compiler output-dir in app.cljs.edn didn't:
{:require  [voterx.main]
 :init-fns [voterx.main/init]
 :compiler-options {:output-to "resources/public/js/compiled/main.js"
                    :output-dir "resources/public/js/compiled/out"
                    :asset-path "js/compiled/out"}}
WARNING: Replacing ClojureScript compiler option :output-dir with automatically set value. WARNING: Replacing ClojureScript compiler option :output-to with automatically set value. JS is not served (probably it is not under public)

martinklepsch20:07:04

@timothypratley: I was actually thinking of

-r, --resource-root ROOT  Set the root prefix when serving resources from classpath to ROOT

martinklepsch20:07:38

By using --resource-root you keep relying on the classpath for serving assets which integrates well with Boot

martinklepsch20:07:05

the --dir option requires that you write files to some separate directory than what boot manages after each run

timothypratley21:07:13

Hmmm my whole intention is to write to a separate directory (perhaps my intentions are bad?) Because I want to deploy stuff. To deploy stuff I use boot target so I can get my assets, but I don't want everything from resources in there because there are build resources and there are built resources, I only want to deploy the built resources. Using a different resource root doesn't seem to buy me anything. Using the --dir allows me to serve the "things I want to deploy" but I can't actually build those šŸ˜• Obviously I'm doing it all wrong lol.

martinklepsch21:07:20

you can use sift to remove stuff from what target outputs

martinklepsch21:07:44

I think it's sometimes hard to see how all things fit together so it takes some time

martinklepsch21:07:11

also this might be interesting to improve your understanding: https://github.com/boot-clj/boot/wiki/Filesets#roles-of-files

nha21:07:13

Is there a way to use sift to copy file(s) ?

nha21:07:38

(ie. not move ?)

nha21:07:15

Does not seem so - I made a separate task for now, maybe later make my own task

nha22:07:39

Ah right I think I want to do something similar as timothypratley in the end. Ie. copy/move a few compiled js files out of target to use them on another folder containing a website

nha22:07:00

Unrelated: Can we programmatically populate a Fileset ? For test purposes

clem22:07:16

Whatā€™s the best way for a task to determine the version of the project itā€™s being invoked in?

clem22:07:34

Ok, looks like boot.pod/pom-properties-map might be the best best, based on what I see in (deftask jar).

clem22:07:38

Although I just had a look at the following:

(core/deftask pom
  "Create project pom.xml file.

  The project and version must be specified to make a pom.xml."

  [p project SYM      sym       "The project id (eg. foo/bar)."
   v version VER      str       "The project version.ā€
Which seems to suggest that project and version arguments are ā€œmagicā€ arguments that are supplied by the values in the build.boot.

clem23:07:24

However, I canā€™t get that to happen magically in the task Iā€™m writing.

flyboarder23:07:45

@clem what is your goal?

flyboarder23:07:56

just read a version string?

clem23:07:18

Yep, that and the artifactId.

clem23:07:41

Then use those values to create an artifact file.

flyboarder23:07:04

ok so one way to do that is use boot-semver to read/write a version.properties file, you can then use get-version in your build.boot

flyboarder23:07:50

what type of artifact are you looking to build?

clem23:07:23

Iā€™m creating a task that uses pandoc to create a document. I need the version string to both add to the document and to compose the filename.

clem23:07:44

Kind of surprised this isnā€™t in the map returned by get-env.

flyboarder23:07:00

boot doesnt manage versions at all

flyboarder23:07:16

boot-semver should be all you need šŸ™‚

clem23:07:00

Ok, Iā€™ll give that a look. So, typically, versions are stored separately in version.properties and not in build.boot? Would a version stored in there be used by jar and pom?

flyboarder23:07:15

well you can (generally) do it however you want to, i dont think version strings have a place in config files, since you cant change your build.boot file while a pipeline is running, so I cant update my version string (without boot-semver)

flyboarder23:07:53

you can then use a options map to set the version for the tasks which need itā€¦. one sec ill throw up a demoā€¦.

clem23:07:18

Ok. Appreciate the help.

clem23:07:11

Nice. So task-options! provides default arguments for a task?

flyboarder23:07:03

correct but they are applied to all the instances of it, so keep out things you are going to specify multiple times in multiple build pipes

flyboarder23:07:21

or (def +version+ (get-version)) you can also use a default for when the file doesnā€™t exists (get-version ā€œ0.1.0")

flyboarder23:07:59

but yes, task-options! are applied wherever you use that task

flyboarder23:07:18

you can even override them in a task during your task contruction

flyboarder23:07:48

in a future version iā€™ll give the option to override standard tasks like pom when the version task updates the string

flyboarder23:07:01

itā€™s on my list šŸ˜‰

clem23:07:38

Very helpful. Thanks for your time.

flyboarder23:07:20

let me know if you need help getting it working :thumbsup: