[Rt-commit] rt branch, 4.0/static-docs, updated. rt-4.0.6-333-g8211735

Thomas Sibley trs at bestpractical.com
Thu Sep 13 19:52:57 EDT 2012


The branch, 4.0/static-docs has been updated
       via  8211735806d66f08fd5bfdeadae2b74e8b2859d7 (commit)
       via  a845235208971abe74461a05864bb22a5ad743a8 (commit)
      from  d5d779cd1b1ac10d2678162e7beafe4b284d5446 (commit)

Summary of changes:
 devel/tools/rt-static-docs | 42 +++++++++++++++++++++++++++++++++++++++++-
 lib/RT/Pod/HTMLBatch.pm    |  6 ++++--
 2 files changed, 45 insertions(+), 3 deletions(-)

- Log -----------------------------------------------------------------
commit a845235208971abe74461a05864bb22a5ad743a8
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Sep 13 16:46:09 2012 -0700

    rt-static-docs: accept a tarball for the --rt option
    
    Generating docs from releases is now dead easy.

diff --git a/devel/tools/rt-static-docs b/devel/tools/rt-static-docs
index 0afebd0..8648477 100755
--- a/devel/tools/rt-static-docs
+++ b/devel/tools/rt-static-docs
@@ -77,6 +77,16 @@ $opts{to} = File::Spec->rel2abs($opts{to});
 make_path( $opts{to} )              unless -e $opts{to};
 die "--to MUST be a directory\n"    unless -d $opts{to};
 
+# Unpack the tarball, if that's what we're given.
+if (($opts{rt} || '') =~ /\.tar\.gz$/ and -f $opts{rt}) {
+    my $tmpdir = "/tmp/rt-docs-$$";
+
+    mkdir $tmpdir
+        or die "Unable to mkdir $tmpdir: $!\n";
+
+    system qq[tar xzpf "$opts{rt}" -C $tmpdir];
+    $opts{rt} = <$tmpdir/rt-*>;
+}
 chdir $opts{rt} if $opts{rt};
 
 my @dirs = (qw(
@@ -153,6 +163,9 @@ Set the RT base directory to search under.  Defaults to the current working
 directory, which is fine if you're running this script as
 C<devel/tools/rt-static-docs>.
 
+May also point to a tarball (a file ending in C<.tar.gz>) which will be
+unpacked into a temporary directory and used as the RT base directory.
+
 =item --help
 
 Print this help.

commit 8211735806d66f08fd5bfdeadae2b74e8b2859d7
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Sep 13 16:49:24 2012 -0700

    rt-static-docs: generate a page for ./configure --help

diff --git a/devel/tools/rt-static-docs b/devel/tools/rt-static-docs
index 8648477..305d5d9 100755
--- a/devel/tools/rt-static-docs
+++ b/devel/tools/rt-static-docs
@@ -52,7 +52,7 @@ use warnings;
 
 use Getopt::Long;
 use File::Spec;
-use File::Path 'make_path';
+use File::Path qw(make_path rmtree);
 use HTML::Entities qw(encode_entities);
 use RT::Pod::HTMLBatch;
 
@@ -103,6 +103,33 @@ my @dirs = (qw(
 
 my $converter = RT::Pod::HTMLBatch->new;
 
+sub generate_configure_help {
+    my $configure = shift;
+    my $help = `./$configure --help`;
+    my $dest = "$opts{to}/configure.html";
+
+    if ($help and open my $html, ">", $dest) {
+        print $html join "\n",
+            "<pre>", encode_entities($help), "</pre>", "\n";
+        close $html;
+        $converter->note_for_contents_file(["configure options"], $configure, $dest);
+    } else {
+        warn "Can't open $dest: $!";
+    }
+}
+
+# Generate a page for ./configure --help if we can
+if (-x "configure.ac" and -d ".git") {
+    rmtree("autom4te.cache") if -d "autom4te.cache";
+    generate_configure_help("configure.ac");
+}
+elsif (-x "configure") {
+    generate_configure_help("configure");
+}
+else {
+    warn "Unable to generate a page for ./configure --help!\n";
+}
+
 # Manually "convert" README* and docs/UPGRADING* to HTML and push them into the
 # known contents.
 for my $file (<README* docs/UPGRADING* UPGRADING*>) {
diff --git a/lib/RT/Pod/HTMLBatch.pm b/lib/RT/Pod/HTMLBatch.pm
index 5e06af3..8d1b67f 100644
--- a/lib/RT/Pod/HTMLBatch.pm
+++ b/lib/RT/Pod/HTMLBatch.pm
@@ -33,16 +33,18 @@ sub classify {
     my %info = (@_);
 
     my $is_install_doc = sub {
-        local $_ = shift;
+        my %page = @_;
+        local $_ = $page{name};
         return 1 if /^(README|UPGRADING)/;
         return 1 if $_ eq "RT_Config";
         return 1 if $_ eq "web_deployment";
+        return 1 if $page{infile} =~ m{^configure(\.ac)?$};
         return 0;
     };
 
     my $section = $info{infile} =~ m{/plugins/([^/]+)}      ? "05 Extension: $1"           :
                   $info{infile} =~ m{/local/}               ? '04 Local Documenation'      :
-                  $is_install_doc->($info{name})            ? '00 Install and Upgrade '.
+                  $is_install_doc->(%info)                  ? '00 Install and Upgrade '.
                                                                  'Documentation'           :
                   $info{infile} =~ m{/(docs|etc)/}          ? '01 User Documentation'      :
                   $info{infile} =~ m{/bin/}                 ? '02 Utilities (bin)'         :

-----------------------------------------------------------------------


More information about the Rt-commit mailing list