Skip to content

Commit

Permalink
remove clj-json, extract function
Browse files Browse the repository at this point in the history
  • Loading branch information
philandstuff committed Apr 28, 2012
1 parent 63a3846 commit 116320c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
1 change: 0 additions & 1 deletion project.clj
Expand Up @@ -3,6 +3,5 @@
:dependencies [[org.clojure/clojure "1.4.0"]
[overtone/device.protocols "0.0.4-SNAPSHOT"]
[overtone/device.launchpad "0.0.5-SNAPSHOT"]
[clj-json "0.5.0"]
[overtone/libs.handlers "0.2.0-SNAPSHOT"]
[clj-http "0.4.0"]])
13 changes: 6 additions & 7 deletions src/grid_jenkins/core.clj
@@ -1,7 +1,6 @@
(ns grid-jenkins.core
(:use [overtone.device protocols launchpad])
(:require [clj-json.core :as json]
[clj-http.client :as http]
(:require [clj-http.client :as http]
[overtone.libs.handlers :as handlers]
[clojure.java.browse :as browse]))

Expand All @@ -18,7 +17,7 @@
(str url "api/json")
(str url "/api/json")))

(def color
(def default-color
{"red" 1
"red_anime" 1
"yellow" 1
Expand All @@ -30,14 +29,14 @@
"disabled" 3
})

(defn lp-color [jenkins-color]
(get default-color jenkins-color 1))

(defn update-lp [lp jobs]
(doseq [y (range 8)
x (range 8)]
(if-let [job (get @button-state [x y])]
(let [colour (get color (get job :color) 1)]
(when (not (contains? color (get job :color)))
(print "don't understand color from" job))
(light-colour lp x y colour))
(light-colour lp x y (lp-color (:color job)))
(light-colour lp x y 0))))

(defn update-state [lp jobs]
Expand Down

0 comments on commit 116320c

Please sign in to comment.