Created
February 15, 2017 15:00
-
-
Save theronic/eb3187b5b80a1e34bbdbf38c9c8b6d35 to your computer and use it in GitHub Desktop.
Put this in your ~/.boot/boot.profile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defn- generate-lein-project-file! [& {:keys [keep-project] :or {:keep-project true}}] | |
(require 'clojure.java.io) | |
(let [pfile ((resolve 'clojure.java.io/file) "project.clj") | |
; Only works when pom options are set using task-options! | |
{:keys [project version]} (:task-options (meta #'boot.task.built-in/pom)) | |
prop #(when-let [x (get-env %2)] [%1 x]) | |
head (list* 'defproject (or project 'boot-project) (or version "0.0.0-SNAPSHOT") | |
(concat | |
(prop :url :url) | |
(prop :license :license) | |
(prop :description :description) | |
[:dependencies (get-env :dependencies) | |
:source-paths (vec (concat (get-env :source-paths) | |
(get-env :resource-paths)))])) | |
proj (pp-str head)] | |
(if-not keep-project (.deleteOnExit pfile)) | |
(spit pfile proj))) | |
(deftask lein-generate | |
"Generate a leiningen `project.clj` file. | |
This task generates a leiningen `project.clj` file based on the boot | |
environment configuration, including project name and version (generated | |
if not present), dependencies, and source paths. Additional keys may be added | |
to the generated `project.clj` file by specifying a `:lein` key in the boot | |
environment whose value is a map of keys-value pairs to add to `project.clj`." | |
[] | |
(generate-lein-project-file! :keep-project true))% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment