Permalink
Browse files

remove clj-json, extract function

  • Loading branch information...
1 parent 63a3846 commit 116320cac1e3cd8fe14a5403da6f36d3157a39b8 @philandstuff committed Apr 28, 2012
Showing with 6 additions and 8 deletions.
  1. +0 −1 project.clj
  2. +6 −7 src/grid_jenkins/core.clj
View
@@ -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"]])
View
@@ -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]))
@@ -18,7 +17,7 @@
(str url "api/json")
(str url "/api/json")))
-(def color
+(def default-color
{"red" 1
"red_anime" 1
"yellow" 1
@@ -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]

0 comments on commit 116320c

Please sign in to comment.