Skip to content

Commit

Permalink
Fixed a bug which caused that if you specified builds to be compiled …
Browse files Browse the repository at this point in the history
…instead of compiling all builds, it did not work.
  • Loading branch information
JanSuran03 committed Sep 19, 2021
1 parent bdcb490 commit 2425730
Show file tree
Hide file tree
Showing 18 changed files with 25 additions and 138 deletions.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/libraries/Leiningen__commons_codec_1_10.xml

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/libraries/Leiningen__org_clojure_data_json_0_2_6.xml

This file was deleted.

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/libraries/Leiningen__org_clojure_tools_reader_1_3_3.xml

This file was deleted.

This file was deleted.

9 changes: 0 additions & 9 deletions .idea/libraries/Leiningen__org_msgpack_msgpack_0_6_12.xml

This file was deleted.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lein-tornado.iml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<orderEntry type="library" name="Maven: org.clojure:clojure:1.5.1" level="project" />
<orderEntry type="library" name="Maven: org.clojure:tools.namespace:0.2.11" level="project" />
<orderEntry type="library" name="Maven: org.clojure:java.classpath:0.3.0" level="project" />
<orderEntry type="library" name="Maven: org.clojars.jansuran03:tornado:0.1.5" level="project" />
<orderEntry type="library" name="Maven: org.clojars.jansuran03:tornado:0.1.6" level="project" />
<orderEntry type="library" name="Maven: me.raynes:fs:1.4.6" level="project" />
<orderEntry type="library" name="Maven: org.apache.commons:commons-compress:1.8" level="project" />
<orderEntry type="library" name="Maven: org.tukaani:xz:1.5" level="project" />
Expand Down
4 changes: 2 additions & 2 deletions project.clj
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
(defproject org.clojars.jansuran03/lein-tornado "0.1.2"
(defproject org.clojars.jansuran03/lein-tornado "0.1.3"
:description "A Clojure plugin for automatic compilation of Tornado stylesheets."
:url "https://github.com/JanSuran03/lein-tornado"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "https://www.eclipse.org/legal/epl-2.0/"}
:dependencies [[ns-tracker "0.4.0"]
[org.clojars.jansuran03/tornado "0.1.5"]
[org.clojars.jansuran03/tornado "0.1.6"]
[me.raynes/fs "1.4.6"]]
:eval-in-leiningen true)
28 changes: 16 additions & 12 deletions src/leiningen/tornado.clj
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
build map of the build. Otherwise, throws an exception."
[project build-ids]
(let [all-builds (all-builds project)]
(for [build-id build-ids]
(if-let [build (some (fn [{:keys [id] :as build}]
(when (= (name build-id) (name id))
build)) all-builds)]
build
(throw (Exception. (str "Unknown build id: " build-id)))))))
(for [build-id build-ids
:let [build (if-let [build (some (fn [{:keys [id] :as build}]
(when (= (name build-id) (name id))
build)) all-builds)]
build
(throw (Exception. (str "Unknown build id: " build-id))))]
:when build]
build)))

(defn- validate-builds
"For each build, validates id, stylesheet and source paths. Throws an exception if some
Expand Down Expand Up @@ -88,7 +90,7 @@
"Starts the compilation process."
[project args watch?]
(let [builds (if (seq args)
(find-builds project args)
(vec (find-builds project args))
(all-builds project))
stylesheets (map :stylesheet builds)
build-paths (mapcat :source-paths builds)
Expand All @@ -110,8 +112,7 @@
(run-compiler project args false))

(defn- auto
"Compiles Tornado stylesheets once and recompiles them whenever they are modified.
Args are optional specific builds to be compiled."
"Compiles Tornado stylesheets once and recompiles them whenever they are modified. Args are optional specific builds to be compiled."
[project args]
(run-compiler project args true))

Expand All @@ -120,11 +121,14 @@
^:displace [me.raynes/fs "1.4.6"]]})

; TODO: (tornado auto) compresses the build if pretty-print? is set to false only
; for the first time, after recompilation not anymore for some reason...
; TODO: for the first time, after recompilation not anymore for some reason...

(defn tornado
"Somethingggg" ; TODO: wtf is this doc
{:help-arglists '([once] [auto])
"A function for evaluation in the terminal:
\"lein garden once\" - compiles all stylesheets once
\"lein garden auto\" - recompiles all stylesheets to provide hot-code reloading.
\"lein garden <once/auto> & builds - compiles only specific builds."
{:help-arglists '([once] [once & builds] [auto] [auto & builds])
:subtasks [#'once #'auto]}
[project command & builds?]
(let [project (project/merge-profiles project [tornado-profile])]
Expand Down

0 comments on commit 2425730

Please sign in to comment.