]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 1159318 - make docs/makedocs.pl and extensions/create.pl agree on the name of...
authorGervase Markham <gerv@gerv.net>
Tue, 5 May 2015 13:14:47 +0000 (14:14 +0100)
committerGervase Markham <gerv@gerv.net>
Tue, 5 May 2015 13:14:47 +0000 (14:14 +0100)
extensions/create.pl
template/en/default/extensions/index-admin.rst.tmpl [new file with mode: 0644]
template/en/default/extensions/index-user.rst.tmpl [new file with mode: 0644]

index d4256694bca97c60ccec79cf4a929eae04e1d384..7c8693e289be4511dc8a092518819287fec7b4b7 100755 (executable)
@@ -10,7 +10,10 @@ use 5.10.1;
 use strict;
 use warnings;
 
-use lib qw(. lib);
+use File::Basename;
+BEGIN { chdir dirname($0); }
+
+use lib qw(.. ../lib);
 
 use Bugzilla;
 use Bugzilla::Constants;
@@ -32,7 +35,7 @@ mkpath($extension_dir)
   || die "$extension_dir already exists or cannot be created.\n";
 
 my $lcname = lc($name);
-foreach my $path (qw(lib doc web template/en/default/hook), 
+foreach my $path (qw(lib docs/en/rst web template/en/default/hook),
                   "template/en/default/$lcname")
 {
     mkpath("$extension_dir/$path") || die "$extension_dir/$path: $!";
@@ -47,7 +50,8 @@ my %create_files = (
     'web-readme.txt.tmpl'  => 'web/README',
     'hook-readme.txt.tmpl' => 'template/en/default/hook/README',
     'name-readme.txt.tmpl' => "template/en/default/$lcname/README",
-    'name.rst.tmpl'        => "doc/$lcname.rst",
+    'index-admin.rst.tmpl' => "docs/en/rst/index-admin.rst",
+    'index-user.rst.tmpl'  => "docs/en/rst/index-user.rst",
 );
 
 foreach my $template_file (keys %create_files) {
@@ -55,9 +59,10 @@ foreach my $template_file (keys %create_files) {
     my $output;
     $template->process("extensions/$template_file", $vars, \$output)
       or ThrowTemplateError($template->error());
-   open(my $fh, '>', "$extension_dir/$target");
-   print $fh $output;
-   close($fh);
+    open(my $fh, '>', "$extension_dir/$target")
+      or die "extension_dir/$target: $!";
+    print $fh $output;
+    close($fh);
 }
 
 say get_text('extension_created', $vars);
diff --git a/template/en/default/extensions/index-admin.rst.tmpl b/template/en/default/extensions/index-admin.rst.tmpl
new file mode 100644 (file)
index 0000000..5089377
--- /dev/null
@@ -0,0 +1,23 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+  # License, v. 2.0. If a copy of the MPL was not distributed with this
+  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+  #
+  # This Source Code Form is "Incompatible With Secondary Licenses", as
+  # defined by the Mozilla Public License, v. 2.0.
+  #%]
+
+[%# INTERFACE:
+  # name: string; the name of the extension.
+  #%]
+
+[% USE String('#') %]
+[% name %]
+[%+ String.repeat(name.length) %]
+
+This is a sample Adminstrator documentation file for the [% name %] extension.
+Like all of the Bugzilla docs, it's written in
+`reStructured Text (reST) format <http://sphinx-doc.org/latest/rest.html>`_
+and will be compiled by `Sphinx <http://sphinx-doc.org/>`_.
+
+If you build the docs yourself using :file:`makedocs.pl`, this file will get
+incorporated into the Installed Extensions chapter of the Administration Guide.
diff --git a/template/en/default/extensions/index-user.rst.tmpl b/template/en/default/extensions/index-user.rst.tmpl
new file mode 100644 (file)
index 0000000..b09fc1c
--- /dev/null
@@ -0,0 +1,23 @@
+[%# This Source Code Form is subject to the terms of the Mozilla Public
+  # License, v. 2.0. If a copy of the MPL was not distributed with this
+  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
+  #
+  # This Source Code Form is "Incompatible With Secondary Licenses", as
+  # defined by the Mozilla Public License, v. 2.0.
+  #%]
+
+[%# INTERFACE:
+  # name: string; the name of the extension.
+  #%]
+
+[% USE String('#') %]
+[% name %]
+[%+ String.repeat(name.length) %]
+
+This is a sample User documentation file for the [% name %] extension.
+Like all of the Bugzilla docs, it's written in
+`reStructured Text (reST) format <http://sphinx-doc.org/latest/rest.html>`_
+and will be compiled by `Sphinx <http://sphinx-doc.org/>`_.
+
+If you build the docs yourself using :file:`makedocs.pl`, this file will get
+incorporated into the Installed Extensions chapter of the User Guide.