-
-
Notifications
You must be signed in to change notification settings - Fork 180
Filter dependencies on pods
Dominic Monroe edited this page Jun 8, 2016
·
5 revisions
Sometimes boot tasks have conflicts with your project. You can filter the dependencies that will be used on the pod using this: Source: Micha Niskin on Slack
(defmacro with-env
[env & body]
(let [orig (into {} (map #(vector % (gensym)) (keys env)))]
`(let [~@(mapcat (fn [[k v]] [v `(get-env ~k)]) orig)]
~@(for [[k v] env] `(set-env! ~k ~v))
(with-let [ret# (do ~@body)]
~@(for [[k v] orig] `(set-env! ~k ~v))))))
(defn filter-deps
[deps]
(->> (get-env :dependencies)
(filterv #(some (set deps) ((juxt first (comp symbol name first)) %)))))
(defmacro with-deps
[deps & body]
`(with-env {:dependencies (filter-deps '~deps)} ~@body))
Usage: Project has deps that conflict with boot-jetty, so we filter all of those out when we instantiate the task--it will not create pods with the troublesome deps.
(deftask foo
[]
(comp (watch)
(hoplon)
(cljs)
(with-deps [boot-jetty] (serve))))
This is a discussion and not part of the documentation.
-
Separate dependencies (other env parameters?) of frontend & backend
-
[AR] Define dependencies (other env parameters?) at task creation time
- Example: in order to supply deps to
boot-cljs
's pod at the moment you need to callset-env!
which is bad as it overrides the currentboot.user
env. This side effect should be avoided.
- Example: in order to supply deps to
Possible solutions
- Implement dynamic var env that is used by
get-env
- Have an
--env
option that equally specifies what will be returned byget-env
- ...
You can find other developers and users in the #hoplon
channel on freenode IRC or the boot slack channel.
If you have questions or need help, please visit the Discourse site.
- Environments
- Boot environment
- Java environment
- Tasks
- Built-ins
- Third-party
- Tasks Options
- Filesets
- Target Directory
- Pods
- Boot Exceptions
- Configuring Boot
- Updating Boot
- Setting Clojure version
- JVM Options
- S3 Repositories
- Scripts
- Task Writer's Guide
- Require inside Tasks
- Boot for Leiningen Users
- Boot in Leiningen Projects
- Repl reloading
- Repository Credentials and Deploying
- Snippets
- Troubleshooting
- FAQ
- API docs
- Core
- Pod
- Util