diff org/util.org @ 388:4c37d39a3cf6

removed dependency on swank, which had silently bit rotted. Restored functionality of mege-import-jme3.
author Robert McIntyre <rlm@mit.edu>
date Thu, 06 Jun 2013 10:09:37 -0400
parents 9fa92af29c3a
children 6ba908c1a0a9 a44d8a28cbea
line wrap: on
line diff
     1.1 --- a/org/util.org	Wed May 29 17:17:40 2013 -0400
     1.2 +++ b/org/util.org	Thu Jun 06 10:09:37 2013 -0400
     1.3 @@ -16,7 +16,7 @@
     1.4  #+name: import
     1.5  #+begin_src clojure :results silent
     1.6  (ns cortex.import
     1.7 -  (:require swank.util.class-browse))
     1.8 +  (:import java.io.File java.util.jar.JarFile))
     1.9  
    1.10  (defn permissive-import
    1.11    [classname]
    1.12 @@ -32,19 +32,34 @@
    1.13     ;;  upon being loaded.
    1.14     (not (re-matches #".*Lwjgl.*" classname))))
    1.15  
    1.16 -(defn jme-classes
    1.17 -  "returns a list of all jme3 classes"
    1.18 -  []
    1.19 +(defn jme-jars []
    1.20 +  (map 
    1.21 +   #(JarFile. (File. %))
    1.22 +   (filter (partial re-matches #".*jME3.*")
    1.23 +           (clojure.string/split
    1.24 +            (System/getProperty "java.class.path") #":"))))
    1.25 +
    1.26 +(defn jme-class-names []
    1.27    (filter
    1.28     jme-class?
    1.29 -   (map :name
    1.30 -        swank.util.class-browse/available-classes)))
    1.31 -  
    1.32 +   (map
    1.33 +    (comp
    1.34 +     #(.replace % File/separator ".")
    1.35 +     #(clojure.string/replace % ".class" ""))
    1.36 +    (filter
    1.37 +     (partial re-matches #".*\.class$")
    1.38 +     (mapcat
    1.39 +      #(map
    1.40 +        str
    1.41 +        (enumeration-seq
    1.42 +         (.entries %)))
    1.43 +      (jme-jars))))))
    1.44 +         
    1.45  (defn mega-import-jme3
    1.46    "Import ALL the jme classes. For REPL use."
    1.47    []
    1.48 -  (doall
    1.49 -   (map (comp permissive-import symbol) (jme-classes))))
    1.50 +  (dorun
    1.51 +   (map (comp permissive-import symbol) (jme-class-names))))
    1.52  #+end_src  
    1.53  
    1.54  jMonkeyEngine3 has a plethora of classes which can be overwhelming to