diff options
author | scgilardi <scgilardi@gmail.com> | 2008-07-29 00:32:21 +0000 |
---|---|---|
committer | scgilardi <scgilardi@gmail.com> | 2008-07-29 00:32:21 +0000 |
commit | 05c513add11855cfbaf2f9738a2680d61662ee6e (patch) | |
tree | 4fcb23e4e1bb52b71cb4b25b9eee51d2f2247248 | |
parent | 0345b7623e9b2e5f6658c18fa3a7e124230c19ba (diff) |
make package paths legal
-rw-r--r-- | def/def.clj | 2 | ||||
-rw-r--r-- | except/except.clj | 4 | ||||
-rw-r--r-- | lazy_seqs/lazy_seqs.clj (renamed from lazy-seqs/lazy_seqs.clj) | 0 | ||||
-rw-r--r-- | lib/lib.clj | 67 | ||||
-rw-r--r-- | memoize/memoize.clj | 2 | ||||
-rw-r--r-- | ns_utils/ns_utils.clj (renamed from ns-utils/ns_utils.clj) | 0 | ||||
-rw-r--r-- | pred/pred.clj | 2 | ||||
-rw-r--r-- | sql/sql.clj | 2 | ||||
-rw-r--r-- | string/string.clj | 2 |
9 files changed, 44 insertions, 37 deletions
diff --git a/def/def.clj b/def/def.clj index 1708eb94..ee7b3386 100644 --- a/def/def.clj +++ b/def/def.clj @@ -14,7 +14,7 @@ ;; scgilardi (gmail) ;; 17 May 2008 -(clojure/in-ns 'clojure-contrib.def) +(clojure/in-ns 'clojure.contrib.def) (clojure/refer 'clojure) (defmacro init-once diff --git a/except/except.clj b/except/except.clj index 69e1732c..a2fc8521 100644 --- a/except/except.clj +++ b/except/except.clj @@ -11,10 +11,10 @@ ;; scgilardi (gmail) ;; Created 07 July 2008 -(clojure/in-ns 'clojure-contrib.except) +(clojure/in-ns 'clojure.contrib.except) (clojure/refer 'clojure) -(clojure-contrib.lib/use '(clojure-contrib string)) +(clojure.contrib.lib/use '(clojure.contrib string)) (defn throw-if "Throws an exception with a message if pred is true. Arguments are: diff --git a/lazy-seqs/lazy_seqs.clj b/lazy_seqs/lazy_seqs.clj index 0680cb3e..0680cb3e 100644 --- a/lazy-seqs/lazy_seqs.clj +++ b/lazy_seqs/lazy_seqs.clj diff --git a/lib/lib.clj b/lib/lib.clj index e12c72c0..554a1821 100644 --- a/lib/lib.clj +++ b/lib/lib.clj @@ -27,40 +27,40 @@ ;; To load a namespace definition, lib.clj loads the namespace's 'root ;; lib'. The root lib's name is derived from the namespace name by ;; repeating the "leaf" portion of the namespace name. For example, the -;; root lib for the namespace 'clojure-contrib.def' is the lib named -;; 'clojure-contrib.def.def'. It is contained in the resource: +;; root lib for the namespace 'clojure.contrib.def' is the lib named +;; 'clojure.contrib.def.def'. It is contained in the resource: ;; -;; <classpath>/clojure-contrib/def/def.clj +;; <classpath>/clojure/contrib/def/def.clj ;; -;; The following code ensures that 'clojure-contrib.def and -;; 'clojure-contrib.sql are loaded: +;; The following code ensures that 'clojure.contrib.def and +;; 'clojure.contrib.sql are loaded: ;; -;; (require '(clojure-contrib def sql)) +;; (require '(clojure.contrib def sql)) ;; ;; In cases where the complete namespace is defined in more than one lib ;; all the libs should be contained within the hierarchy of directories ;; under the namespace directory and the root lib must (drectly or ;; indirectly) load the additional libs. For example, a hypothetical -;; namespace named 'clojure-contrib.math-funcs might be defined in +;; namespace named 'clojure.contrib.math-funcs might be defined in ;; multiple libs contained in resources like these: ;; -;; <classpath>/clojure-contrib/math-funcs/math-funcs.clj -;; <classpath>/clojure-contrib/math-funcs/trig.clj -;; <classpath>/clojure-contrib/math-funcs/logarithms.clj -;; <classpath>/clojure-contrib/math-funcs/bessel.clj -;; <classpath>/clojure-contrib/math-funcs/inverses/trig.clj -;; <classpath>/clojure-contrib/math-funcs/inverses/logarithms.clj +;; <classpath>/clojure/contrib/math-funcs/math-funcs.clj +;; <classpath>/clojure/contrib/math-funcs/trig.clj +;; <classpath>/clojure/contrib/math-funcs/logarithms.clj +;; <classpath>/clojure/contrib/math-funcs/bessel.clj +;; <classpath>/clojure/contrib/math-funcs/inverses/trig.clj +;; <classpath>/clojure/contrib/math-funcs/inverses/logarithms.clj ;; -;; The following code ensures that 'clojure-contrib.math-funcs is loaded: +;; The following code ensures that 'clojure.contrib.math-funcs is loaded: ;; -;; (require '(clojure-contrib math-funcs)) +;; (require '(clojure.contrib math-funcs)) ;; ;; This is the portion of math-funcs.clj that loads the remaining libs: ;; -;; (clojure/in-ns 'clojure-contrib.math-funcs) +;; (clojure/in-ns 'clojure.contrib.math-funcs) ;; -;; (clojure-contrib.lib/load-libs -;; '(clojure-contrib.math-funcs +;; (clojure.contrib.lib/load-libs +;; '(clojure.contrib.math-funcs ;; trig logarithms bessel inverses.trig inverses.logarithms)) ;; ;; lib.clj also provides general functions for finding and loading @@ -99,14 +99,14 @@ ;; ;; Examples ;; -;; (load-namespaces :require '(clojure-contrib sql sql.tests)) -;; (require '(clojure-contrib sql sql.tests)) +;; (load-namespaces :require '(clojure.contrib sql sql.tests)) +;; (require '(clojure.contrib sql sql.tests)) ;; -;; (load-namespaces :require :use '(clojure-contrib sql ns-utils) :verbose) -;; (use '(clojure-contrib sql ns-utils) :verbose) +;; (load-namespaces :require :use '(clojure.contrib sql ns-utils) :verbose) +;; (use '(clojure.contrib sql ns-utils) :verbose) ;; ;; (use :reload-all :verbose -;; '(clojure-contrib +;; '(clojure.contrib ;; (sql :exclude (get-connection) ;; :rename {execute-commands do-commands}) ;; ns-utils)) @@ -117,7 +117,7 @@ ;; Thanks to Stuart Sierra for providing many useful ideas, discussions ;; and code contributions for lib.clj. -(clojure/in-ns 'clojure-contrib.lib) +(clojure/in-ns 'clojure.contrib.lib) (clojure/refer 'clojure) (alias 'set 'clojure.set) @@ -208,18 +208,25 @@ (load-one sym url ns require) @*namespaces*)))) +(defn- name-path + "Returns a classpath-relative path given the name of a symbol" + [name] + (.. name + (replace \- \_) + (replace \. \/))) + (defn- lib-path "Returns the resource path for a lib" [lib-sym] - (str (.replace (name lib-sym) \. \/) ".clj")) + (str (name-path (name lib-sym)) ".clj")) (defn- root-lib-path "Returns the resource path for a namespace root lib" [ns-sym] - (let [n (name ns-sym) - index (inc (.lastIndexOf n (int \.))) - leaf (.substring n index)] - (str (.replace n \. \/) \/ leaf ".clj"))) + (let [n (name-path (name ns-sym)) + i (inc (.lastIndexOf n (int \/))) + leaf (.substring n i)] + (str n \/ leaf ".clj"))) (defn- load-lib "Loads a lib with options: sequential keywords and arguments." @@ -245,7 +252,7 @@ (when load (throw-if (not url) "'%s' not found in classpath" path) (when *verbose* - (printf "(clojure-contrib.lib/load-resource \"%s\")\n" url) + (printf "(clojure.contrib.lib/load-resource \"%s\")\n" url) (flush)) (load sym url namespace require)) (when namespace diff --git a/memoize/memoize.clj b/memoize/memoize.clj index 93978c6c..db782082 100644 --- a/memoize/memoize.clj +++ b/memoize/memoize.clj @@ -14,7 +14,7 @@ ;; Based on Common Lisp code from: ;; http://asymmetrical-view.com/talks/lisp-presentation/lisp-presentation.pdf -(clojure/in-ns 'clojure-contrib.memoize) +(clojure/in-ns 'clojure.contrib.memoize) (clojure/refer 'clojure) (defn memoize diff --git a/ns-utils/ns_utils.clj b/ns_utils/ns_utils.clj index 9b19bc22..9b19bc22 100644 --- a/ns-utils/ns_utils.clj +++ b/ns_utils/ns_utils.clj diff --git a/pred/pred.clj b/pred/pred.clj index 601888ce..b654a5e8 100644 --- a/pred/pred.clj +++ b/pred/pred.clj @@ -13,7 +13,7 @@ ;; scgilardi (gmail) ;; 28 June 2008 -(clojure/in-ns 'clojure-contrib.pred) +(clojure/in-ns 'clojure.contrib.pred) (clojure/refer 'clojure) (defn coll? diff --git a/sql/sql.clj b/sql/sql.clj index 6b32efd6..1f81b9b8 100644 --- a/sql/sql.clj +++ b/sql/sql.clj @@ -13,7 +13,7 @@ ;; scgilardi (gmail) ;; 23 April 2008 -(clojure/in-ns 'clojure-contrib.sql) +(clojure/in-ns 'clojure.contrib.sql) (clojure/refer 'clojure) (import '(java.sql DriverManager Connection PreparedStatement ResultSet)) diff --git a/string/string.clj b/string/string.clj index f1291977..f9445422 100644 --- a/string/string.clj +++ b/string/string.clj @@ -13,7 +13,7 @@ ;; scgilardi (gmail) ;; Created: 6 July 2008 -(clojure/in-ns 'clojure-contrib.string) +(clojure/in-ns 'clojure.contrib.string) (clojure/refer 'clojure) ;; until Clojure supports "..." arguments, calling String/format directly |