boot

:boot-clj: https://boot-clj.github.io/ — build tooling for Clojure. Dev chat in #boot-dev
Ajay 2019-02-28T16:37:33.001100Z

hi, can you suggest any resources that explain how to build a command line application using boot?

flyboarder 2019-02-28T17:34:21.002700Z

@ajay.rivendell I would need more info but you can try http://github.com/degree9/boot-exec

flyboarder 2019-02-28T17:35:03.003400Z

Oh sorry that won’t help, boot isn’t designed for building cli apps

flyboarder 2019-02-28T17:35:17.003600Z

Yet ;)

borkdude 2019-02-28T17:35:43.004100Z

Why not? E.g. https://github.com/boot-clj/boot/wiki/Scripts

borkdude 2019-02-28T17:35:53.004300Z

I use this all the time

Ajay 2019-02-28T17:44:05.007700Z

Ok, sorry, my question was misleading. I am not looking to turn a Clojure script into an executable. I just want to see an example of a command line application (fine to invoke through just boot some-task). Something beyond simple usage. Maybe 2-3 Clojure source files, how build.boot is defined, how profile.boot is defined etc.

borkdude 2019-02-28T17:44:54.008300Z

@ajay.rivendell you can call any deftask from the command line using boot my-task, no config needed

borkdude 2019-02-28T17:45:12.008700Z

and you can make a standalone script as described in the mentioned link

borkdude 2019-02-28T17:46:08.009200Z

e.g. this is a migrate script that I call from the cmd line:

#!/usr/bin/env boot
(set-env! :dependencies
          '[[boot-bundle "0.1.0" :scope "test"]])
(require '[boot-bundle :refer [expand-keywords]])
(reset! boot-bundle/bundle-file-path "../bundle.edn")

(set-env!
 :resource-paths #{"src"
                   "resources"}
 :dependencies
 (expand-keywords
  '[;; Base
    :base
    :logging
    :crispin
    ;; DB
    [org.postgresql/postgresql "42.2.5"]
    [migratus "1.0.6"]]))

(require '[dre.task.migrate :refer [migrate]])

(defn -main [& args]
  (apply boot "migrate" args))

Ajay 2019-02-28T17:47:32.010300Z

OK thanks! But I am NOT looking to create an executable script. My question is different

borkdude 2019-02-28T17:48:04.010700Z

Yes, like I said: just call boot my-task then.

borkdude 2019-02-28T17:48:26.011Z

and put some (deftask my-task ...) in a build.boot file

borkdude 2019-02-28T17:48:39.011200Z

Don’t know what else you’re asking for 🙂

Ajay 2019-02-28T17:55:28.012600Z

How can I set a property in profile.boot and how do I read it in my Clojure source file? Do I need 'environ' for this or I can just use boot?

flyboarder 2019-02-28T18:03:04.013900Z

That does not compile to a cli app, it simply wraps boot - I originally thought they wanted a cli app with embedded boot

flyboarder 2019-02-28T18:03:50.014500Z

@ajay.rivendell then my link is correct for you!

flyboarder 2019-02-28T18:03:59.014800Z

boot-exec is what you want

flyboarder 2019-02-28T18:04:25.015600Z

Look at http://github.com/degree9/boot-npm for a usage example

flyboarder 2019-02-28T18:11:29.016900Z

@ajay.rivendell do you really want to set a property in your profile.boot? What are you trying to accomplish?

flyboarder 2019-02-28T18:13:04.018900Z

I would recommend storing it in the local project boot.properties if you have to, you can use boot-clj/bootstrap to read it. With bootstrap.config/config which returns the config map used by boot.

borkdude 2019-02-28T18:36:36.019Z

“compile to a cli app” you mean bundle a JVM, etc? It’s not clear to me that this is what Ajay wants… also, boot-exec doesn’t compile to a CLI app, it just executes other executables?

flyboarder 2019-02-28T19:59:31.019300Z

Correct