Skip to content
Browse files

Moved into its own project

  • Loading branch information...
0 parents commit c4ee33d54201ec12a07d42fcc7846bd8bb83c7a6 @zk committed
5 .gitignore
@@ -0,0 +1,5 @@
+pom.xml
+*jar
+lib
+classes
+.DS_Store
36 README
@@ -0,0 +1,36 @@
+# cd-analyzer
+
+FIXME: write description
+
+## Usage
+
+FIXME: write
+
+## Installation
+
+FIXME: write
+
+## License
+
+Copyright (C) 2010 FIXME
+
+Distributed under the Eclipse Public License, the same as Clojure.
+
+
+Tested against:
+PASS
+http://github.com/mattrepl/clojure-twitter
+http://github.com/bradford/infer
+http://github.com/drcode/vijual
+http://github.com/ztellman/penumbra
+http://github.com/ztellman/calx
+http://github.com/ztellman/cantor.git
+http://github.com/weavejester/hiccup.git
+http://github.com/weavejester/clout.git
+http://github.com/clj-sys/clj-http.git
+
+FAIL
+http://github.com/somnium/congomongo.git
+http://github.com/ashafa/clutch.git
+http://github.com/hugoduncan/pallet.git
+
771 logs/enlive-import.log
@@ -0,0 +1,771 @@
+Running update for http://github.com/cgrand/enlive.git on Sat Aug 21 17:00:41 MDT 2010
+-----------------------------------------
+Cloning repo... Clone of http://github.com/cgrand/enlive.git successful.
+Done.
+Building / Installing
+Created /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/85e4ed0d-e19f-488b-8f44-d57f9cde3c0d5486779364091802895/enlive/enlive-1.0.0-SNAPSHOT.jar
+Wrote pom.xml
+[INFO] Installing /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/85e4ed0d-e19f-488b-8f44-d57f9cde3c0d5486779364091802895/enlive/enlive-1.0.0-SNAPSHOT.jar to /Users/zkim/.m2/repository/enlive/enlive/1.0.0-SNAPSHOT/enlive-1.0.0-SNAPSHOT.jar
+
+
+
+Updating Dependencies.
+Copying 10 files to /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/85e4ed0d-e19f-488b-8f44-d57f9cde3c0d5486779364091802895/temp-proj/lib
+Overriding previous definition of reference to cd-temp
+Overriding previous definition of reference to dependency.fileset
+Copying 3 files to /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/85e4ed0d-e19f-488b-8f44-d57f9cde3c0d5486779364091802895/temp-proj/lib/dev
+
+
+
+Running import process.
+enlive :: Import Library Task
+=========================================
+ 1 projects, 2 namespaces, 110 vars.
+ enlive (project)
+ net.cgrand.enlive-html (ns) Ok
+ net.cgrand.xml (ns) Ok
+ *self-closing-tags* (var) Ok
+ add-class (var) Ok
+ after (var) Ok
+ annotate (var) Ok
+ any (var) Ok
+ any-node (var) Ok
+ append (var) Ok
+ as-nodes (var) Ok
+ at (var) Ok
+ at* (var) Ok
+ attr-contains (var) Ok
+ attr-ends (var) Ok
+ attr-has (var) Ok
+ attr-starts (var) Ok
+ attr-values (var) Ok
+ attr= (var) Ok
+ attr? (var) Ok
+ attrs (var) Ok
+ attr|= (var) Ok
+ before (var) Ok
+ but (var) Ok
+ but-node (var) Ok
+ cacheable (var) Ok
+ cacheable? (var) Ok
+ clone-for (var) Ok
+ comment-node (var) Ok
+ comment? (var) Ok
+ content (var) Ok
+ content (var) Ok
+ defsnippet (var) Ok
+ defsnippets (var) Ok
+ deftemplate (var) Ok
+ do-> (var) Ok
+ document? (var) Ok
+ element (var) Ok
+ emit* (var) Ok
+ even (var) Ok
+ first-child (var) Ok
+ first-of-type (var) Ok
+ flatmap (var) Ok
+ flatten-nodes-coll (var) Ok
+ fragment-selector? (var) Ok
+ get-resource (var) Ok
+ has (var) Ok
+ has-class (var) Ok
+ html-content (var) Ok
+ html-resource (var) Ok
+ html-snippet (var) Ok
+ id= (var) Ok
+ intersection (var) Ok
+ last-child (var) Ok
+ last-of-type (var) Ok
+ left (var) Ok
+ lefts (var) Ok
+ let-select (var) Ok
+ lockstep-transform (var) Ok
+ lockstep-transformation (var) Ok
+ move (var) Ok
+ node-selector? (var) Ok
+ nth-child (var) Ok
+ nth-last-child (var) Ok
+ nth-last-of-type (var) Ok
+ nth-of-type (var) Ok
+ odd (var) Ok
+ only-child (var) Ok
+ only-of-type (var) Ok
+ parse (var) Ok
+ pred (var) Ok
+ prepend (var) Ok
+ re-pred (var) Ok
+ remove-attr (var) Ok
+ remove-class (var) Ok
+ right (var) Ok
+ rights (var) Ok
+ root (var) Ok
+ select (var) Ok
+ select-fragments* (var) Ok
+ select-nodes* (var) Ok
+ set-attr (var) Ok
+ snippet (var) Ok
+ snippet* (var) Ok
+ sniptest (var) Ok
+ sniptest* (var) Ok
+ startparse-sax (var) Ok
+ strict-mode (var) Ok
+ strict-mode* (var) Ok
+ substitute (var) Ok
+ tag (var) Ok
+ tag= (var) Ok
+ tag? (var) Ok
+ template (var) Ok
+ text (var) Ok
+ text-node (var) Ok
+ text-pred (var) Ok
+ texts (var) Ok
+ this-node (var) Ok
+ transform (var) Ok
+ transform-content (var) Ok
+ transformation (var) Ok
+ union (var) Ok
+ unwrap (var) Ok
+ void (var) Ok
+ whitespace (var) Ok
+ wrap (var) Ok
+ xml-resource (var) Ok
+ xml-zip (var) Ok
+ zip-pred (var) Ok
+ zip-select (var) Ok
+ zip-select-fragments* (var) Ok
+ zip-select-nodes* (var) Ok
+ *self-closing-tags* (0 references) Ok
+ add-class (6 references) Ok
+ after (2 references) Ok
+ annotate (5 references) Ok
+ any (1 references) Ok
+ any-node (1 references) Ok
+ append (3 references) Ok
+ as-nodes (1 references) Ok
+ at (8 references) Ok
+ at* (3 references) Ok
+ attr-contains (0 references) Ok
+ attr-ends (0 references) Ok
+ attr-has (3 references) Ok
+ attr-starts (0 references) Ok
+ attr-values (4 references) Ok
+ attr= (1 references) Ok
+ attr? (5 references) Ok
+ attrs (1 references) Ok
+ attr|= (0 references) Ok
+ before (2 references) Ok
+ but (1 references) Ok
+ but-node (2 references) Ok
+ cacheable (3 references) Ok
+ cacheable? (3 references) Ok
+ clone-for (8 references) Ok
+ comment-node (0 references) Ok
+ comment? (2 references) Ok
+ content (2 references) Ok
+ content (1 references) Ok
+ defsnippet (5 references) Ok
+ defsnippets (10 references) Ok
+ deftemplate (5 references) Ok
+ do-> (3 references) Ok
+ document? (2 references) Ok
+ element (1 references) Ok
+ emit* (1 references) Ok
+ even (0 references) Ok
+ first-child (0 references) Ok
+ first-of-type (0 references) Ok
+ flatmap (2 references) Ok
+ flatten-nodes-coll (2 references) Ok
+ fragment-selector? (2 references) Ok
+ get-resource (3 references) Ok
+ has (1 references) Ok
+ has-class (2 references) Ok
+ html-content (3 references) Ok
+ html-resource (1 references) Ok
+ html-snippet (5 references) Ok
+ id= (3 references) Ok
+ intersection (9 references) Ok
+ last-child (0 references) Ok
+ last-of-type (0 references) Ok
+ left (3 references) Ok
+ lefts (3 references) Ok
+ let-select (10 references) Ok
+ lockstep-transform (2 references) Ok
+ lockstep-transformation (9 references) Ok
+ move (4 references) Ok
+ node-selector? (2 references) Ok
+ nth-child (1 references) Ok
+ nth-last-child (1 references) Ok
+ nth-last-of-type (1 references) Ok
+ nth-of-type (1 references) Ok
+ odd (0 references) Ok
+ only-child (0 references) Ok
+ only-of-type (0 references) Ok
+ parse (9 references) Ok
+ pred (1 references) Ok
+ prepend (3 references) Ok
+ re-pred (2 references) Ok
+ remove-attr (4 references) Ok
+ remove-class (3 references) Ok
+ right (3 references) Ok
+ rights (3 references) Ok
+ root (2 references) Ok
+ select (2 references) Ok
+ select-fragments* (3 references) Ok
+ select-nodes* (3 references) Ok
+ set-attr (3 references) Ok
+ snippet (4 references) Ok
+ snippet* (9 references) Ok
+ sniptest (4 references) Ok
+ sniptest* (3 references) Ok
+ startparse-sax (3 references) Ok
+ strict-mode (4 references) Ok
+ strict-mode* (0 references) Ok
+ substitute (2 references) Ok
+ tag (1 references) Ok
+ tag= (2 references) Ok
+ tag? (0 references) Ok
+ template (5 references) Ok
+ text (6 references) Ok
+ text-node (1 references) Ok
+ text-pred (4 references) Ok
+ texts (2 references) Ok
+ this-node (0 references) Ok
+ transform (4 references) Ok
+ transform-content (9 references) Ok
+ transformation (8 references) Ok
+ union (9 references) Ok
+ unwrap (0 references) Ok
+ void (2 references) Ok
+ whitespace (0 references) Ok
+ wrap (2 references) Ok
+ xml-resource (1 references) Ok
+ xml-zip (5 references) Ok
+ zip-pred (2 references) Ok
+ zip-select (2 references) Ok
+ zip-select-fragments* (2 references) Ok
+ zip-select-nodes* (3 references) Ok
+ Looking for vars to remove...
+ No vars removed.
+=========================================
+ 1 projects, 2 namespaces, 110 vars found in enlive
+ Took 10.973s
+
+
+
+-----------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Running update for http://github.com/cgrand/enlive.git on Sat Aug 21 17:01:25 MDT 2010
+-----------------------------------------
+Cloning repo... Clone of http://github.com/cgrand/enlive.git successful.
+Done.
+Building / Installing
+Created /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/ef9c6dbe-f5a0-4860-938e-38aafa20c1e02415698526588195303/enlive/enlive-1.0.0-SNAPSHOT.jar
+Wrote pom.xml
+[INFO] Installing /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/ef9c6dbe-f5a0-4860-938e-38aafa20c1e02415698526588195303/enlive/enlive-1.0.0-SNAPSHOT.jar to /Users/zkim/.m2/repository/enlive/enlive/1.0.0-SNAPSHOT/enlive-1.0.0-SNAPSHOT.jar
+
+
+
+Updating Dependencies.
+Copying 10 files to /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/ef9c6dbe-f5a0-4860-938e-38aafa20c1e02415698526588195303/temp-proj/lib
+Overriding previous definition of reference to cd-temp
+Overriding previous definition of reference to dependency.fileset
+Copying 3 files to /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/ef9c6dbe-f5a0-4860-938e-38aafa20c1e02415698526588195303/temp-proj/lib/dev
+
+
+
+Running import process.
+enlive :: Import Library Task
+=========================================
+ 1 projects, 2 namespaces, 110 vars.
+ enlive (project)
+ net.cgrand.enlive-html (ns) Ok
+ net.cgrand.xml (ns) Ok
+ *self-closing-tags* (var) Ok
+ add-class (var) Ok
+ after (var) Ok
+ annotate (var) Ok
+ any (var) Ok
+ any-node (var) Ok
+ append (var) Ok
+ as-nodes (var) Ok
+ at (var) Ok
+ at* (var) Ok
+ attr-contains (var) Ok
+ attr-ends (var) Ok
+ attr-has (var) Ok
+ attr-starts (var) Ok
+ attr-values (var) Ok
+ attr= (var) Ok
+ attr? (var) Ok
+ attrs (var) Ok
+ attr|= (var) Ok
+ before (var) Ok
+ but (var) Ok
+ but-node (var) Ok
+ cacheable (var) Ok
+ cacheable? (var) Ok
+ clone-for (var) Ok
+ comment-node (var) Ok
+ comment? (var) Ok
+ content (var) Ok
+ content (var) Ok
+ defsnippet (var) Ok
+ defsnippets (var) Ok
+ deftemplate (var) Ok
+ do-> (var) Ok
+ document? (var) Ok
+ element (var) Ok
+ emit* (var) Ok
+ even (var) Ok
+ first-child (var) Ok
+ first-of-type (var) Ok
+ flatmap (var) Ok
+ flatten-nodes-coll (var) Ok
+ fragment-selector? (var) Ok
+ get-resource (var) Ok
+ has (var) Ok
+ has-class (var) Ok
+ html-content (var) Ok
+ html-resource (var) Ok
+ html-snippet (var) Ok
+ id= (var) Ok
+ intersection (var) Ok
+ last-child (var) Ok
+ last-of-type (var) Ok
+ left (var) Ok
+ lefts (var) Ok
+ let-select (var) Ok
+ lockstep-transform (var) Ok
+ lockstep-transformation (var) Ok
+ move (var) Ok
+ node-selector? (var) Ok
+ nth-child (var) Ok
+ nth-last-child (var) Ok
+ nth-last-of-type (var) Ok
+ nth-of-type (var) Ok
+ odd (var) Ok
+ only-child (var) Ok
+ only-of-type (var) Ok
+ parse (var) Ok
+ pred (var) Ok
+ prepend (var) Ok
+ re-pred (var) Ok
+ remove-attr (var) Ok
+ remove-class (var) Ok
+ right (var) Ok
+ rights (var) Ok
+ root (var) Ok
+ select (var) Ok
+ select-fragments* (var) Ok
+ select-nodes* (var) Ok
+ set-attr (var) Ok
+ snippet (var) Ok
+ snippet* (var) Ok
+ sniptest (var) Ok
+ sniptest* (var) Ok
+ startparse-sax (var) Ok
+ strict-mode (var) Ok
+ strict-mode* (var) Ok
+ substitute (var) Ok
+ tag (var) Ok
+ tag= (var) Ok
+ tag? (var) Ok
+ template (var) Ok
+ text (var) Ok
+ text-node (var) Ok
+ text-pred (var) Ok
+ texts (var) Ok
+ this-node (var) Ok
+ transform (var) Ok
+ transform-content (var) Ok
+ transformation (var) Ok
+ union (var) Ok
+ unwrap (var) Ok
+ void (var) Ok
+ whitespace (var) Ok
+ wrap (var) Ok
+ xml-resource (var) Ok
+ xml-zip (var) Ok
+ zip-pred (var) Ok
+ zip-select (var) Ok
+ zip-select-fragments* (var) Ok
+ zip-select-nodes* (var) Ok
+ *self-closing-tags* (0 references) Ok
+ add-class (6 references) Ok
+ after (2 references) Ok
+ annotate (5 references) Ok
+ any (1 references) Ok
+ any-node (1 references) Ok
+ append (3 references) Ok
+ as-nodes (1 references) Ok
+ at (8 references) Ok
+ at* (3 references) Ok
+ attr-contains (0 references) Ok
+ attr-ends (0 references) Ok
+ attr-has (3 references) Ok
+ attr-starts (0 references) Ok
+ attr-values (4 references) Ok
+ attr= (1 references) Ok
+ attr? (5 references) Ok
+ attrs (1 references) Ok
+ attr|= (0 references) Ok
+ before (2 references) Ok
+ but (1 references) Ok
+ but-node (2 references) Ok
+ cacheable (3 references) Ok
+ cacheable? (3 references) Ok
+ clone-for (8 references) Ok
+ comment-node (0 references) Ok
+ comment? (2 references) Ok
+ content (2 references) Ok
+ content (1 references) Ok
+ defsnippet (5 references) Ok
+ defsnippets (10 references) Ok
+ deftemplate (5 references) Ok
+ do-> (3 references) Ok
+ document? (2 references) Ok
+ element (1 references) Ok
+ emit* (1 references) Ok
+ even (0 references) Ok
+ first-child (0 references) Ok
+ first-of-type (0 references) Ok
+ flatmap (2 references) Ok
+ flatten-nodes-coll (2 references) Ok
+ fragment-selector? (2 references) Ok
+ get-resource (3 references) Ok
+ has (1 references) Ok
+ has-class (2 references) Ok
+ html-content (3 references) Ok
+ html-resource (1 references) Ok
+ html-snippet (5 references) Ok
+ id= (3 references) Ok
+ intersection (9 references) Ok
+ last-child (0 references) Ok
+ last-of-type (0 references) Ok
+ left (3 references) Ok
+ lefts (3 references) Ok
+ let-select (10 references) Ok
+ lockstep-transform (2 references) Ok
+ lockstep-transformation (9 references) Ok
+ move (4 references) Ok
+ node-selector? (2 references) Ok
+ nth-child (1 references) Ok
+ nth-last-child (1 references) Ok
+ nth-last-of-type (1 references) Ok
+ nth-of-type (1 references) Ok
+ odd (0 references) Ok
+ only-child (0 references) Ok
+ only-of-type (0 references) Ok
+ parse (9 references) Ok
+ pred (1 references) Ok
+ prepend (3 references) Ok
+ re-pred (2 references) Ok
+ remove-attr (4 references) Ok
+ remove-class (3 references) Ok
+ right (3 references) Ok
+ rights (3 references) Ok
+ root (2 references) Ok
+ select (2 references) Ok
+ select-fragments* (3 references) Ok
+ select-nodes* (3 references) Ok
+ set-attr (3 references) Ok
+ snippet (4 references) Ok
+ snippet* (9 references) Ok
+ sniptest (4 references) Ok
+ sniptest* (3 references) Ok
+ startparse-sax (3 references) Ok
+ strict-mode (4 references) Ok
+ strict-mode* (0 references) Ok
+ substitute (2 references) Ok
+ tag (1 references) Ok
+ tag= (2 references) Ok
+ tag? (0 references) Ok
+ template (5 references) Ok
+ text (6 references) Ok
+ text-node (1 references) Ok
+ text-pred (4 references) Ok
+ texts (2 references) Ok
+ this-node (0 references) Ok
+ transform (4 references) Ok
+ transform-content (9 references) Ok
+ transformation (8 references) Ok
+ union (9 references) Ok
+ unwrap (0 references) Ok
+ void (2 references) Ok
+ whitespace (0 references) Ok
+ wrap (2 references) Ok
+ xml-resource (1 references) Ok
+ xml-zip (5 references) Ok
+ zip-pred (2 references) Ok
+ zip-select (2 references) Ok
+ zip-select-fragments* (2 references) Ok
+ zip-select-nodes* (3 references) Ok
+ Looking for vars to remove...
+ No vars removed.
+=========================================
+ 1 projects, 2 namespaces, 110 vars found in enlive
+ Took 11.302s
+
+
+
+-----------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Running update for http://github.com/cgrand/enlive.git on Sat Aug 21 17:11:17 MDT 2010
+-----------------------------------------
+Cloning repo... Clone of http://github.com/cgrand/enlive.git successful.
+Done.
+Building / Installing
+Created /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/0b6f78a4-e08b-459c-a74e-6e06570ae5042987091527333013124/enlive/enlive-1.0.0-SNAPSHOT.jar
+Wrote pom.xml
+[INFO] Installing /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/0b6f78a4-e08b-459c-a74e-6e06570ae5042987091527333013124/enlive/enlive-1.0.0-SNAPSHOT.jar to /Users/zkim/.m2/repository/enlive/enlive/1.0.0-SNAPSHOT/enlive-1.0.0-SNAPSHOT.jar
+
+
+
+Updating Dependencies.
+Copying 10 files to /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/0b6f78a4-e08b-459c-a74e-6e06570ae5042987091527333013124/temp-proj/lib
+Overriding previous definition of reference to cd-temp
+Overriding previous definition of reference to dependency.fileset
+Copying 3 files to /private/var/folders/zz/zZa-nlUYFDGIpRKFdW3kUk+++TI/-Tmp-/0b6f78a4-e08b-459c-a74e-6e06570ae5042987091527333013124/temp-proj/lib/dev
+
+
+
+Running import process.
+enlive :: Import Library Task
+=========================================
+ 1 projects, 2 namespaces, 110 vars.
+ enlive (project)
+ net.cgrand.enlive-html (ns) Ok
+ net.cgrand.xml (ns) Ok
+ *self-closing-tags* (var) Ok
+ add-class (var) Ok
+ after (var) Ok
+ annotate (var) Ok
+ any (var) Ok
+ any-node (var) Ok
+ append (var) Ok
+ as-nodes (var) Ok
+ at (var) Ok
+ at* (var) Ok
+ attr-contains (var) Ok
+ attr-ends (var) Ok
+ attr-has (var) Ok
+ attr-starts (var) Ok
+ attr-values (var) Ok
+ attr= (var) Ok
+ attr? (var) Ok
+ attrs (var) Ok
+ attr|= (var) Ok
+ before (var) Ok
+ but (var) Ok
+ but-node (var) Ok
+ cacheable (var) Ok
+ cacheable? (var) Ok
+ clone-for (var) Ok
+ comment-node (var) Ok
+ comment? (var) Ok
+ content (var) Ok
+ content (var) Ok
+ defsnippet (var) Ok
+ defsnippets (var) Ok
+ deftemplate (var) Ok
+ do-> (var) Ok
+ document? (var) Ok
+ element (var) Ok
+ emit* (var) Ok
+ even (var) Ok
+ first-child (var) Ok
+ first-of-type (var) Ok
+ flatmap (var) Ok
+ flatten-nodes-coll (var) Ok
+ fragment-selector? (var) Ok
+ get-resource (var) Ok
+ has (var) Ok
+ has-class (var) Ok
+ html-content (var) Ok
+ html-resource (var) Ok
+ html-snippet (var) Ok
+ id= (var) Ok
+ intersection (var) Ok
+ last-child (var) Ok
+ last-of-type (var) Ok
+ left (var) Ok
+ lefts (var) Ok
+ let-select (var) Ok
+ lockstep-transform (var) Ok
+ lockstep-transformation (var) Ok
+ move (var) Ok
+ node-selector? (var) Ok
+ nth-child (var) Ok
+ nth-last-child (var) Ok
+ nth-last-of-type (var) Ok
+ nth-of-type (var) Ok
+ odd (var) Ok
+ only-child (var) Ok
+ only-of-type (var) Ok
+ parse (var) Ok
+ pred (var) Ok
+ prepend (var) Ok
+ re-pred (var) Ok
+ remove-attr (var) Ok
+ remove-class (var) Ok
+ right (var) Ok
+ rights (var) Ok
+ root (var) Ok
+ select (var) Ok
+ select-fragments* (var) Ok
+ select-nodes* (var) Ok
+ set-attr (var) Ok
+ snippet (var) Ok
+ snippet* (var) Ok
+ sniptest (var) Ok
+ sniptest* (var) Ok
+ startparse-sax (var) Ok
+ strict-mode (var) Ok
+ strict-mode* (var) Ok
+ substitute (var) Ok
+ tag (var) Ok
+ tag= (var) Ok
+ tag? (var) Ok
+ template (var) Ok
+ text (var) Ok
+ text-node (var) Ok
+ text-pred (var) Ok
+ texts (var) Ok
+ this-node (var) Ok
+ transform (var) Ok
+ transform-content (var) Ok
+ transformation (var) Ok
+ union (var) Ok
+ unwrap (var) Ok
+ void (var) Ok
+ whitespace (var) Ok
+ wrap (var) Ok
+ xml-resource (var) Ok
+ xml-zip (var) Ok
+ zip-pred (var) Ok
+ zip-select (var) Ok
+ zip-select-fragments* (var) Ok
+ zip-select-nodes* (var) Ok
+ *self-closing-tags* (0 references) Ok
+ add-class (6 references) Ok
+ after (2 references) Ok
+ annotate (5 references) Ok
+ any (1 references) Ok
+ any-node (1 references) Ok
+ append (3 references) Ok
+ as-nodes (1 references) Ok
+ at (8 references) Ok
+ at* (3 references) Ok
+ attr-contains (0 references) Ok
+ attr-ends (0 references) Ok
+ attr-has (3 references) Ok
+ attr-starts (0 references) Ok
+ attr-values (4 references) Ok
+ attr= (1 references) Ok
+ attr? (5 references) Ok
+ attrs (1 references) Ok
+ attr|= (0 references) Ok
+ before (2 references) Ok
+ but (1 references) Ok
+ but-node (2 references) Ok
+ cacheable (3 references) Ok
+ cacheable? (3 references) Ok
+ clone-for (8 references) Ok
+ comment-node (0 references) Ok
+ comment? (2 references) Ok
+ content (2 references) Ok
+ content (1 references) Ok
+ defsnippet (5 references) Ok
+ defsnippets (10 references) Ok
+ deftemplate (5 references) Ok
+ do-> (3 references) Ok
+ document? (2 references) Ok
+ element (1 references) Ok
+ emit* (1 references) Ok
+ even (0 references) Ok
+ first-child (0 references) Ok
+ first-of-type (0 references) Ok
+ flatmap (2 references) Ok
+ flatten-nodes-coll (2 references) Ok
+ fragment-selector? (2 references) Ok
+ get-resource (3 references) Ok
+ has (1 references) Ok
+ has-class (2 references) Ok
+ html-content (3 references) Ok
+ html-resource (1 references) Ok
+ html-snippet (5 references) Ok
+ id= (3 references) Ok
+ intersection (9 references) Ok
+ last-child (0 references) Ok
+ last-of-type (0 references) Ok
+ left (3 references) Ok
+ lefts (3 references) Ok
+ let-select (10 references) Ok
+ lockstep-transform (2 references) Ok
+ lockstep-transformation (9 references) Ok
+ move (4 references) Ok
+ node-selector? (2 references) Ok
+ nth-child (1 references) Ok
+ nth-last-child (1 references) Ok
+ nth-last-of-type (1 references) Ok
+ nth-of-type (1 references) Ok
+ odd (0 references) Ok
+ only-child (0 references) Ok
+ only-of-type (0 references) Ok
+ parse (9 references) Ok
+ pred (1 references) Ok
+ prepend (3 references) Ok
+ re-pred (2 references) Ok
+ remove-attr (4 references) Ok
+ remove-class (3 references) Ok
+ right (3 references) Ok
+ rights (3 references) Ok
+ root (2 references) Ok
+ select (2 references) Ok
+ select-fragments* (3 references) Ok
+ select-nodes* (3 references) Ok
+ set-attr (3 references) Ok
+ snippet (4 references) Ok
+ snippet* (9 references) Ok
+ sniptest (4 references) Ok
+ sniptest* (3 references) Ok
+ startparse-sax (3 references) Ok
+ strict-mode (4 references) Ok
+ strict-mode* (0 references) Ok
+ substitute (2 references) Ok
+ tag (1 references) Ok
+ tag= (2 references) Ok
+ tag? (0 references) Ok
+ template (5 references) Ok
+ text (6 references) Ok
+ text-node (1 references) Ok
+ text-pred (4 references) Ok
+ texts (2 references) Ok
+ this-node (0 references) Ok
+ transform (4 references) Ok
+ transform-content (9 references) Ok
+ transformation (8 references) Ok
+ union (9 references) Ok
+ unwrap (0 references) Ok
+ void (2 references) Ok
+ whitespace (0 references) Ok
+ wrap (2 references) Ok
+ xml-resource (1 references) Ok
+ xml-zip (5 references) Ok
+ zip-pred (2 references) Ok
+ zip-select (2 references) Ok
+ zip-select-fragments* (2 references) Ok
+ zip-select-nodes* (3 references) Ok
+ Looking for vars to remove...
+ No vars removed.
+=========================================
+ 1 projects, 2 namespaces, 110 vars found in enlive
+ Took 10.711s
+
+
+
+-----------------------------------------
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
22 project.clj
@@ -0,0 +1,22 @@
+(defproject cd-analyzer "0.1.0-SNAPSHOT"
+ :description "FIXME: write"
+ :dependencies [[org.clojure/clojure "1.2.0-RC1"]
+ [org.clojure/clojure-contrib "1.2.0-RC1"]
+ [mysql/mysql-connector-java "5.1.12"]
+ [org.slf4j/slf4j-api "1.6.1"]
+ [ch.qos.logback/logback-classic "0.9.24"]
+ [clj-stacktrace "0.1.3"]]
+ :dev-dependencies [[leiningen/lein-swank "1.2.0-SNAPSHOT"]
+ [lein-run "1.0.0-SNAPSHOT"]
+ [com.stuartsierra/lazytest "1.0.0-SNAPSHOT"]
+ [leiningen "1.3.1-SNAPSHOT"]
+ [swank-clojure "1.2.0"]
+ [clj-ssh "0.2.0-SNAPSHOT"]
+ [pallet "0.2.0-SNAPSHOT"]
+ [enlive "1.0.0-SNAPSHOT"]
+ [circumspec "0.0.12"]
+ [midje "0.1.1"]
+ [ring "0.2.5"]
+ [incanter "1.2.3-SNAPSHOT"]
+ [trammel "0.1.0"]]
+ :main main)
0 resources/cljs-in/one.clj
No changes.
0 resources/cljs-in/three.clj
No changes.
0 resources/cljs-in/two.clj
No changes.
12 resources/clojure-git/config
@@ -0,0 +1,12 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = false
+ logallrefupdates = true
+ ignorecase = true
+[remote "origin"]
+ fetch = +refs/heads/*:refs/remotes/origin/*
+ url = http://github.com/clojure/clojure.git
+[branch "master"]
+ remote = origin
+ merge = refs/heads/master
1 resources/clojure-git/refs/heads/master
@@ -0,0 +1 @@
+77be185a6ca00a338a6647462e14206bad0e9802
11 resources/empty-git/config
@@ -0,0 +1,11 @@
+[core]
+ repositoryformatversion = 0
+ filemode = true
+ bare = false
+ logallrefupdates = true
+ ignorecase = true
+[remote "origin"]
+ fetch = +refs/heads/*:refs/remotes/origin/*
+[branch "master"]
+ remote = origin
+ merge = refs/heads/master
3 resources/file-to-ns-str/comment-before-ns.clj
@@ -0,0 +1,3 @@
+;testing 1 2 3
+(ns comment.before.ns
+ (:use [one.two.three]))
1 resources/file-to-ns-str/easy.clj
@@ -0,0 +1 @@
+(ns hello.world)
372 src/cd_analyzer/clojurecore.clj
@@ -0,0 +1,372 @@
+(ns cd-analyzer.clojurecore
+ (:use [hiccup.core]
+ [cd-analyzer.core]
+ [clojure.contrib.sql]
+ [clojure.contrib.pprint])
+ (:require [clojure.zip :as zip]))
+
+(declare db)
+(def spheres [{:name "Simple Values"
+ :categories [{:name "Numbers"
+ :groups [{:name "Arithmetic"
+ :symbols '(+ - * / quot rem mod inc dec max min with-precision)}
+ {:name "Compare"
+ :symbols '(= == not= < > <= >=)}
+ {:name "Bitwise Operations"
+ :symbols '(bit-and bit-or bit-xor bit-flip bit-not bit-clear bit-set bit-shift-left bit-shift-right bit-test)}
+ {:name "Cast"
+ :symbols '(byte short int long float double bigint bigdec num rationalize)}
+ {:name "Test"
+ :symbols '(nil? identical? zero? pos? neg? even? odd?)}]}
+ {:name "Symbols / Keywords"
+ :groups [{:name "Create"
+ :symbols '(keyword symbol)}
+ {:name "Use"
+ :symbols '(name intern namespace)}
+ {:name "Test"
+ :symbols '(keyword? symbol?)}]}
+ {:name "Strings / Characters"
+ :groups [{:name "Create"
+ :symbols '(str print-str println-str pr-str prn-str with-out-str)}
+ {:name "Use"
+ :symbols '(count get subs format)}
+ {:name "Cast / Test"
+ :symbols '(char char? string?)}]}
+ {:name "Regular Expressions"
+ :groups [{:name "Create"
+ :symbols '(re-pattern re-matcher)}
+ {:name "Use"
+ :symbols '(re-find re-matches re-seq re-groups)}]}]}
+ {:name "Operations"
+ :categories [{:name "Flow Control"
+ :groups [{:name "Normal"
+ :symbols '(if if-not if-let when when-not when-let when-first cond condp case do eval loop recur trampoline while)}
+ {:name "Exceptional"
+ :symbols '(try catch finally throw assert)}
+ {:name "Delay"
+ :symbols '(delay delay? deref force)}
+ {:name "Function Based"
+ :symbols '(repeatedly iterate)}
+ {:name "Sequence Based"
+ :symbols '(dotimes doseq for)}
+ {:name "Laziness"
+ :symbols '(lazy-seq lazy-cat doall dorun)}]}
+ {:name "Type Inspection"
+ :groups [{:name "Clojure Types"
+ :symbols '(type extends? satisfies?)}
+ {:name "Java Types"
+ :symbols '(class bases supers class? instance? isa? cast)}]}
+ {:name "Concurrency"
+ :groups [{:name "General"
+ :symbols '(deref get-validator set-validator!)}
+ {:name "Atoms"
+ :symbols '(atom swap! reset! compare-and-set!)}
+ {:name "Refs"
+ :symbols '(ref sync dosync ref-set alter commute ensure io! ref-history-count ref-max-history ref-min-history)}
+ {:name "Agents"
+ :symbols '(agent send send-off await await-for agent-error restart-agent shutdown-agents *agent* error-handler set-error-handler! error-mode set-error-mode! release-pending-sends)}
+ {:name "Futures"
+ :symbols '(future future-call future-done? future-cancel future-cancelled? future?)}
+ {:name "Thread Local Values"
+ :symbols '(bound-fn bound-fn* get-thread-bindings push-thread-bindings pop-thread-bindings thread-bound?)}
+ {:name "Misc"
+ :symbols '(locking pcalls pvalues pmap seque promise deliver add-watch remove-watch)}]}]}
+
+ {:name "Functions"
+ :categories [{:name "General"
+ :groups [{:name "Create"
+ :symbols '(fn defn defn- definline identity constantly memfn comp complement partial juxt memoize)}
+ {:name "Call"
+ :symbols '(-> ->> apply)}
+ {:name "Test"
+ :symbols '(fn? ifn?)}]}
+ {:name "Multifunctions"
+ :groups [{:name "Create"
+ :symbols '(defmulti defmethod)}
+ {:name "Inspect and Modify"
+ :symbols '(get-method methods prefer-method prefers remove-method remove-all-methods)}]}
+ {:name "Macros"
+ :groups [{:name "Create"
+ :symbols '(defmacro macroexpand macroexpand-1 gensym)}]}
+ {:name "Java Interop"
+ :groups [{:name "Use"
+ :symbols '(doto .. set!)}
+ {:name "Arrays"
+ :symbols '(make-array object-array boolean-array byte-array char-array short-array int-array long-array float-array double-array aclone to-array to-array-2d into-array)}
+ {:name "Use"
+ :symbols '(aget aset aset-boolean aset-char aset-byte aset-int aset-long aset-short aset-float aset-double alength amap areduce)}
+ {:name "Cast"
+ :symbols '(booleans bytes chars ints shorts longs floats doubles)}]}
+ {:name "Proxies"
+ :groups [{:name "Create"
+ :symbols '(proxy get-proxy-class construct-proxy init-proxy)}
+ {:name "Misc"
+ :symbols '(proxy-mappings proxy-super update-proxy)}]}]}
+ {:name "Collections / Sequences"
+ :categories [{:name "Collections"
+ :groups [{:name "Generic Operations"
+ :symbols '(count empty not-empty into conj)}
+ {:name "Content Tests"
+ :symbols '(contains? distinct? empty? every? not-every? some not-any?)}
+ {:name "Capabilities"
+ :symbols '(sequential? associative? sorted? counted? reversible?)}
+ {:name "Type Tests"
+ :symbols '(coll? seq? vector? list? map? set?)}]}
+ {:name "Vectors"
+ :groups [{:name "Create"
+ :symbols '(vec vector vector-of)}
+ {:name "Use"
+ :symbols '(conj peek pop get assoc subvec rseq)}]}
+ {:name "Lists"
+ :groups [{:name "Create"
+ :symbols '(list list*)}
+ {:name "Use"
+ :symbols '(cons conj peek pop first rest)}]}
+ {:name "Maps"
+ :groups [{:name "Create"
+ :symbols '(hash-map array-map zipmap sorted-map sorted-map-by bean frequencies)}
+ {:name "Use"
+ :symbols '(assoc assoc-in dissoc find key val keys vals get get-in update-in select-keys merge merge-with)}
+ {:name "Use (Sorted Maps)"
+ :symbols '(rseq subseq subseq rsubseq rsubseq)}]}
+ {:name "Sets"
+ :groups [{:name "Create"
+ :symbols '(hash-set set sorted-set sorted-set-by)}
+ {:name "Use"
+ :symbols '(conj disj get)}]}
+ {:name "Structs"
+ :groups [{:name "Create"
+ :symbols '(defstruct create-struct struct struct-map accessor)}
+ {:name "Use"
+ :symbols '(get assoc)}]}
+ {:name "Sequences"
+ :groups [{:name "Create"
+ :symbols '(seq sequence repeat replicate range repeatedly iterate lazy-seq lazy-cat cycle interleave interpose tree-seq xml-seq enumeration-seq iterator-seq file-seq line-seq resultset-seq)}
+ {:name "Use (General)"
+ :symbols '(first second last rest next ffirst nfirst fnext nnext nth nthnext rand-nth butlast take take-last take-nth take-while drop drop-last drop-while keep keep-indexed)}
+ {:name "Use ('Modification')"
+ :symbols '(conj concat distinct group-by partition partition-all partition-by split-at split-with filter remove replace shuffle)}
+ {:name "Use (Iteration)"
+ :symbols '(for doseq map map-indexed mapcat reduce reductions max-key min-key doall dorun)}]}
+ {:name "Transients"
+ :groups [{:name "Create"
+ :symbols '(transient persistent!)}
+ {:name "Use (General)"
+ :symbols '(conj! pop! assoc! dissoc! disj!)}
+ {:name "Use ('Modification')"
+ :symbols '(conj concat distinct group-by partition partition-all partition-by split-at split-with filter remove replace shuffle)}
+ {:name "Use (Iteration)"
+ :symbols '(for doseq map map-indexed mapcat reduce reductions max-key min-key doall dorun)}]}]}
+ {:name "Code Structure"
+ :categories [{:name "Varibles"
+ :groups [{:name "Create"
+ :symbols '(def defonce intern declare)}
+ {:name "Use"
+ :symbols '(set! alter-var-root binding with-bindings with-bindings* with-local-vars letfn gensym)}
+ {:name "Inspect"
+ :symbols '(var find-var var-get var? bound? resolve ns-resolve special-symbol?)}]}
+ {:name "Namespaces"
+ :groups [{:name "Create &amp; Delete"
+ :symbols '(ns create-ns remove-ns)}
+ {:name "Inspect"
+ :symbols '(*ns* ns-name all-ns the-ns find-ns ns-publics ns-interns ns-refers ns-aliases ns-imports ns-map)}
+ {:name "Use"
+ :symbols '(in-ns ns-resolve ns-unalias ns-unmap alias)}
+ {:name "Misc"
+ :symbols '(namespace-munge print-namespace-doc)}]}
+ {:name "Hierarchies"
+ :groups [{:name "General"
+ :symbols '(make-hierarchy derive underive parents ancestors descendants isa?)}]}
+ {:name "User Defined Types"
+ :groups [{:name "General"
+ :symbols '(defprotocol defrecord deftype reify extend extend-protocol extend-type extenders)}]}
+ {:name "Metadata"
+ :groups [{:name "General"
+ :symbols '(meta with-meta vary-meta reset-meta! alter-meta!)}]}]}
+ {:name "Environment"
+ :categories [{:name "Require / Import"
+ :groups [{:name "General"
+ :symbols '(use require import refer-clojure refer)}]}
+ {:name "Code"
+ :groups [{:name "General"
+ :symbols '(*compile-files* *compile-path* *file* *warn-on-reflection* compile load load-file load-reader load-string read read-string gen-class gen-interface loaded-libs test)}]}
+ {:name "IO"
+ :groups [{:name "General"
+ :symbols '(*in* *out* *err* print printf println pr prn print-str println-str pr-str prn-str newline flush read-line slurp spit with-in-str with-out-str with-open)}]}
+ {:name "REPL"
+ :groups [{:name "General"
+ :symbols '(*1 *2 *3 *e *print-dup* *print-length* *print-level* *print-meta* *print-readably* )}]}
+ {:name "Misc"
+ :groups [{:name "General"
+ :symbols '(*clojure-version* clojure-version *command-line-args* time)}]}]}])
+
+#_(spit "/Users/zkim/napplelabs/clojuredocs/cd-site/app/cc_quick_ref.rb" (rubify-spheres spheres))
+
+
+(def rubify-map nil)
+(def rubify-seq nil)
+
+#_ (rubify-seq 0 spheres)
+
+(defn id-for-symbol [symbol]
+ (try
+ (let [m (meta (resolve symbol))
+ {:keys [ns name]} m
+ ns (str ns)
+ name (str name)]
+ (try (Integer. (with-connection db
+ (transaction (with-query-results rs ["select * from functions where ns=? and name=?" ns name] (:id (first (doall rs)))))))
+ (catch Exception e 0)))))
+
+#_(println (rubify-map 0 {:name "Exceptional"
+ :symbols '(try catch finally throw assert)}))
+
+#_(println (rubify-symbols 0 '(try catch finally throw assert)))
+
+(defn rubify-symbols [indent syms]
+ (rubify-seq indent
+ (doall (map #(if (string? %)
+ {:name %
+ :ns ""
+ :link ""
+ :id 0}
+ (let [m (meta (resolve %))
+ {:keys [ns name]} m
+ ns (if (nil? ns) "" ns)
+ name (if (nil? name) (str %) name)
+ id (id-for-symbol %)]
+ {:name (str name)
+ :ns (str ns)
+ :link (if (empty? (str ns)) "" (str "http://clojuredocs.org/v/" id))
+ :id id}))
+ syms))))
+
+(defn rubify-map [indent m]
+ (let [tabs (apply str (take indent (repeat "\t")))
+ tabs-inc (apply str (take (inc indent) (repeat "\t")))]
+ (str "{\n"
+ (apply str
+ (interpose ",\n"
+ (map
+ #(cond
+ (= :symbols (first %)) (str tabs-inc (first %) " => " (rubify-symbols (inc indent) (second %)))
+ (map? (second %)) (str tabs-inc (first %) " => " (rubify-map (inc indent) (second %)))
+ (vector? (second %)) (str tabs-inc (first %) " => " (rubify-seq (inc indent) (second %)))
+ (number? (second %)) (str tabs-inc (first %) " => " (second %))
+ :else (str tabs-inc (first %) " => \"" (second %) "\""))
+ m)))
+ "\n" tabs "}")))
+
+#_ (spit "/Users/zkim/napplelabs/clojuredocs/cd-site/app/cc_quick_ref.rb" (rubify-spheres spheres))
+
+(defn rubify-seq [indent s]
+ (let [tabs (apply str (take indent (repeat "\t")))
+ tabs-inc (apply str (take (inc indent) (repeat "\t")))]
+ (str "[\n"
+ (apply str
+ (interpose ",\n"
+ (map
+ #(cond
+ (map? %) (str tabs-inc (rubify-map (inc indent) %))
+ (vector? %) (str tabs-inc (rubify-seq (inc indent) %))
+ :else (str tabs-inc (first %) " => \"" (second %) "\""))
+ s)))
+ "\n" tabs "]\n")))
+
+(defn rubify-spheres [spheres]
+ (str "class CCQuickRef\n"
+ "\tdef self.spheres\n"
+ "\t\t"
+ (rubify-seq 2 spheres)
+ "\tend\n"
+ "end"))
+
+(defn cat-toc [cat]
+ (html
+ [:ul {:class "toc_cat"}
+ [:li [:a {:name (str (:name cat) "_toc") :href (str "#" (:name cat ))} (:name cat)]
+ [:ul {:class "toc_group"}
+ #_ (map
+ #(html [:li [:a {:href (str "#" (:name cat) (:name %))} (:name %)]])
+ (:groups cat))]]]))
+
+(defn sphere-toc [sphere]
+ (html
+ [:fieldset {:class "toc_sphere"}
+ [:legend (:name sphere)]
+ [:ul (map cat-toc (:categories sphere))]]))
+
+#_ (do (spit "/Users/zkim/napplelabs/clojuredocs/cd-site/app/views/main/clojure_core.html.erb" (spheres-to-html spheres)))
+
+(defn spheres-toc [spheres]
+ (html [:div {:class "toc"}
+ [:h3 "Table of Contents"]
+ (map sphere-toc spheres)]))
+
+(defn group-to-html [sphere cat]
+ (fn [group]
+ (html [:div {:class "group"}
+ [:table
+ [:tr
+ [:td {:class "var"}
+ [:span [:a {:name (str (:name cat) (:name group))} (str (:name group) ":")]]]
+ [:td
+ (map #(html [:span {:class "var"} (str %)]) (:symbols group))]]]])))
+
+(defn group-with-desc-to-html [sphere cat]
+ (fn [group]
+ (html [:div {:class "group"}
+ [:div {:class "group_header"}
+ [:h5 [:a {:name (str (:name cat) (:name group))} (str (:name group) ":")]]
+ [:div {:class "signpost"}
+ (:name sphere)
+ ", "
+ (:name cat)]
+ [:div {:class "clear"}]]
+ [:div {:class "clear"}]
+ [:table
+ (with-connection db
+ (doall (map
+ #(let [m (try (meta (resolve %)) (catch Exception e {:name % :doc ""}))
+ ns (str (:ns m))
+ name (str (:name m))
+ id 0 #_(try (transaction (with-query-results rs ["select * from functions where ns=? and name=?" ns name] (:id (first (doall rs))))))]
+ (html [:tr [:td {:class "var"} [:a {:href (str "http://clojuredocs.org/v/" id)} (:name m)]] [:td {:class "desc"} (apply str (take 70 (:doc m)))]]))
+ (:symbols group))))]])))
+
+#_ (do (spit "/Users/zkim/napplelabs/clojuredocs/cd-site/app/views/main/clojure_core.html.erb" (spheres-to-html spheres)))
+
+(defn cat-to-html [sphere]
+ (fn [category]
+ (html [:div {:class "cat"}
+ [:div {:class "cat_header"}
+ [:h4 [:a {:href (str "#" (:name category) "_toc") :name (:name category)} (:name category)]]]
+ [:div {:class "clear"}]
+ (apply str (map (group-to-html sphere category) (:groups category)))])))
+
+(defn sphere-to-html [sphere]
+ (html [:div {:class "sphere"}
+ [:div {:class "sphere_header"}
+ [:h3 [:a {:href (str "#" (:name sphere) "_toc") :name (:name sphere)} (:name sphere)]]
+ [:span [:a {:class "top" :href "#top"} "top"]]
+ [:div {:class "clear"}]]
+ [:div {:class "categories"} (map (cat-to-html sphere) (:categories sphere))]]))
+
+(defn spheres-to-html [categories]
+ (html
+ [:div {:class "container_16"}
+ [:div {:class "grid_3"}
+ "<%= render :partial => 'lib_nav', :locals => {:lib => @library} %>"
+ (spheres-toc spheres)
+ "<%= render :partial => '/lib_namespaces' %>"
+ "&nbsp;"]
+ [:div {:class "grid_10"}
+ [:div {:class "clear"}]
+ [:div {:class "quick_ref"}
+ (apply str (map sphere-to-html spheres))]]
+ [:div {:class "grid_3"}
+ "&nbsp;"]]))
+
+
+#_ (do (spit "/Users/zkim/napplelabs/clojuredocs/cd-site/app/views/main/clojure_core.html.erb" (spheres-to-html spheres)))
+
208 src/cd_analyzer/core.clj
@@ -0,0 +1,208 @@
+(ns cd-analyzer.core
+ (:use [cd-analyzer.util]
+ [cd-analyzer.language]
+ [cd-analyzer.database]
+ [clojure.contrib.pprint])
+ (:import [java.io File FileReader]
+ [clojure.lang LineNumberingPushbackReader]))
+
+
+(defn indt
+ ([l] (apply str (take l (repeat " "))))
+ ([l i] (indt (+ l i))))
+
+(defn to-var-map [v]
+ (let [{:keys [name ns doc line file arglists added]} (meta v)]
+ {:name (str name)
+ :ns (str ns)
+ :doc (remove-leading-whitespace doc)
+ :line line
+ :file file
+ :added added
+ :source (source-for v)
+ :arglists arglists
+ :vars-in (map #(let [meta (meta %)]
+ {:ns (str (:ns meta))
+ :name (str (:name meta))}) (vars-in v))}))
+
+(defn parse-ns-map [root-path]
+ (fn [file]
+ (when-let [ns (file-to-ns file)]
+ (let [m (meta ns)]
+ {:name (.name ns)
+ :file file
+ :doc (:doc m)
+ :web-path (.replace (.getAbsolutePath file) (.getAbsolutePath root-path) "")
+ :vars (map to-var-map (ns-to-vars ns))}))))
+
+
+(defn parse-lein [#^File file]
+ (let [rdr (LineNumberingPushbackReader. (FileReader. file))
+ lein (try (read rdr) (catch Exception e (throw (Exception. (str "parse-lein: " e)))))
+ props (reduce #(assoc %1 (first %2) (second %2)) {} (partition 2 (drop 3 lein)))
+ autodoc (-> (:autodoc props)
+ (dissoc :root)
+ (dissoc :source-path)
+ (dissoc :output-path))]
+ (merge {:name (str (second lein))
+ :version (nth lein 2)
+ :description (:description props)
+ :dependencies (:dependencies props)
+ :source-root (mkfile (parent-file file) "src")}
+ autodoc)))
+
+(defn parse-git [#^File git-root]
+ {:web-src-dir (git-dir-to-web-src-dir git-root)
+ :commit (git-dir-to-commit git-root)
+ :site-url (git-dir-to-site-url git-root)})
+
+
+(defn parse-project [#^File project-file]
+ (let [project (parse-lein project-file)
+ project (assoc project :cljs (cljs-in (:source-root project)))
+ project (assoc project :namespaces (map (parse-ns-map (parent-file project-file)) (:cljs project)))]
+ project))
+
+(defn parse-library [#^File root]
+ (let [git-map (parse-git (mkfile root ".git"))
+ lein-map (parse-lein (mkfile root "project.clj"))
+ project-cljs (filter #(= "project.clj" (.getName %)) (file-seq root))
+ projects (map parse-project project-cljs)
+ library (-> (merge git-map lein-map)
+ (dissoc :dependencies))]
+ (assoc library :projects projects)))
+
+(defn parse-clojure-core [#^File root]
+ (let [git-map (parse-git (mkfile root ".git"))
+ clojure-map {:name "Clojure Core"
+ :description "Clojure core environment and runtime library."
+ :site-url "http://clojure.org"
+ :copyright "&copy Rich Hickey. All rights reserved."
+ :license "<a href=\"http://www.eclipse.org/legal/epl-v10.html\">Eclipse Public License 1.0</a>"
+ :version "1.2.0"
+ :source-root (mkfile root "src" "clj")}
+ project clojure-map
+ project (assoc project :cljs (cljs-in (:source-root project)))
+ project (assoc project :namespaces (map (parse-ns-map root) (:cljs project)))
+ library (merge {:projects [project]} git-map clojure-map)]
+ library))
+
+(defn parse-clojure-contrib [#^File root]
+ (let [git-map (parse-git (mkfile root ".git"))
+ cc-map {:name "Clojure Contrib"
+ :description "The user contributions library, clojure.contrib, is a collection of namespaces each of which implements features that we believe may be useful to a large part of the Clojure community."
+ :site-url "http://richhickey.github.com/clojure-contrib/"
+ :copyright "&copy Rich Hickey. All rights reserved."
+ :license "<a href=\"http://www.eclipse.org/legal/epl-v10.html\">Eclipse Public License 1.0</a>"
+ :version "1.2.0"
+ :source-root (mkfile root "src" "main" "clojure")}
+ project cc-map
+ project (assoc project :cljs (cljs-in (:source-root project)))
+ project (assoc project :namespaces (map (parse-ns-map root) (:cljs project)))
+ library (merge {:projects [project]} git-map cc-map)]
+ library))
+
+(defn get-projects [lib]
+ (:projects lib))
+
+(defn get-nss [lib]
+ (reduce concat (map :namespaces (:projects lib))))
+
+(defn get-vars [lib]
+ (->> lib
+ (:projects)
+ (map :namespaces)
+ (reduce concat)
+ (map :vars)
+ (reduce concat)))
+
+(defn pad [width thing]
+ (apply str (take (- width (count (str thing))) (repeat " "))))
+
+(def *pad-width* 70)
+
+(defn update-ns [i ns-map]
+ (let [indt (partial indt i)]
+ (reportln (indt) (:name ns-map) (pad *pad-width* (:name ns-map)) "(ns)")))
+
+(defn update-project [i project]
+ (let [indt (partial indt i)]
+ (reportln (indt) (:name project) (pad *pad-width* (:name project)) "(project)")
+ (doseq [ns (:namespaces project)]
+ (update-ns (+ i 2) ns))
+ (reportln)))
+
+(defn update-library [i library]
+ (let [indt (partial indt i)]
+ (reportln (indt) "Updating Library: " (:name library))
+ (doseq [project (:projects library)]
+ (update-project (+ i 2) project))))
+
+(defn report-on-lib [library]
+ (let [start (System/currentTimeMillis)]
+ (try
+ (reportln)
+ (reportln (:name library) " :: Import Library Task")
+ (reportln "=========================================")
+ (let [col-width 55
+ pad (partial pad col-width)
+ indt (partial indt 2)
+ projects (get-projects library)
+ num-projects (count projects)
+ nss (get-nss library)
+ num-nss (count nss)
+ vars (get-vars library)
+ num-vars (count vars)]
+ (reportln (indt) num-projects " projects, " num-nss " namespaces, " num-vars " vars.")
+ (reportln)
+ (store-lib library)
+ (doseq [p (sort-by :name projects)]
+ (reportln (indt) (:name p) (pad (:name p)) "(project)"))
+ (reportln)
+ (doseq [ns (sort-by :name nss)]
+ (report (indt) (:name ns) (pad (:name ns)) "(ns)")
+ (if (store-ns-map ns)
+ (reportln " Ok")
+ (reportln " Error")))
+ (reportln)
+ (doseq [v (sort-by :name vars)]
+ (report (indt) (:name v) (pad (:name v)) "(var)")
+ (if ((store-var-map (:name library)) v)
+ (reportln " Ok")
+ (reportln " Error")))
+ (reportln)
+ (doseq [v (sort-by :name vars)]
+ (let [v-to-vs-str (str (:name v))]
+ (report (indt) v-to-vs-str (pad v-to-vs-str) "(" (count (:vars-in v)) " references)"))
+ (if (store-var-references v)
+ (reportln " Ok")
+ (reportln " Error")))
+ (reportln)
+ (reportln (indt) "Looking for vars to remove...")
+ (if (= 0 num-vars)
+ (reportln (indt) "No vars found, skipping removal of stale vars.")
+ (let [removed (remove-stale-vars (:name library) start)]
+ (if (= 0 (count removed))
+ (reportln (indt 2) "No vars removed.")
+ (do
+ (reportln (indt 2) "Removed " (count removed) " vars:")
+ (doseq [vr removed]
+ (reportln (indt 4) (:name vr) (pad (:name vr)) "(" (:ns vr) ")"))))))
+ (reportln "=========================================")
+ (reportln (indt) num-projects " projects, " num-nss " namespaces, " num-vars " vars found in " (:name library)))
+ (catch Exception e
+ (reportln "=========================================")
+ (reportln "Import process failed: " e)))
+ (reportln (indt 2) "Took " (/ (- (System/currentTimeMillis) start) 1000.0) "s")))
+
+(defn run-update [root-dir]
+ (report-on-lib (parse-library (File. root-dir))))
+
+(defn run-update-clojure-core [root-dir]
+ (report-on-lib (parse-clojure-core (File. root-dir))))
+
+(defn run-update-clojure-contrib [root-dir]
+ (report-on-lib (parse-clojure-contrib (File. root-dir))))
+
+#_(run-update-clojure-core "/Users/zkim/clojurelibs/clojure")
+#_(pprint (parse-clojure-core (File. "/Users/zkim/clojurelibs/clojure")))
319 src/cd_analyzer/database.clj
@@ -0,0 +1,319 @@
+(ns cd-analyzer.database
+ (:use [cd-analyzer.util]
+ [cd-analyzer.language]
+ [clojure.contrib.pprint]
+ [clojure.contrib.sql]
+ [clojure.contrib.string :only (as-str)])
+ (:import [java.io File]))
+
+
+;; From autodoc
+(defn remove-leading-whitespace
+ "Find out what the minimum leading whitespace is for a doc block and remove it.
+We do this because lots of people indent their doc blocks to the indentation of the
+string, which looks nasty when you display it."
+ [s]
+ (when s
+ (let [lines (.split s "\\n")
+ prefix-lens (map #(count (re-find #"^ *" %))
+ (filter #(not (= 0 (count %)))
+ (next lines)))
+ min-prefix (when (seq prefix-lens) (apply min prefix-lens))
+ regex (when min-prefix (apply str "^" (repeat min-prefix " ")))]
+ (if regex
+ (apply str (interpose "\n" (map #(.replaceAll % regex "") lines)))
+ s))))
+
+
+;; TODO: where'd I get this?!
+;;==== Internal functions ======================================================
+
+(defn- join
+ "Joins the items in the given collection into a single string separated
+ with the string separator."
+ [separator col]
+ (apply str (interpose separator col)))
+
+(defn- sql-for-insert
+ "Converts a table identifier (keyword or string) and a hash identifying
+ a record into an sql insert statement compatible with prepareStatement
+ Returns [sql values-to-insert]"
+ [table record]
+ (let [table-name (as-str table)
+ columns (map as-str (keys record))
+ values (vals record)
+ n (count columns)
+ template (join "," (replicate n "?"))
+ column-names (join "," columns)
+ sql (format "insert into %s (%s) values (%s)"
+ table-name column-names template)]
+ [sql values]))
+
+
+;;==== Functions/macros for use by macros ======================================
+
+(defn run-chained
+ "Runs the given database insert functions on the given
+ database spec within a transaction. Each function is passed a hash
+ identifying the keys of the previous inserts."
+ [db insert-fns]
+ (with-connection db
+ (transaction
+ (loop [id {}
+ todo insert-fns]
+ (if (empty? todo)
+ id
+ (let [[table insert-fn] (first todo)
+ inserted-id (insert-fn id)]
+ (recur (assoc id table inserted-id)
+ (rest todo))))))))
+
+(defmacro build-insert-fns
+ "Converts a vector of [:table { record }] into a vector of database
+ insert functions."
+ [table-records]
+ (vec
+ (for [[table record] (partition 2 table-records)]
+ `[~table (fn [~'id]
+ (insert-record ~table ~record))])))
+
+
+;;==== Functions/macros for external use =======================================
+
+(defn insert-record
+ "Equivalent of clojure.contrib.sql/insert-records that only inserts a single
+ record but returns the autogenerated id of that record if available."
+ [table record]
+ (let [[sql values] (sql-for-insert table record)]
+ (with-open [statement (.prepareStatement (connection) sql java.sql.Statement/RETURN_GENERATED_KEYS)]
+ (doseq [[index value] (map vector (iterate inc 1) values)]
+ (.setObject statement index value))
+ (.execute statement)
+ (if-let [rs (.getGeneratedKeys statement)]
+ (if (.next rs)
+ (if-let [id (.getObject rs 1)]
+ id
+ nil)
+ nil)
+ nil))))
+
+
+(defmacro insert-with-id
+ "Insert records within a single transaction into the database described by
+ the given db spec. The record format is :table { record-hash }.
+ The record hashes can optionally access a hashmap 'id' which holds the
+ autogenerated ids of previous inserts keyed by the table name. e.g.
+
+ (insert-with-id db-spec
+ :department {:name \"xfiles\"
+ :location \"secret\"}
+ :employee {:department (id :department)
+ :name \"Mr X\"})"
+ [db & table-records]
+ `(let [insert-fns# (build-insert-fns ~table-records)]
+ (run-chained ~db insert-fns#)))
+
+(def *db* {:classname "com.mysql.jdbc.Driver"
+ :subprotocol "mysql"
+ :subname "//localhost:3306/clojuredocs?user=root&password="
+ :create true
+ :username "root"
+ :password ""})
+
+(defn query-lib-stats [libdef]
+ (with-connection *db*
+ (transaction
+ (let [lib-stats (with-query-results rs ["select * from libraries where name = ?" (:name libdef)]
+ (first rs))
+ var-count (with-query-results rs ["select count(id) from functions where library = ?" (:name libdef)]
+ ((keyword "count(id)") (first rs)))]
+ (when lib-stats (assoc lib-stats
+ :var-count var-count))))))
+
+(defn insert-or-update
+ [test-fn update-fn insert-fn]
+ (with-connection *db*
+ (transaction
+ (let [existing (test-fn)]
+ (if existing (update-fn existing) (insert-fn))))))
+
+(defn sql-now [] (java.sql.Timestamp. (System/currentTimeMillis)))
+
+(defn store-lib [libdef]
+ (let [name (:name libdef)
+ description (:description libdef)
+ site-url (:site-url libdef)
+ source-base-url (:web-src-dir libdef)
+ copyright (:copyright libdef)
+ license (:license libdef)
+ test (fn []
+ (with-query-results rs ["select * from libraries where name = ? limit 1" name]
+ (first (doall rs))))
+ update (fn [existing]
+ (update-values :libraries
+ ["id = ?" (:id existing)]
+ {:description description
+ :site_url site-url
+ :source_base_url source-base-url
+ :copyright copyright
+ :license license
+ :updated_at (sql-now)}))
+ insert (fn []
+ (insert-values :libraries
+ [:name :description :site_url :source_base_url :copyright :license :created_at :updated_at]
+ [name description site-url source-base-url copyright license (sql-now) (sql-now)]))]
+ (insert-or-update test update insert)))
+
+
+(defn query-var [ns name]
+ (with-connection *db*
+ (transaction
+ (with-query-results rs ["select * from functions where ns=? and name=?" ns name]
+ (first rs)))))
+
+(defn store-var-map [lib]
+ (fn [var-map]
+ (try
+ (let [{:keys [ns name file line arglists added doc source]} var-map]
+ (with-connection *db*
+ (transaction
+ (let [existing (with-query-results rs ["select * from functions where library = ? and ns = ? and name = ? limit 1" lib (str ns) (str name)]
+ (first rs))]
+ (if existing
+ (update-values
+ :functions
+ ["id=?" (:id existing)]
+ {:library lib
+ :ns (str ns)
+ :name (str name)
+ :file file
+ :line line
+ :arglists_comp (apply str (interpose "|" arglists))
+ :added added
+ :doc doc
+ :shortdoc (if (:shortdoc existing) (:shortdoc existing) (apply str (take 70 doc)))
+ :source source
+ :updated_at (java.sql.Timestamp. (System/currentTimeMillis))})
+ (insert-values
+ :functions
+ [:library :ns :name :file :line :arglists_comp :added :doc :shortdoc :source :updated_at :created_at]
+ [lib
+ (str ns)
+ (str name)
+ file
+ line
+ (apply str (interpose "|" arglists))
+ added
+ doc
+ (apply str (take 70 doc))
+ source
+ (java.sql.Timestamp. (System/currentTimeMillis))
+ (java.sql.Timestamp. (System/currentTimeMillis))]))))))
+ (catch Exception e (println (str (:name var-map) " -- " e))))))
+
+(defn lookup-var-id [var-map]
+ (transaction
+ (with-query-results rs ["select * from functions where ns = ? and name = ? limit 1" (str (:ns var-map)) (str (:name var-map))]
+ (:id (first rs)))))
+
+(defn remove-stale-vars [libname timestamp]
+ (let [to-remove
+ (with-connection *db*
+ (transaction
+ (with-query-results rs ["select * from functions where library = ? and (updated_at < ? or updated_at is NULL)" libname (java.sql.Timestamp. timestamp)]
+ (doall rs))))
+ ids (map :id to-remove)]
+ (with-connection *db*
+ (transaction
+ (doseq [id ids]
+ (delete-rows :functions ["id=?" id]))))
+ (with-connection *db*
+ (transaction
+ (doall (map #(delete-rows :function_references ["from_function_id=?" %]) ids))
+ (doall (map #(delete-rows :function_references ["to_function_id=?" %]) ids))))
+ (doall (seq to-remove))))
+
+(defn query-ns [ns]
+ (with-connection *db*
+ (transaction
+ (with-query-results rs ["select * from namespaces where name=?" ns]
+ (first rs)))))
+
+(defn store-ns-map [ns-map]
+ (with-connection *db*
+ (transaction
+ (let [name (str (:name ns-map))
+ web-path (:web-path ns-map)
+ doc (:doc ns-map)
+ doc (remove-leading-whitespace (if doc doc ""))
+ existing (with-query-results rs ["select * from namespaces where name = ? limit 1" name] (first (doall rs)))]
+ (if existing
+ (update-values :namespaces
+ ["id=?" (:id existing)]
+ {:name name
+ :doc doc
+ :source_url web-path
+ :updated_at (sql-now)})
+ (insert-values :namespaces
+ [:name :doc :source_url :created_at :updated_at]
+ [name doc web-path (sql-now) (sql-now)]))))))
+
+(defn store-var-references [var-map]
+ (when-let [vars-in (:vars-in var-map)]
+ (try
+ (with-connection *db*
+ (transaction
+ (when-let [from-id (lookup-var-id var-map)]
+ (let [to-ids (map lookup-var-id vars-in)]
+ (doseq [to-id to-ids]
+ (when (not (nil? to-id))
+ (let [existing (with-query-results rs
+ ["select * from function_references where from_function_id = ? and to_function_id = ? limit 1" from-id to-id]
+ (first (doall rs)))]
+ (when (not existing)
+ (insert-records :function_references {:from_function_id from-id :to_function_id to-id})))))
+ true))))
+ (catch Exception e
+ (reportln "Exception in store-var-references: ")
+ (reportln var-map " -> " (.getMessage e))
+ nil))))
+
+(def ccld {:name "Clojure Core"
+ :root-dir "/Users/zkim/clojurelibs/clojure"
+ :src-dir "/Users/zkim/clojurelibs/clojure/src"
+ :description "Clojure core environment and runtime library."
+ :site-url "http://clojure.org"
+ :source-base-url "http://github.com/clojure/clojure/blob/master/src/clj/"
+ :copyright "&copy Rich Hickey. All rights reserved."
+ :license "<a href=\"http://www.eclipse.org/legal/epl-v10.html\">Eclipse Public License 1.0</a>"})
+
+(defn track-import-start [libdef]
+ (with-connection *db*
+ (transaction
+ (when-let [libid (with-query-results rs ["select id from libraries where name=?", (:name libdef)]
+ (:id (first rs)))]
+ (insert-record :library_import_tasks
+ {:library_id libid
+ :status "RUNNING"
+ :created_at (java.sql.Timestamp. (System/currentTimeMillis))
+ :updated_at (java.sql.Timestamp. (System/currentTimeMillis))})))))
+
+(defn track-import-end [task-id lib-stats]
+ (when (contains? lib-stats :status)
+ (with-connection *db*
+ (transaction
+ (update-values :library_import_tasks
+ ["id = ?" task-id]
+ (assoc lib-stats
+ :updated_at (java.sql.Timestamp. (System/currentTimeMillis))))))))
+
+(defn import-log [task-id level message]
+ (with-connection *db*
+ (transaction
+ (insert-record :library_import_logs
+ {:library_import_task_id task-id
+ :level (as-str level)
+ :message message
+ :created_at (java.sql.Timestamp. (System/currentTimeMillis))}))))
+
+
118 src/cd_analyzer/language.clj
@@ -0,0 +1,118 @@
+(ns cd-analyzer.language
+ (:use [clojure.contrib.pprint]
+ [clojure.repl :only (source-fn)]
+ [clojure.string :only (split-lines trim)])
+ (:import [clojure.lang LineNumberingPushbackReader]
+ [java.io File FileReader StringReader]))
+
+(defn mkfile [& parts]
+ (->> parts
+ (map #(if (instance? File)
+ (.getAbsolutePath %)
+ %))
+ (interpose "/")
+ (apply str)
+ (File.)))
+
+(defn file-exists? [#^File file]
+ (.exists file))
+
+(defn dirs-in [dir]
+ (let [dir-file (java.io.File. dir)]
+ (map #(.getAbsolutePath %) (filter #(.isDirectory %) (seq (.listFiles dir-file))))))
+
+(defn files-in [dir]
+ (let [dir-file (java.io.File. dir)]
+ (map #(.getAbsolutePath %) (filter #(.isFile %) (seq (.listFiles dir-file))))))
+
+(defn file-name [path]
+ (.getName (java.io.File. path)))
+
+(defn parent-file [file]
+ (.getParentFile file))
+
+(defn git-dir-to-site-url [#^File git-dir]
+ (when-let [config (try (split-lines (slurp (mkfile git-dir "config"))) (catch Exception e nil))]
+ (when-let [remote-origin (drop 1 (drop-while #(not (.contains % "[remote \"origin\"]")) config))]
+ (let [url (->> (re-find #"http://.*\.git" (second remote-origin))
+ (reverse)
+ (drop 4)
+ (reverse)
+ (apply str))]
+ (when (.contains url "github")
+ url)))))
+
+(defn git-dir-to-web-src-dir [#^File git-dir]
+ (when-let [url (git-dir-to-site-url git-dir)]
+ (str url "/blob")))
+
+(defn git-dir-to-commit [#^File git-dir]
+ (let [master (mkfile git-dir "refs" "heads" "master")]
+ (when (file-exists? master)
+ (trim (slurp master)))))
+
+(defn cljs-in [file]
+ (when (and (not (nil? file)) (not= "" file))
+ (filter #(re-matches #".*\.clj" (.getName %)) (file-seq file))))
+
+(defn file-to-ns-str [#^File f]
+ (let [rdr (LineNumberingPushbackReader. (FileReader. f))]
+ (loop [r rdr]
+ (when-let [rep (try (read rdr) (catch Exception e (println "EOF encountered: " f) nil))]
+ (if (= (str (first rep)) "ns")
+ (str (second rep))
+ (recur rdr))))))
+
+(defn file-to-ns [#^File f]
+ (when-let [ns-str (file-to-ns-str f)]
+ (try
+ (require (symbol ns-str))
+ (find-ns (symbol ns-str))
+ (catch Exception e (println (str "Warning: couldn't resolve ns " ns-str))))))
+
+(defn ns-to-vars [#^Namespace ns]
+ (if (nil? ns)
+ (throw (Exception. "ns-to-vars: ns parameter is nil"))
+ (->> (ns-interns ns)
+ (map second)
+ (filter #(not (:private (meta %))))
+ (filter #(try
+ ;; hack to prevent errors when import unknown (to me) var types
+ ;; ex. unquote-splicing, unquote, *depth*, *state*, *sb*
+ (not (class? (var-get %)))
+ (catch Exception e true))))))
+
+(defn symbols-from-reader-rep [list]
+ (defn recur-symbols [list-rep]
+ (let [symbols (filter symbol? list-rep)
+ seqs (filter seq? list-rep)]
+ (flatten (cons symbols (map recur-symbols seqs)))))
+ (sort (set (recur-symbols list))))
+
+(defn source-for [v]
+ (try
+ (source-fn (symbol (str (:ns (meta v))) (str (:name (meta v)))))
+ (catch Exception e nil)))
+
+(defn symbols-in [v]
+ (defn recur-symbols [list-rep]
+ (let [symbols (filter symbol? list-rep)
+ seqs (filter seq? list-rep)]
+ (flatten (cons symbols (map recur-symbols seqs)))))
+ (when-let [src (source-for v)]
+ (when-let [rdr (try
+ (LineNumberingPushbackReader. (StringReader. src))
+ (catch Exception e nil))]
+ (when-let [rep (try (read rdr) (catch Exception e (throw (Exception. (str "symbols-in: " e)))))]
+ (filter identity (sort (set (recur-symbols rep))))))))
+
+(defn vars-in [v]
+ (let [symbols (symbols-in v)
+ resolved (map #(try (resolve %) (catch Exception e nil)) symbols)]
+ (->> resolved
+ (filter identity)
+ (filter #(not (:private (meta %))))
+ (remove #(= % v)))))
+
+
+
44 src/cd_analyzer/libs.clj
@@ -0,0 +1,44 @@
+(ns cd-analyzer.libs
+ (:use [cd-analyzer.core]
+ [cd-analyzer.runner]
+ [cd-analyzer.database]))
+
+#_(time
+ (do
+ (run-update-clojure-core "/Users/zkim/clojurelibs/clojure")
+ (run-update-clojure-contrib "/Users/zkim/clojurelibs/clojure-contrib")
+ (run-update "/Users/zkim/clojurelibs/leiningen")
+ (run-update "/Users/zkim/clojurelibs/swank-clojure")
+ (run-update "/Users/zkim/clojurelibs/clj-ssh")
+ (run-update "/Users/zkim/clojurelibs/pallet")
+ (run-update "/Users/zkim/clojurelibs/enlive")
+ (run-update "/Users/zkim/clojurelibs/circumspec")
+ (run-update "/Users/zkim/clojurelibs/Midje")
+ (run-update "/Users/zkim/clojurelibs/ring")
+ (run-update "/Users/zkim/clojurelibs/incanter")
+ (run-update "/Users/zkim/clojurelibs/trammel")))
+
+#_(run-update "/Users/zkim/clojurelibs/ring")
+#_(run-update-and-log "./logs/enlive-import.log" "http://github.com/cgrand/enlive.git")
+
+
+#_(binding [*db* {:classname "com.mysql.jdbc.Driver"
+ :subprotocol "mysql"
+ :subname "//localhost:4444/clojuredocs?user=root&password=gammaClojureDocs1024"
+ :create true
+ :username "root"
+ :password "gammaClojureDocs1024"}]
+ (run-update-clojure-core "/Users/zkim/clojurelibs/clojure"))
+
+(binding [*db* {:classname "com.mysql.jdbc.Driver"
+ :subprotocol "mysql"
+ :subname "//localhost:4444/clojuredocs?user=root&password=gammaClojureDocs1024"
+ :create true
+ :username "root"
+ :password "gammaClojureDocs1024"}]
+ (run-update-clojure-contrib "/Users/zkim/clojurelibs/clojure-contrib"))
+
+
+
+(run-update-clojure-core "/Users/zkim/clojurelibs/clojure")
+(run-update-clojure-contrib "/Users/zkim/clojurelibs/clojure-contrib")
84 src/cd_analyzer/runner.clj
@@ -0,0 +1,84 @@
+(ns cd-analyzer.runner
+ (:use [cd-analyzer.util]
+ [cd-analyzer.language]
+ [cd-analyzer.core]
+ [clojure.contrib.pprint]
+ [clojure.java.shell]
+ [clojure.contrib.except :only (throwf)]))
+
+
+(defn clone-target-repo [git-url download-to-dir]
+ (let [local-repo-path (str
+ download-to-dir
+ "/"
+ (second (re-find #".*\/([^/]*)\.git" git-url)))]
+ #_(sh (str "rm -rf " local-repo-path) ".")
+ #_(swank.core/break)
+ (let [cmd-res (sh "git" "clone" git-url :dir download-to-dir)
+ res (str (:out cmd-res) " " (:err cmd-res))]
+ (cond (> (count (re-find #"git-upload-pack not found" res)) 0) (println "Error: " res)
+ (> (count (re-find #"already exists and is not an empty directory." res)) 0) (println "Error: " res)
+ :else (do
+ (println (str "Clone of " git-url " successful."))
+ local-repo-path)))))
+
+(defn gen-dep-vec [project-map]
+ `[~(symbol (:name project-map)) ~(:version project-map)])
+
+(defn gen-project-def [project-map]
+ (let [name-sym (:name project-map)
+ version (:version project-map)]
+ `(~(symbol "defproject")
+ ~(symbol "cd-temp")
+ "0.1.0-SNAPSHOT"
+ :dependencies [[~(symbol "org.clojure/clojure") "1.2.0-RC1"]
+ [~(symbol "org.clojure/clojure-contrib") "1.2.0-RC1"]
+ [~(symbol "cd-analyzer") "0.1.0-SNAPSHOT"]
+ [~(symbol (str name-sym)) ~version]]
+ :dev-dependencies [[~(symbol "lein-run") "1.0.0-SNAPSHOT"]])))
+
+(defn write-temp-project-file [project-root temp-dir]
+ (spit (str temp-dir "/project.clj") (gen-project-def
+ (parse-project (mkfile project-root "project.clj")))))
+
+(defn run-update-for [git-url]
+ (let [start (System/currentTimeMillis)]
+ #_ (when (not (.exists (java.io.File. proj-root))) (throwf "Couldn't find project root: %s" proj-root))
+ (reportln (str "Running update for " git-url " on " (java.util.Date.)))
+ (reportln "-----------------------------------------")
+ (with-temp-dir tmp-dir
+ (report "Cloning repo... ")
+ (let [repo-dir (clone-target-repo git-url tmp-dir)
+ tmp-proj-dir (.getAbsolutePath (java.io.File. (str tmp-dir "/temp-proj")))]
+ (.mkdirs (java.io.File. tmp-proj-dir))
+ (reportln "Done.")
+ (write-temp-project-file repo-dir tmp-proj-dir)
+ (reportln "Building / Installing")
+ (let [res (sh "lein" "install" :dir repo-dir)]
+ (reportln (:out res))
+ (reportln (:err res)))
+ (reportln)
+ (reportln "Updating Dependencies.")
+ (let [res (sh "lein" "deps" :dir tmp-proj-dir)]
+ (reportln (:out res))
+ (reportln (:err res)))
+ (reportln)
+ (reportln "Running import process.")
+ (let [res (sh "lein" "run" "cd-analyzer.core" "run-update" repo-dir :dir tmp-proj-dir)]
+ (reportln (:out res))
+ (reportln (:err res)))))
+ (reportln)
+ (reportln "-----------------------------------------")
+ (reportln "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~")
+ (reportln)))
+
+(defn run-update-and-log [path git-url]
+ (reportln "Running update " path " " git-url)
+ (let [file (java.io.File. path)]
+ (when (not (.exists file))
+ (.createNewFile file))
+ (binding [*out* (java.io.FileWriter. file true)]
+ (run-update-for git-url)))
+ (reportln "Done."))
+
+
20 src/cd_analyzer/util.clj
@@ -0,0 +1,20 @@
+(ns cd-analyzer.util)
+
+(defmacro with-temp-dir [dir & body]
+ `(when-let [temp-file# (java.io.File/createTempFile (.toString (java.util.UUID/randomUUID)) "")]
+ (.delete temp-file#)
+ (.mkdirs temp-file#)
+ (when-let [temp-dir# (.getAbsolutePath temp-file#)]
+ ((fn [~dir]
+ (let [res# (do ~@body)]
+ (clojure.contrib.io/delete-file-recursively temp-dir#)
+ res#)) temp-dir#))))
+
+(def *reporting-on* true)
+
+(defn report [& ss]
+ (when *reporting-on* (print (apply str ss))))
+
+(defn reportln [& ss]
+ (when *reporting-on* (print (apply str ss)) (println)))
+
10 src/main.clj
@@ -0,0 +1,10 @@
+(ns main
+ (:use [cd-analyzer.core])
+ (:gen-class))
+
+(defn -main [& args]
+ (when (= 0 (count args))
+ (throw "Must specify library root path."))
+ (if (> (count args) 1)
+ (run-update (first args))
+ (run-update (first args))))
33 test/cd_analyzer/core_test.clj
@@ -0,0 +1,33 @@
+(ns cd-analyzer.core-test
+ (:use [cd-analyzer.core])
+ (:use [lazytest.describe]
+ [lazytest.expect]))
+
+
+(describe to-var-map
+ (given "a var-map of 'reduce'" [{:keys [name ns doc line file added
+ source arglists vars-in]}
+ (to-var-map #'clojure.core/reduce)]
+ (do-it "gives the correct values"
+ (expect (= "reduce" name))
+ (expect (= "clojure.core" ns))
+ (expect (> (count doc) 0))
+ (expect (= 773 line))
+ (expect (= "1.0"))
+ (expect (= "clojure/core.clj" file))
+ (expect (> (count source) 0))
+ (expect (> (count arglists) 0))
+ (expect (> (count vars-in) 0)))))
+
+(comment
+ {:name (str name)
+ :ns (str ns)
+ :doc (remove-leading-whitespace doc)
+ :line line
+ :file file
+ :added added
+ :source (source-for v)
+ :arglists arglists
+ :vars-in (map #(let [meta (meta %)]
+ {:ns (str (:ns meta))
+ :name (str (:name meta))}) (vars-in v))})
72 test/cd_analyzer/database_test.clj
@@ -0,0 +1,72 @@
+(ns cd-analyzer.database-test
+ (:use [cd-analyzer.database] :reload-all)
+ (:use [clojure.contrib.sql])
+ (:require [clojure.test :as t]))
+
+(def test-db {:classname "com.mysql.jdbc.Driver"
+ :subprotocol "mysql"
+ :subname "//localhost:3306/clojuredocs_test?user=root&password="
+ :create true
+ :username "root"
+ :password ""})
+
+(def test-var-map {:name 'test-var
+ :ns "test.ns"
+ :file "dummydir/test.clj"
+ :line 123
+ :arglists_comp "[x y]|[x y z]"
+ :added "1.0"
+ :source "(defn test-var ([x y] (+ x y)) ([x y z] (+ x y z))"
+ :doc "the quick brown fox jumps over the lazy dog the quick brown fox jumps over the lazy dog"})
+
+(def test-ns-map {:name "my.ns"
+ :doc "doc for my ns"})
+
+(defn uuid [] (str (java.util.UUID/randomUUID)))
+
+(defn random-var-map []
+ {:name (uuid)
+ :ns (uuid)})
+
+(defn truncate-functions []
+ (with-connection test-db
+ (transaction
+ (do-commands "truncate table functions;"))))
+
+(binding [*db* test-db]
+ (query-ns "clojure.core"))
+
+(t/deftest store-ns-map-test
+ (binding [*db* test-db]
+ (store-ns-map test-ns-map)
+ (let [{:keys [name doc]} (query-ns "my.ns")]
+ (t/is (= "my.ns" name))
+ (t/is (= "doc for my ns" doc)))))
+
+(t/deftest remove-stale-vars-test
+ (binding [*db* test-db]
+ (truncate-functions)
+ (let [store-var-map (store-var-map "Clojure Core")]
+ (dotimes [n 5]
+ (store-var-map (random-var-map))))
+ (t/is (= 5 (count (remove-stale-vars "Clojure Core" (+ (System/currentTimeMillis) 2000)))))))
+
+(t/deftest lookup-var-id-test
+ (binding [*db* test-db]
+ (truncate-functions)
+ ((store-var-map "Clojure Core") test-var-map)
+ (with-connection test-db
+ (t/is (= 1 (lookup-var-id test-var-map))))))
+
+(t/deftest query-var-test
+ (binding [*db* test-db]
+ (truncate-functions)
+ ((store-var-map "Clojure Core") test-var-map)
+ (t/is (nil? (query-var "" "")))
+ (let [{:keys [name ns doc shortdoc created_at updated_at]} (query-var "test.ns" "test-var")]
+ (t/is (= "test-var" name))
+ (t/is (= "test.ns" ns))
+ (t/is (= "the quick brown fox jumps over the lazy dog the quick brown fox jumps over the lazy dog" doc))
+ (t/is (= "the quick brown fox jumps over the lazy dog the quick brown fox jumps " shortdoc))
+ (t/is created_at)
+ (t/is updated_at))))
89 test/cd_analyzer/language_test.clj
@@ -0,0 +1,89 @@
+(ns cd-analyzer.language-test
+ (:use [cd-analyzer.language] :reload-all)
+ (:use [lazytest describe expect]
+ [clojure.contrib.pprint])
+ (:require [ring.adapter.httpcore])
+ (:import [java.io File]))
+
+(def resources (mkfile "." "resources"))
+
+(def clojure-git-dir (mkfile resources "clojure-git"))
+(def empty-git-dir (mkfile resources "empty-git"))
+(def clojure-commit "77be185a6ca00a338a6647462e14206bad0e9802")
+
+(def cljs-in-dir (mkfile resources "cljs-in"))
+(def empty-dir (mkfile resources "empty-dir"))
+
+(def ns-to-vars-test-data [['map #'clojure.core/map]
+ ['reduce #'clojure.core/reduce]
+ ['ring.adapter.httpcore.proxy$java.lang.Object$ContentProducer$2f493dd0
+ #'ring.adapter.httpcore/ring.adapter.httpcore.proxy$java.lang.Object$ContentProducer$2f493dd0]])
+
+(def mocked-ns-vars
+ (binding [ns-interns (fn [_] ns-to-vars-test-data)]
+ (ns-to-vars (find-ns 'clojure.core))))
+
+(describe mkfile
+ (given "from strings" [foo-bar (mkfile "foo" "bar")]
+ (it "returns a file instance"
+ (instance? java.io.File foo-bar))
+ (it "has the correct path"
+ (= "foo/bar" (.getPath foo-bar))))
+ (given "from strings and files" [from-file-and-string (mkfile (mkfile "foo" "bar") "baz")]
+ (it "returns a file instance"
+ (instance? java.io.File from-file-and-string))
+ (it "has the correct path"
+ (= "foo/bar/baz" (.getPath from-file-and-string)))))
+
+(describe git-dir-to-site-url
+ (it "works with a valid git dir"
+ (= "http://github.com/clojure/clojure" (git-dir-to-site-url (mkfile resources "clojure-git"))))
+ (it "returns nil with an invalid git dir"
+ (= nil (git-dir-to-site-url (mkfile resources "empty-git")))))
+
+(describe git-dir-to-web-src-dir
+ (it "works with a valid git dir"
+ (= "http://github.com/clojure/clojure/blob" (git-dir-to-web-src-dir (mkfile resources "clojure-git"))))
+ (it "returns nil with an invalid git dir"
+ (= nil (git-dir-to-web-src-dir (mkfile resources "empty-git")))))
+
+(describe git-dir-to-commit
+ (it "works with a valid git dir"
+ (= clojure-commit (git-dir-to-commit clojure-git-dir)))
+ (do-it "returns nil for invlid dirs"
+ (expect (= nil (git-dir-to-commit empty-git-dir)))
+ (expect (= nil (git-dir-to-commit resources)))
+ (expect (= nil (git-dir-to-commit (mkfile "no-exist"))))))
+
+(describe cljs-in
+ (do-it "finds clojure files"
+ (expect (= 3 (count (cljs-in cljs-in-dir))))
+ (expect (= 0 (count (cljs-in empty-dir))))))
+
+(describe file-to-ns-str
+ (it "works when the ns decl is the first form"
+ (= "hello.world" (file-to-ns-str (mkfile resources "file-to-ns-str" "easy.clj"))))
+ (it "works when the ns decl is not the first form"
+ (= "comment.before.ns" (file-to-ns-str (mkfile resources "file-to-ns-str" "comment-before-ns.clj")))))
+
+(describe ns-to-vars
+ (it "correctly filters 'unknown' vars"
+ (= 2 (count mocked-ns-vars)))
+ (it "correctly transforms vars to var-maps"
+ (= 'map (:name (meta (first mocked-ns-vars)))))
+ (it "throws an exception on a nil parameter"
+ (try (ns-to-vars nil) false (catch Exception e true))))
+
+(describe symbols-in
+ (it "finds 35 symbols in 'map'"
+ (= 35 (count (symbols-in map))))
+ (it "returns nil for nil input"
+ (= nil (symbols-in nil))))
+
+(describe vars-in
+ (it "finds 18 symbols in map"
+ (= 18 (count (vars-in map))))
+ (it "reutrns empty for nil input"
+ (= '() (vars-in nil)))
+ (it "filters passed var from vars in"
+ (not (.contains (vars-in #'clojure.core/map) #'clojure.core/map))))
10 test/cd_analyzer/runner_test.clj
@@ -0,0 +1,10 @@
+(ns cd-analyzer.runner-test
+ (:use [cd-analyzer.runner] :reload-all)
+ (:use [cd-analyzer.util])
+ (:require [clojure.test :as t]))
+
+(t/deftest test-clone-repo
+ (with-temp-dir dir
+ (clone-target-repo "git://gist.github.com/509311.git" dir)
+ (t/is (.exists (java.io.File. (str dir "/509311"))))))
+

0 comments on commit c4ee33d

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