From 03c35d2d1a5ad5b11fbcf1cee53087dead030233 Mon Sep 17 00:00:00 2001 From: Anthony Grimes Date: Sat, 15 Oct 2011 02:10:49 -0500 Subject: [PATCH] Start updating to 1.3 --- project.clj | 7 +++---- src/cd_client/core.clj | 28 +++++++++++++--------------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/project.clj b/project.clj index ffb3cee..cc03939 100644 --- a/project.clj +++ b/project.clj @@ -1,7 +1,6 @@ (defproject org.thnetos/cd-client "0.3.0" :description "A client for the clojuredocs API" - :dependencies [[org.clojure/clojure "1.2.0"] - [org.clojure/clojure-contrib "1.2.0"] - [clj-http "0.1.1"] - [org.danlarkin/clojure-json "1.1"]] + :dependencies [[org.clojure/clojure "1.3.0"] + [clj-http "0.2.1"] + [org.clojure/data.json "0.1.1"]] :dev-dependencies [[swank-clojure "1.2.1"]]) diff --git a/src/cd_client/core.clj b/src/cd_client/core.clj index 87c2827..90f4c20 100644 --- a/src/cd_client/core.clj +++ b/src/cd_client/core.clj @@ -1,18 +1,18 @@ (ns cd-client.core - (:require [org.danlarkin.json :as json] + (:require [clojure.data.json :as json] [clj-http.client :as http] [clojure.string :as string]) (:use [clojure.java.browse :only [browse-url]])) ; For testing purposes use localhost:8080 -(def *clojuredocs-root* "http://api.clojuredocs.org") -;(def *clojuredocs-root* "http://localhost:8080") +(def ^:dynamic *clojuredocs-root* "http://api.clojuredocs.org") +;(def ^:dynamic *clojuredocs-root* "http://localhost:8080") -(def *examples-api* (str *clojuredocs-root* "/examples/")) -(def *search-api* (str *clojuredocs-root* "/search/")) -(def *comments-api* (str *clojuredocs-root* "/comments/")) -(def *seealso-api* (str *clojuredocs-root* "/see-also/")) +(def ^:dynamic *examples-api* (str *clojuredocs-root* "/examples/")) +(def ^:dynamic *search-api* (str *clojuredocs-root* "/search/")) +(def ^:dynamic *comments-api* (str *clojuredocs-root* "/comments/")) +(def ^:dynamic *seealso-api* (str *clojuredocs-root* "/see-also/")) (defn- fixup-name-url @@ -52,9 +52,7 @@ (defmacro handle-fns-etc [name fn] (cond - (special-form-anchor `~name) - `(~fn "clojure.core" (str '~name)) - (syntax-symbol-anchor `~name) + (special-symbol? `~name) `(~fn "clojure.core" (str '~name)) :else (let [nspace (find-ns name)] @@ -68,7 +66,7 @@ (defn examples-core "Return examples from clojuredocs for a given namespace and name (as strings)" [ns name] - (json/decode-from-str (:body (http/get (str *examples-api* ns "/" + (json/read-json (:body (http/get (str *examples-api* ns "/" (fixup-name-url name)))))) @@ -110,15 +108,15 @@ (defn search "Search for a method name within an (optional) namespace" ([name] - (json/decode-from-str (:body (http/get (str *search-api* name))))) + (json/read-json (:body (http/get (str *search-api* name))))) ([ns name] - (json/decode-from-str (:body (http/get (str *search-api* ns "/" name)))))) + (json/read-json (:body (http/get (str *search-api* ns "/" name)))))) (defn comments-core "Return comments from clojuredocs for a given namespace and name (as strings)" [ns name] - (json/decode-from-str (:body (http/get (str *comments-api* ns "/" + (json/read-json (:body (http/get (str *comments-api* ns "/" (fixup-name-url name)))))) @@ -162,7 +160,7 @@ (defn see-also-core "Return 'see also' info from clojuredocs for a given namespace and name (as strings)" ([ns name] - (json/decode-from-str (:body (http/get (str *seealso-api* ns "/" + (json/read-json (:body (http/get (str *seealso-api* ns "/" (fixup-name-url name)))))))