[Rt-commit] rt branch, 4.0/static-docs, updated. rt-4.0.6-329-g7b7e756

Thomas Sibley trs at bestpractical.com
Thu Sep 6 14:00:43 EDT 2012


The branch, 4.0/static-docs has been updated
       via  7b7e7566576c8db7828b0b658da4aad99fce75a4 (commit)
       via  a6e0ad260a9b26cc26a3676a04cb65cb398153e1 (commit)
      from  c9e0c0fc6bb3923dfd824febe2b63e6d160d0046 (commit)

Summary of changes:
 lib/RT/Pod/HTMLBatch.pm | 57 +++++++++++++++++++++++++++++++++----------------
 1 file changed, 39 insertions(+), 18 deletions(-)

- Log -----------------------------------------------------------------
commit a6e0ad260a9b26cc26a3676a04cb65cb398153e1
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Sep 6 10:49:05 2012 -0700

    Refactor doc classification into a separate method

diff --git a/lib/RT/Pod/HTMLBatch.pm b/lib/RT/Pod/HTMLBatch.pm
index 426addc..9e66d4a 100644
--- a/lib/RT/Pod/HTMLBatch.pm
+++ b/lib/RT/Pod/HTMLBatch.pm
@@ -28,6 +28,31 @@ sub new {
     return $self;
 }
 
+sub classify {
+    my $self = shift;
+    my %info = (@_);
+
+    my $section = $info{infile} =~ m{/plugins/([^/]+)}      ? "05 Extension: $1"           :
+                  $info{infile} =~ m{/local/}               ? '04 Local Documenation'      :
+                  $info{infile} =~ m{/(docs|etc)/}          ? '01 User Documentation'      :
+                  $info{infile} =~ m{/bin/}                 ? '02 Utilities (bin)'         :
+                  $info{infile} =~ m{/sbin/}                ? '03 Utilities (sbin)'        :
+                  $info{name}   =~ /^RT::Action/            ? '08 Actions'                 :
+                  $info{name}   =~ /^RT::Condition/         ? '09 Conditions'              :
+                  $info{name}   =~ /^RT(::|$)/              ? '07 Developer Documentation' :
+                  $info{name}   =~ /^(README|UPGRADING)/    ? '00 Install and Upgrade '.
+                                                                 'Documentation'           :
+                  $info{infile} =~ m{/devel/tools/}         ? '20 Utilities (devel/tools)' :
+                                                              '06 Miscellaneous'           ;
+
+    if ($section =~ /User/) {
+        $info{name} =~ s/_/ /g;
+        $info{name} = join "/", map { ucfirst } split /::/, $info{name};
+    }
+
+    return ($info{name}, $section);
+}
+
 sub write_contents_file {
     my ($self, $to) = @_;
     return unless $self->contents_file;
@@ -43,28 +68,16 @@ sub write_contents_file {
     my %toc;
     for my $page (@$pages) {
         my ($name, $infile, $outfile, $pieces) = @$page;
-        my $section = $infile =~ m{/plugins/([^/]+)}    ? "05 Extension: $1"           :
-                      $infile =~ m{/local/}             ? '04 Local Documenation'      :
-                      $infile =~ m{/(docs|etc)/}        ? '01 User Documentation'      :
-                      $infile =~ m{/bin/}               ? '02 Utilities (bin)'         :
-                      $infile =~ m{/sbin/}              ? '03 Utilities (sbin)'        :
-                      $name   =~ /^RT::Action/          ? '08 Actions'                 :
-                      $name   =~ /^RT::Condition/       ? '09 Conditions'              :
-                      $name   =~ /^RT(::|$)/            ? '07 Developer Documentation' :
-                      $name   =~ /^(README|UPGRADING)/  ? '00 Install and Upgrade '.
-                                                             'Documentation'           :
-                      $infile =~ m{/devel/tools/}       ? '20 Utilities (devel/tools)' :
-                                                          '06 Miscellaneous'           ;
-
-        if ($section =~ /User/) {
-            $name =~ s/_/ /g;
-            $name = join "/", map { ucfirst } split /::/, $name;
-        }
+
+        my ($title, $section) = $self->classify(
+            name    => $name,
+            infile  => $infile,
+        );
 
         (my $path = $outfile) =~ s{^\Q$to\E/?}{};
 
         push @{ $toc{$section} }, {
-            name => $name,
+            name => $title,
             path => $path,
         };
     }

commit 7b7e7566576c8db7828b0b658da4aad99fce75a4
Author: Thomas Sibley <trs at bestpractical.com>
Date:   Thu Sep 6 10:59:58 2012 -0700

    Classify RT_Config.pm and docs/web_deployment.pod under Install

diff --git a/lib/RT/Pod/HTMLBatch.pm b/lib/RT/Pod/HTMLBatch.pm
index 9e66d4a..5e06af3 100644
--- a/lib/RT/Pod/HTMLBatch.pm
+++ b/lib/RT/Pod/HTMLBatch.pm
@@ -32,20 +32,28 @@ sub classify {
     my $self = shift;
     my %info = (@_);
 
+    my $is_install_doc = sub {
+        local $_ = shift;
+        return 1 if /^(README|UPGRADING)/;
+        return 1 if $_ eq "RT_Config";
+        return 1 if $_ eq "web_deployment";
+        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 '.
+                                                                 'Documentation'           :
                   $info{infile} =~ m{/(docs|etc)/}          ? '01 User Documentation'      :
                   $info{infile} =~ m{/bin/}                 ? '02 Utilities (bin)'         :
                   $info{infile} =~ m{/sbin/}                ? '03 Utilities (sbin)'        :
                   $info{name}   =~ /^RT::Action/            ? '08 Actions'                 :
                   $info{name}   =~ /^RT::Condition/         ? '09 Conditions'              :
                   $info{name}   =~ /^RT(::|$)/              ? '07 Developer Documentation' :
-                  $info{name}   =~ /^(README|UPGRADING)/    ? '00 Install and Upgrade '.
-                                                                 'Documentation'           :
                   $info{infile} =~ m{/devel/tools/}         ? '20 Utilities (devel/tools)' :
                                                               '06 Miscellaneous'           ;
 
-    if ($section =~ /User/) {
+    if ($info{infile} =~ m{/(docs|etc)/}) {
         $info{name} =~ s/_/ /g;
         $info{name} = join "/", map { ucfirst } split /::/, $info{name};
     }

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


More information about the Rt-commit mailing list