Skip to content
This repository has been archived by the owner on Apr 16, 2021. It is now read-only.

Commit

Permalink
Proper middleware form
Browse files Browse the repository at this point in the history
  • Loading branch information
David Orme committed Nov 29, 2016
1 parent 9a2fca7 commit a41f3ad
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion build.boot
Expand Up @@ -2,7 +2,7 @@
(def project-name "clj-boot")
(def project-openness :open-source)

(def version "0.1.5")
(def version "0.1.6")
(def description "Standard Brad's Deals boot build tasks")
(def scm-url "https://github.com/shopsmart/clj-boot")

Expand Down
18 changes: 10 additions & 8 deletions src/clj_boot/core.clj
Expand Up @@ -24,14 +24,16 @@
project-types set. In addition, may test that the current project is exactly a single type via
the 'expect' parameter."
[e expect PROJECT-TYPE kw "The expected project type"]
(if-not (project-types @project-type)
(throw (ex-info (str "This project is " @project-type " but must be one of " project-types)
{})))

(if-not (= expect @project-type)
(throw (ex-info (str "This project is " @project-type " but must be " expect
".\nto perform this operation.\n Supported project types: " project-types)
{}))))
(fn middleware [next-handler]
(fn handler [fileset]
(if-not (project-types @project-type)
(throw (ex-info (str "This project is " @project-type " but must be one of " project-types)
{})))
(if-not (= expect @project-type)
(throw (ex-info (str "This project is " @project-type " but must be " expect
".\nto perform this operation.\n Supported project types: " project-types)
{})))
(next-handler fileset))))


(deftask dev
Expand Down

0 comments on commit a41f3ad

Please sign in to comment.