Only extend clojure.data.json if it is available

This commit is contained in:
Michael S. Klishin 2012-08-23 09:27:12 +04:00
parent 1a878b4c80
commit 430ca21d7c
3 changed files with 25 additions and 4 deletions

View file

@ -1,5 +1,12 @@
## Changes between 1.2.0-alpha1 and 1.2.0-beta1
### monger.joda-time no longer requires clojure.data.json
`monger.joda-time` no longer requires `clojure.data.json`. If `clojure.data.json` is available, it will be loaded
and extended. If not, `monger.joda-time` will only extend Clojure reader and BSON dates serialization/deserialization.
### MongoDB Java driver 2.9.0
MongoDB Java driver dependency has been updated to 2.9.0[-RC1].

View file

@ -46,7 +46,10 @@
[ring/ring-core "1.1.0"]]
:plugins [[codox "0.6.1"]]
:codox {:sources ["src/clojure"]
:output-dir "doc/api"}}}
:output-dir "doc/api"}}
;; only clj-time/JodaTime available, used to test monger.joda-time w/o clojure.data.json
:dev2 {:resource-paths ["test/resources"]
:dependencies [[clj-time "0.4.2" :exclusions [org.clojure/clojure]]]}}
:aliases {"all" ["with-profile" "dev:dev,1.4:dev,1.5"]
"ci" ["with-profile" "dev:dev,1.4:dev,1.5"]}
:repositories {"sonatype" {:url "http://oss.sonatype.org/content/repositories/releases"

View file

@ -17,9 +17,7 @@
To use it, make sure you add dependencies on clj-time (or JodaTime) and clojure.data.json."} monger.joda-time
(:import [org.joda.time DateTime DateTimeZone ReadableInstant]
[org.joda.time.format ISODateTimeFormat])
(:use [monger.conversion])
(:require [clojure.data.json :as json]
clojurewerkz.support.json))
(:use [monger.conversion]))
;;
;; API
@ -56,3 +54,16 @@
(defmethod print-dup org.joda.time.base.AbstractInstant
[^org.joda.time.base.AbstractInstant d out]
(print-dup (.toDate d) out))
;;
;; JSON serialization
;;
(try
;; try to load clojure.data.json. If available, load CLJW Support
;; extensions.
(require 'clojure.data.json)
(require 'clojurewerkz.support.json)
(catch Throwable _
false))