Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Lemur suitable as a library #31

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Prev Previous commit
Next Next commit
Remove assert that is not really having effect as
the context is set anyway
  • Loading branch information
jeroenvandijk committed Nov 3, 2014
commit dce61cae43de702ea5459c27b7ac82f8566eadef
7 changes: 0 additions & 7 deletions src/main/clj/lemur/core.clj
Original file line number Diff line number Diff line change
@@ -92,23 +92,16 @@ calls launch - take action (upload files, start cluster, etc)
`(binding [*context* (create-context)]
~@body))

(defn assert-context-given []
(when (instance? clojure.lang.Var$Unbound *context*)
(throw (ex-info "No context was given. Wrap your code with `(in-context ...)" {}))))

(defn context-get
[k]
(assert-context-given)
(get @*context* k))

(defn context-set
[k v]
(assert-context-given)
(swap! *context* #(assoc % k v)))

(defn context-update
[keys f]
(assert-context-given)
(swap! *context*
(fn [c] (update-in c keys f))))