Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Start updating to 1.3

  • Loading branch information...
commit 03c35d2d1a5ad5b11fbcf1cee53087dead030233 1 parent 2a02420
Anthony Grimes authored

Showing 2 changed files with 16 additions and 19 deletions. Show diff stats Hide diff stats

  1. +3 4 project.clj
  2. +13 15 src/cd_client/core.clj
7 project.clj
... ... @@ -1,7 +1,6 @@
1 1 (defproject org.thnetos/cd-client "0.3.0"
2 2 :description "A client for the clojuredocs API"
3   - :dependencies [[org.clojure/clojure "1.2.0"]
4   - [org.clojure/clojure-contrib "1.2.0"]
5   - [clj-http "0.1.1"]
6   - [org.danlarkin/clojure-json "1.1"]]
  3 + :dependencies [[org.clojure/clojure "1.3.0"]
  4 + [clj-http "0.2.1"]
  5 + [org.clojure/data.json "0.1.1"]]
7 6 :dev-dependencies [[swank-clojure "1.2.1"]])
28 src/cd_client/core.clj
... ... @@ -1,18 +1,18 @@
1 1 (ns cd-client.core
2   - (:require [org.danlarkin.json :as json]
  2 + (:require [clojure.data.json :as json]
3 3 [clj-http.client :as http]
4 4 [clojure.string :as string])
5 5 (:use [clojure.java.browse :only [browse-url]]))
6 6
7 7
8 8 ; For testing purposes use localhost:8080
9   -(def *clojuredocs-root* "http://api.clojuredocs.org")
10   -;(def *clojuredocs-root* "http://localhost:8080")
  9 +(def ^:dynamic *clojuredocs-root* "http://api.clojuredocs.org")
  10 +;(def ^:dynamic *clojuredocs-root* "http://localhost:8080")
11 11
12   -(def *examples-api* (str *clojuredocs-root* "/examples/"))
13   -(def *search-api* (str *clojuredocs-root* "/search/"))
14   -(def *comments-api* (str *clojuredocs-root* "/comments/"))
15   -(def *seealso-api* (str *clojuredocs-root* "/see-also/"))
  12 +(def ^:dynamic *examples-api* (str *clojuredocs-root* "/examples/"))
  13 +(def ^:dynamic *search-api* (str *clojuredocs-root* "/search/"))
  14 +(def ^:dynamic *comments-api* (str *clojuredocs-root* "/comments/"))
  15 +(def ^:dynamic *seealso-api* (str *clojuredocs-root* "/see-also/"))
16 16
17 17
18 18 (defn- fixup-name-url
@@ -52,9 +52,7 @@
52 52 (defmacro handle-fns-etc
53 53 [name fn]
54 54 (cond
55   - (special-form-anchor `~name)
56   - `(~fn "clojure.core" (str '~name))
57   - (syntax-symbol-anchor `~name)
  55 + (special-symbol? `~name)
58 56 `(~fn "clojure.core" (str '~name))
59 57 :else
60 58 (let [nspace (find-ns name)]
@@ -68,7 +66,7 @@
68 66 (defn examples-core
69 67 "Return examples from clojuredocs for a given namespace and name (as strings)"
70 68 [ns name]
71   - (json/decode-from-str (:body (http/get (str *examples-api* ns "/"
  69 + (json/read-json (:body (http/get (str *examples-api* ns "/"
72 70 (fixup-name-url name))))))
73 71
74 72
@@ -110,15 +108,15 @@
110 108 (defn search
111 109 "Search for a method name within an (optional) namespace"
112 110 ([name]
113   - (json/decode-from-str (:body (http/get (str *search-api* name)))))
  111 + (json/read-json (:body (http/get (str *search-api* name)))))
114 112 ([ns name]
115   - (json/decode-from-str (:body (http/get (str *search-api* ns "/" name))))))
  113 + (json/read-json (:body (http/get (str *search-api* ns "/" name))))))
116 114
117 115
118 116 (defn comments-core
119 117 "Return comments from clojuredocs for a given namespace and name (as strings)"
120 118 [ns name]
121   - (json/decode-from-str (:body (http/get (str *comments-api* ns "/"
  119 + (json/read-json (:body (http/get (str *comments-api* ns "/"
122 120 (fixup-name-url name))))))
123 121
124 122
@@ -162,7 +160,7 @@
162 160 (defn see-also-core
163 161 "Return 'see also' info from clojuredocs for a given namespace and name (as strings)"
164 162 ([ns name]
165   - (json/decode-from-str (:body (http/get (str *seealso-api* ns "/"
  163 + (json/read-json (:body (http/get (str *seealso-api* ns "/"
166 164 (fixup-name-url name)))))))
167 165
168 166

0 comments on commit 03c35d2

Please sign in to comment.
Something went wrong with that request. Please try again.