Skip to content

Instantly share code, notes, and snippets.

@realyze
Created November 21, 2014 05:42
Show Gist options
  • Save realyze/78d8b972b2b0bad2b3aa to your computer and use it in GitHub Desktop.
Save realyze/78d8b972b2b0bad2b3aa to your computer and use it in GitHub Desktop.
Timbre and core.typed
(ns habanero.activity.jira
(:require [clj-xpath.core :as xpath :refer [$x $x:text, $x:text* $x:attrs*]]
[clj-time.format :as tf]
[clj-time.core :as tc]
[environ.core :refer [env]]
[clojure.string :refer [split]]
[trammel.core :refer [defconstrainedfn]]
[habanero.util]
[clojure.core.typed :as t]
[taoensso.timbre :as timbre]
[dire.core :refer [with-handler!]]
[clojure.core.match :refer [match]]
[habanero.connectors.jira :refer [read-stream-xml get-projects]]
[habanero.activity.feed-reader :as feed-reader]))
(t/ann ^:no-check taoensso.timbre/info [t/Any * -> t/Any])
(t/ann taoensso.timbre/levels-scored t/Any)
(t/ann taoensso.timbre/level-sufficient? [t/Any t/Any -> t/Any])
(t/ann taoensso.timbre/compile-config t/Any)
(t/ann taoensso.timbre/get-default-config (Fn [t/Any -> t/Any]))
(t/ann ^:no-check environ.core/env (Fn [t/Keyword -> t/Any]))
(def ^:const service-name "jira")
;; JIRA related env vars.
(t/ann username String)
(def ^:private username (env :jira-user))
(def project-map (atom {}))
(defconstrainedfn update-project-map!
"Updates the `project-map` atom with project data from JIRA."
[] [=> (not (empty? @project-map))]
(timbre/info "Updating project map...")
(let [projects (get-projects)]
(reset! project-map (habanero.util/vector->map :key projects))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment