Permalink
Browse files

Support for incanter

  • Loading branch information...
1 parent 1bc3616 commit ce6eec6b704584882eb62271f3b9fd72555691aa @tomfaulhaber committed Dec 5, 2009
View
@@ -14,6 +14,8 @@
<property name="src-dir" value="${work-root-dir}/src/"/>
<property name="output-dir" value="${work-root-dir}/autodoc/"/>
<property name="extra-doc" value="${src-dir}/doc"/>
+ <property name="src-files" value="."/>
+ <property name="ext-dir" value="templates"/> <!-- just a dummy -->
<!-- These properties are special-cased when we're documenting clojure
contrib itself -->
@@ -183,11 +185,24 @@
<target name="build-html" depends="set-commit-hash,clean-html-dir,build-extra-doc"
description="Build the HTML documentation and check it in">
<echo message="param-dir ${param-dir}"/>
+ <echo message="src-files ${src-files}"/>
<java classname="clojure.main"
- classpath="${built-clojure-jar}:${clojure-contrib-jar}:${clojure-contrib-classes}:${enlive-src}:${tagsoup-jar}:${clojure-json-jar}:."
fork="true" failonerror="true">
+ <classpath>
+ <pathelement location="${built-clojure-jar}"/>
+ <pathelement location="${clojure-contrib-jar}"/>
+ <pathelement location="${clojure-contrib-classes}"/>
+ <pathelement location="${enlive-src}"/>
+ <pathelement location="${tagsoup-jar}"/>
+ <pathelement location="${clojure-json-jar}"/>
+ <pathelement location="${src-files}"/>
+ <pathelement location="."/>
+ <fileset dir="${ext-dir}">
+ <include name="**/*.jar"/>
+ </fileset>
+ </classpath>
<arg value="-e"/>
- <arg value="(use 'com.infolace.gen-docs.gen-docs) (gen-docs &quot;${param-dir}&quot;)"/>
+ <arg value="(use 'com.infolace.gen-docs.gen-docs) (gen-docs &quot;${param-dir}&quot;)"/>
</java>
</target>
@@ -1,16 +1,20 @@
(ns com.infolace.gen-docs.ant-wrapper
(:import
[java.io File]
- [org.apache.tools.ant Project ProjectHelper AntClassLoader DefaultLogger])
- (:use clojure.contrib.shell-out))
+ [org.apache.tools.ant Project ProjectHelper AntClassLoader DefaultLogger]))
(def param-map
{'work-root-dir '*file-prefix*,
'src-dir '*src-dir*,
'output-dir '*output-directory*,
'built-clojure-jar '*built-clojure-jar*
'clojure-contrib-jar '*clojure-contrib-jar*,
- 'clojure-contrib-classes '*clojure-contrib-classes*})
+ 'clojure-contrib-classes '*clojure-contrib-classes*
+ 'ext-dir '*ext-dir*})
+
+(defn get-param [sym]
+ (if-let [v (find-var (symbol (name (ns-name *ns*)) (name sym)))]
+ (var-get v)))
(defn ant-wrapper
[param-dir build-target force]
@@ -27,14 +31,12 @@
(.setUserProperty "ant.file" (.getAbsolutePath build-file))
(.setUserProperty "param-dir" param-dir)
(.setUserProperty "force" (if force "true" "false"))
+ (.setUserProperty "src-files" (str (get-param '*src-dir*) (get-param '*src-root*)))
(.init)
(.addReference "ant.projectHelper" helper))
(doseq [item param-map]
- (if-let [param-var (find-var (symbol (name (ns-name *ns*)) (name (second item))))]
- (.setUserProperty
- p
- (name (first item))
- (var-get param-var))))
+ (if-let [param (get-param (second item))]
+ (.setUserProperty p (name (first item)) param)))
(.parse helper p build-file)
(.executeTarget p build-target)))
@@ -1,6 +1,9 @@
(ns com.infolace.gen-docs.load-files
(:import [java.util.jar JarFile])
- (:use [com.infolace.gen-docs.params :only (*jar-file* *load-except-list*)]))
+ (:use [clojure.contrib.java-utils :only [file]]
+ [clojure.contrib.find-namespaces :only [find-namespaces-in-dir]]
+ [clojure.contrib.pprint.utilities :only [prlabel]]
+ [com.infolace.gen-docs.params :only (*src-dir* *src-root* *load-except-list*)]))
;;; Load all the files from contrib. This is a little hacked up
;;; because we can't just grab them out of the jar, but rather need
@@ -10,19 +13,6 @@
(use 'clojure.contrib.pprint)
-(defn get-elements [iterable]
- (loop [acc []]
- (if-not (.hasMoreElements iterable)
- acc
- (recur (conj acc (.nextElement iterable))))))
-
-(defn read-jar []
- (with-open [jar (JarFile. *jar-file*)]
- (filter
- #(re-find #".clj$" %)
- (map #(.getName %) (get-elements (.entries jar))))))
-
-
(defn not-in [str regex-seq]
(loop [regex-seq regex-seq]
(cond
@@ -33,22 +23,30 @@
(defn file-to-ns [file]
(.replaceAll (.replaceFirst file ".clj$" "") "/" "."))
-(defn ns-to-file [ns-name]
- (.replaceAll (.replaceAll ns-name "\\." "/") "-" "_"))
+(defn ns-to-file [ns]
+ (str (-> (name ns)
+ (.replaceAll "\\." "/")
+ (.replaceAll "-" "_"))
+ ".clj"))
+
+(defn find-files [dir]
+ (prlabel ff dir)
+ (map ns-to-file (find-namespaces-in-dir (file dir))))
(defn basename
"Strip the .clj extension so we can pass the filename to load"
[filename]
(.substring filename 0 (- (.length filename) 4)))
(defn load-files [filelist]
- (doseq [file (filter #(not-in % *load-except-list*) filelist)]
- (cl-format true "~a: " file)
+ (doseq [filename (filter #(not-in % *load-except-list*) filelist)]
+ (cl-format true "~a: " filename)
(try
- (load (basename file))
+ (load (basename filename))
(cl-format true "done.~%")
(catch Exception e
- (cl-format true "failed.~%")))))
+ (cl-format true "failed (ex = ~a).~%" (.getMessage e))))))
(defn load-namespaces []
- (load-files (read-jar)))
+ (prlabel ln (System/getProperty "java.class.path"))
+ (load-files (find-files (str *src-dir* *src-root*))))
@@ -16,6 +16,7 @@
(def *output-directory* nil)
(def *external-doc-tmpdir* nil)
(def *jar-file* nil)
+(def *ext-dir* nil)
(def *clojure-contrib-jar* nil)
(def *clojure-contrib-classes* nil)
View
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+ant -Dparam-dir=params/incanter -Dforce=true
@@ -0,0 +1,14 @@
+<project name="incanter" default="all">
+
+ <description>
+ The subsidiary autodoc build file for building incanter
+ </description>
+
+ <target name="all">
+ <!-- <ant dir="${src-dir}" inheritAll="false">
+ </ant> -->
+ </target>
+
+</project>
+
+
@@ -0,0 +1,20 @@
+(import (java.io File))
+
+(def *file-prefix* (.getAbsolutePath (File. "../autodoc-work-area/incanter")))
+(def *src-dir* (str *file-prefix* "/src/"))
+(def *src-root* "src")
+(def *web-src-dir* "http://github.com/liebke/incanter/blob/")
+
+(def *web-home* "http://tomfaulhaber.github.com/incanter/")
+(def *output-directory* (str *file-prefix* "/autodoc/"))
+(def *external-doc-tmpdir* "/tmp/autodoc/doc")
+(def *jar-file* (str *src-dir* *src-root*))
+(def *clojure-contrib-classes* (str *src-dir* "build"))
+
+(def *ext-dir* (str *src-dir* "lib"))
+
+(def *namespaces-to-document* ["incanter"])
+
+
+(def *page-title* "Incanter")
+; (def *copyright* "Copyright 2007-2009 by Rich Hickey")
@@ -0,0 +1,61 @@
+<h1 id="toc0">An Overview of the Clojure Core API</h1>
+<br />
+This is API documentation for the latest committed checkin of the Clojure core.
+<h3>Important Clojure resources</h3>
+<ul>
+ <li>The official source code for clojure is on the
+ <a href="http://github.com/richhickey/clojure/">
+ Clojure GitHub source page
+ </a>.
+ </li>
+ <li>Issues and other information for clojure are maintained in the
+ <a href="http://www.assembla.com/spaces/dashboard/index/clojure">
+ Clojure Assembla space
+ </a>.
+ </li>
+ <li>This documentation is maintained in the gh-pages branch of clojure
+ on GitHub and is always available online
+ <a href="http://tomfaulhaber.github.com/clojure">
+ GitHub pages for Clojure
+ </a>. (Currently stored in a fork on Tom Faulhaber's GitHub account.)
+ If you wish to have a version for off-line use you can use the download
+ button on the
+ <a href="http://github.com/tomfaulhaber/clojure/tree/gh-pages">
+ gh-pages branch page at GitHub
+ </a>.
+ </li>
+ <li>Issues related to clojure and the various pieces of functionality
+ within it are discussed in the
+ <a href="http://groups.google.com/group/clojure">
+ Clojure Google group
+ </a>.
+ </li>
+ <li>Discussions among clojure developers take place in the
+ <a href="http://groups.google.com/group/clojure-dev">
+ Clojure Dev Google group
+ </a>.
+ </li>
+</ul>
+<br />
+<div id="namespace-entry">
+ <br />
+ <hr />
+ <h2 id="namespace-tag">Namespace</h2>
+ <!-- by <span id="author">Author here</span><br /> -->
+ <a id="api-link" href="target">Detailed API documentation</a><br />
+ <pre id="namespace-docstr">docstr here</pre>
+ <span id="see-also">See also:
+ <span id="see-also-link">
+ <a href="see-also-tag">see-also-text</a>
+ </span><br />
+ </span>
+ Public variables and functions:
+ <span id="var-link"><a id="var-tag" href="var-tag">var-name</a> </span><br />
+ <span id="subspace"><br />Variables and functions in
+ <span id="name">subspace name</span>:
+ <span id="sub-var-link">
+ <a href="var-tag">var-name</a>
+ </span>
+ <br />
+ </span>
+</div>

0 comments on commit ce6eec6

Please sign in to comment.