Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Start updating to 1.3

  • Loading branch information...
commit 03c35d2d1a5ad5b11fbcf1cee53087dead030233 1 parent 2a02420
Anthony Grimes authored
Showing with 16 additions and 19 deletions.
  1. +3 −4 project.clj
  2. +13 −15 src/cd_client/core.clj
7 project.clj
View
@@ -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"]])
28 src/cd_client/core.clj
View
@@ -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)))))))
Please sign in to comment.
Something went wrong with that request. Please try again.