Permalink
Browse files

Javadoc updates for CLI and package docs.

* Add tool/package_docs.rb to generate package.html from package.rb files
* Add run of package_docs.rb to "apidocs" target
* Add package.rb for org.jruby.util.cli
* Add docs to ArgumentProcessor and OutputStrings classes
  • Loading branch information...
1 parent 7f29fa0 commit 4f1eee9cff074b97df93dcb2370b42ab582b4955 @headius headius committed Nov 21, 2011
View
9 build.xml
@@ -1306,6 +1306,15 @@
<target name="apidocs" depends="prepare"
description="Creates the Java API docs">
+ <!-- Run the package_docs.rb script to generate package.html files -->
+ <java classname="org.jruby.Main" fork="true" maxmemory="${jruby.launch.memory}" failonerror="true" dir="${basedir}">
+ <classpath refid="jruby.execute.classpath"/>
+
+ <sysproperty key="jruby.home" value="${basedir}"/>
+
+ <arg line="tool/package_docs.rb"/>
+ </java>
+
<javadoc destdir="${api.docs.dir}" author="true" version="true" use="true"
windowtitle="JRuby API" source="${javac.version}" useexternalfile="true"
encoding="UTF-8" maxmemory="256m">
View
10 src/org/jruby/util/cli/ArgumentProcessor.java
@@ -40,6 +40,16 @@
import org.jruby.util.KCode;
import org.jruby.util.SafePropertyAccessor;
+/**
+ * Encapsulated logic for processing JRuby's command-line arguments.
+ *
+ * This class holds the processing logic for JRuby's non-JVM command-line arguments.
+ * All standard Ruby options are processed here, as well as nonstandard JRuby-
+ * specific options.
+ *
+ * Options passed directly to the JVM are processed separately, by either a launch
+ * script or by a native executable.
+ */
public class ArgumentProcessor {
private final class Argument {
public final String originalValue;
View
4 src/org/jruby/util/cli/OutputStrings.java
@@ -6,6 +6,10 @@
import org.jruby.runtime.Constants;
import org.jruby.util.SafePropertyAccessor;
+/**
+ * Utility methods to generate the command-line output strings for help,
+ * extended options, properties, version, and copyright strings.
+ */
public class OutputStrings {
public static String getBasicUsageHelp() {
StringBuilder sb = new StringBuilder();
View
35 src/org/jruby/util/cli/package.rb
@@ -0,0 +1,35 @@
+# Output package.html for org.jruby.util.cli
+require 'erb'
+
+template = <<TEMPLATE
+<body>
+The CLI package provides utilities for JRuby's command-line interface.
+
+<div>A complete listing of Options-borne configuration properties:
+
+<dl>
+<%
+require 'java'
+org.jruby.util.cli.Options::PROPERTIES.each do |property|
+%>
+<dt><%= property.name %></dt>
+<dd>
+<div><%= property.description %></div>
+<div>Options:
+<% property.options.each do |option| %>
+<%=
+ if property.defval == option
+ "<b>jruby." + option.to_s + "</b>"
+ else
+ "jruby." + option.to_s
+ end
+%>
+<% end %></div>
+</dd>
+<% end %>
+</dl>
+<div>
+</body>
+TEMPLATE
+
+ERB.new(template).result
View
13 tool/package_docs.rb
@@ -0,0 +1,13 @@
+# This tool scans our src dir for "package.rb" files and evals
+# them, using the output for "package.html" in the same dir. It
+# gets run for the "apidocs" Ant target.
+
+puts "Generating package.html files from package.rb..."
+Dir['src/**/package.rb'].each do |package_rb|
+ puts " #{package_rb}"
+ package_html = eval File.read(package_rb)
+ filename = File.join(File.dirname(package_rb), "package.html")
+ File.open(filename, 'w') do |file|
+ file.write(package_html)
+ end
+end

0 comments on commit 4f1eee9

Please sign in to comment.