summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRuss Allbery <rra@cpan.org>2016-10-25 16:58:12 -0700
committerRuss Allbery <rra@cpan.org>2016-10-25 16:58:12 -0700
commit4e4749435123e17184deaabdf7a58d923e10f662 (patch)
tree3f830994de2b8cd1a9602865be124421f65718d1
parentec8afeb0a065539cbe4b006111707bed5e9fad14 (diff)
Add support for Markdown README
Add a new template, tests, and a README.md file for this package. This is for better documentation display on GitHub. For the time being, include the README file in the distribution as well. (I may change my mind and drop it later.) This requires a bit of a rework of section headings, since I don't want to use all caps with Markdown where we have actual font changes.
-rw-r--r--README26
-rw-r--r--README.md154
-rw-r--r--docs/metadata/requirements26
-rw-r--r--share/templates/readme-md.tmpl104
-rw-r--r--share/templates/readme.tmpl2
-rwxr-xr-xt/api/basic.t10
-rw-r--r--t/data/lbcd/metadata/description2
-rw-r--r--t/data/lbcd/metadata/metadata.json4
-rw-r--r--t/data/lbcd/output/readme2
-rw-r--r--t/data/lbcd/output/readme-md175
-rw-r--r--t/data/lbcd/output/thread2
11 files changed, 470 insertions, 37 deletions
diff --git a/README b/README
index 4a80ffa..0b330c6 100644
--- a/README
+++ b/README
@@ -53,23 +53,23 @@ REQUIREMENTS
Perl 5.18 or later and Module::Build are required to build this module.
The following additional Perl modules are required to use it:
- File::BaseDir
- File::ShareDir
- JSON
- Perl6::Slurp
- Template (part of Template Toolkit)
+ * File::BaseDir
+ * File::ShareDir
+ * JSON
+ * Perl6::Slurp
+ * Template (part of Template Toolkit)
IPC::System::Simple is required to run the test suite. The following
additional Perl modules will be used by the test suite if present:
- Devel::Cover
- Test::MinimumVersion
- Test::Perl::Critic
- Test::Pod
- Test::Pod::Coverage
- Test::Spelling
- Test::Strict
- Test::Synopsis
+ * Devel::Cover
+ * Test::MinimumVersion
+ * Test::Perl::Critic
+ * Test::Pod
+ * Test::Pod::Coverage
+ * Test::Spelling
+ * Test::Strict
+ * Test::Synopsis
All are available on CPAN. Those tests will be skipped if the modules
are not available.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b5c842d
--- /dev/null
+++ b/README.md
@@ -0,0 +1,154 @@
+# DocKnot 1.00
+
+Copyright 2013-2016 Russ Allbery <rra@cpan.org>. This software is
+distributed under a BSD-style license. Please see the section LICENSE
+below for more information.
+
+## Blurb
+
+DocKnot is a system for generating consistent human-readable software
+package documentation from metadata files and templates. The metadata is
+primarily JSON files, but can include files of documentation snippets.
+The goal is to generate both web pages and distributed documentation files
+(such as README) from the same source, using templates for consistency
+across multiple packages.
+
+## Description
+
+After years of maintaining a variety of small free software packages, I
+found the most tedious part of making a new release was updating the
+documentation in multiple locations. Copyright dates would change,
+prerequisites and package descriptions would change, and I had to update
+at least the package README file and its web pages separately. The last
+straw was when GitHub became popular and I wanted to provide a Markdown
+version of README as well, avoiding the ugly text rendering on the GitHub
+page for a package.
+
+This package uses one metadata directory as its source information and
+generates all the various bits of documentation for a package. This
+allows me to make any changes in one place and then just regenerate the
+web page, included documentation, and other files to incorporate those
+changes. It also lets me make changes to the templates to improve shared
+wording and push that out to every package I maintain during its next
+release, without having to remember which changes I wanted to make.
+
+DocKnot was designed and written for my personal needs, and I'm not sure
+it will be useful for anyone else. At the least, the template files are
+rather specific to my preferences about how to write package
+documentation, and the web page output is in my personal thread language
+as opposed to HTML. I'm not sure if I'll have the time to make it a more
+general tool. But you're certainly welcome to use it if you find it
+useful, send pull requests to make it more general, or take ideas from it
+for your own purposes.
+
+Currently included in this package are just the App::DocKnot module (which
+contains most of the logic), a small docknot driver program, and the
+templates I use for my own software. Over time, it may include more of my
+web publishing framework, time permitting.
+
+## Requirements
+
+Perl 5.18 or later and Module::Build are required to build this module.
+The following additional Perl modules are required to use it:
+
+* File::BaseDir
+* File::ShareDir
+* JSON
+* Perl6::Slurp
+* Template (part of Template Toolkit)
+
+IPC::System::Simple is required to run the test suite. The following
+additional Perl modules will be used by the test suite if present:
+
+* Devel::Cover
+* Test::MinimumVersion
+* Test::Perl::Critic
+* Test::Pod
+* Test::Pod::Coverage
+* Test::Spelling
+* Test::Strict
+* Test::Synopsis
+
+All are available on CPAN. Those tests will be skipped if the modules are
+not available.
+
+To enable tests that don't detect functionality problems but are used to
+sanity-check the release, set the environment variable RELEASE_TESTING to
+a true value. To enable tests that may be sensitive to the local
+environment or that produce a lot of false positives without uncovering
+many problems, set the environment variable AUTHOR_TESTING to a true
+value.
+
+## Support
+
+The DocKnot web page at:
+
+ https://www.eyrie.org/~eagle/software/docknot/
+
+will always have the current version of this package, the current
+documentation, and pointers to any additional resources.
+
+For bug tracking, this package uses the CPAN bug tracker at:
+
+ https://rt.cpan.org/Dist/Display.html?Name=App-Docknot
+
+I welcome bug reports and patches for this package at rra@cpan.org or via
+the CPAN bug tracker. However, please be aware that I tend to be
+extremely busy and work projects often take priority. I'll save your mail
+and get to it as soon as I can, but it may take me a couple of months.
+
+## Source Repository
+
+DocKnot is maintained using Git. You can access the current source by
+cloning the repository at:
+
+ https://git.eyrie.org/git/devel/docknot.git
+
+or view the repository via the web at:
+
+ https://git.eyrie.org/?p=devel/docknot.git
+
+You can also use GitHub via:
+
+ https://github.com/rra/docknot
+
+The eyrie.org repository is the canonical one, maintained by the author,
+but using GitHub is probably more convenient for most purposes. Pull
+requests are gratefully reviewed and normally accepted. It's probably
+better to use the CPAN bug tracker than GitHub issues, though, to keep all
+Perl module issues in the same place.
+
+## License
+
+The DocKnot package as a whole is covered by the following copyright
+statement and license:
+
+ Copyright 2013-2016 Russ Allbery <rra@cpan.org>
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Some files in this distribution are individually released under different
+licenses, all of which are compatible with the above general package
+license but which may require preservation of additional notices. All
+required notices, and detailed information about the licensing of each
+file, are recorded in the LICENSE file.
+
+For any copyright range specified by files in this package as YYYY-ZZZZ,
+the range specifies every single year in that closed interval.
diff --git a/docs/metadata/requirements b/docs/metadata/requirements
index e226b68..3fc638a 100644
--- a/docs/metadata/requirements
+++ b/docs/metadata/requirements
@@ -1,23 +1,23 @@
Perl 5.18 or later and Module::Build are required to build this module.
The following additional Perl modules are required to use it:
- File::BaseDir
- File::ShareDir
- JSON
- Perl6::Slurp
- Template (part of Template Toolkit)
+* File::BaseDir
+* File::ShareDir
+* JSON
+* Perl6::Slurp
+* Template (part of Template Toolkit)
IPC::System::Simple is required to run the test suite. The following
additional Perl modules will be used by the test suite if present:
- Devel::Cover
- Test::MinimumVersion
- Test::Perl::Critic
- Test::Pod
- Test::Pod::Coverage
- Test::Spelling
- Test::Strict
- Test::Synopsis
+* Devel::Cover
+* Test::MinimumVersion
+* Test::Perl::Critic
+* Test::Pod
+* Test::Pod::Coverage
+* Test::Spelling
+* Test::Strict
+* Test::Synopsis
All are available on CPAN. Those tests will be skipped if the modules are
not available.
diff --git a/share/templates/readme-md.tmpl b/share/templates/readme-md.tmpl
new file mode 100644
index 0000000..29a4359
--- /dev/null
+++ b/share/templates/readme-md.tmpl
@@ -0,0 +1,104 @@
+# [% name %] [% version %]
+
+[% FOREACH copr IN copyrights %]Copyright [% copr.years %]
+[% copr.holder %]. [% END %]This software is distributed under
+[% license.summary %]. Please see the section LICENSE below for more
+information.
+
+## Blurb
+
+[% blurb %]
+
+## Description
+
+[% description %]
+
+## Requirements
+
+[% requirements %]
+[% IF requirements.lancaster %]
+To enable tests that don't detect functionality problems but are used to
+sanity-check the release, set the environment variable RELEASE_TESTING
+to a true value. To enable tests that may be sensitive to the local
+environment or that produce a lot of false positives without uncovering
+many problems, set the environment variable AUTHOR_TESTING to a true
+value.
+[% END %][% IF build.autotools %]
+To bootstrap from a Git checkout, or if you change the Automake files
+and need to regenerate Makefile.in, you will need Automake
+[% build.automake %] or later. For bootstrap or if you change
+configure.ac or any of the m4 files it includes and need to regenerate
+configure or config.h.in, you will need Autoconf [% build.autoconf %] or
+later.
+[% END %]
+[% FOREACH section IN readme.sections %]## [% section.title %]
+
+[% section.body %]
+
+[% END %]## Support
+
+The [% name %] web page at:
+
+ [% support.web %]
+
+will always have the current version of this package, the current
+documentation, and pointers to any additional resources.
+[% IF support.cpan %]
+For bug tracking, this package uses the CPAN bug tracker at:
+
+ https://rt.cpan.org/Dist/Display.html?Name=[% support.cpan %]
+[% END %][% IF support.listname %]
+New [% name %] releases are announced on the [% support.listname %]
+mailing list. To subscribe or see the list archives, go to:
+
+ [% support.listurl %]
+[% END %]
+
+I welcome bug reports and patches for this package at
+[% support.email %][% IF support.cpan %] or via the CPAN bug
+tracker[% END %]. However, please be aware that I tend to be extremely
+busy and work projects often take priority. I'll save your mail and get
+to it as soon as I can, but it may take me a couple of months.
+
+## Source Repository
+
+[% name %] is maintained using [% vcs.type %]. You can access the current
+source by cloning the repository at:
+
+ [% vcs.url %]
+
+or view the repository via the web at:
+
+ [% vcs.browse %]
+[% IF vcs.github %]
+You can also use GitHub via:
+
+ https://github.com/[% vcs.github %]
+
+The eyrie.org repository is the canonical one, maintained by the author,
+but using GitHub is probably more convenient for most purposes. Pull
+requests are gratefully reviewed and normally accepted.
+[% IF support.cpan %]It's probably better to use the CPAN bug tracker than
+GitHub issues, though, to keep all Perl module issues in the same
+place.[% END %]
+[% ELSIF vcs.type == 'Git' %]
+When contributing modifications, patches (possibly generated by
+git-format-patch) are preferred to Git pull requests.
+[% END %]
+## License
+
+The [% name %] package as a whole is covered by the following copyright
+statement and license:
+
+[% copyright(2) %]
+
+[% indent(license.full, 2) %]
+
+Some files in this distribution are individually released under different
+licenses, all of which are compatible with the above general package
+license but which may require preservation of additional notices. All
+required notices, and detailed information about the licensing of each
+file, are recorded in the LICENSE file.
+
+For any copyright range specified by files in this package as YYYY-ZZZZ,
+the range specifies every single year in that closed interval.
diff --git a/share/templates/readme.tmpl b/share/templates/readme.tmpl
index d2ad97d..cbd3746 100644
--- a/share/templates/readme.tmpl
+++ b/share/templates/readme.tmpl
@@ -34,7 +34,7 @@ REQUIREMENTS
configure or config.h.in, you will need Autoconf [% build.autoconf %] or
later.
[% END %]
-[% FOREACH section IN readme.sections %][% section.title %]
+[% FOREACH section IN readme.sections %][% section.title FILTER upper %]
[% indent(section.body, 2) %]
diff --git a/t/api/basic.t b/t/api/basic.t
index aa80984..f298811 100755
--- a/t/api/basic.t
+++ b/t/api/basic.t
@@ -3,7 +3,7 @@
# Tests for the App::DocKnot module API.
#
# Written by Russ Allbery <rra@cpan.org>
-# Copyright 2013 Russ Allbery <rra@cpan.org>
+# Copyright 2013, 2016 Russ Allbery <rra@cpan.org>
#
# See LICENSE for licensing terms.
@@ -14,7 +14,7 @@ use warnings;
use File::Spec;
use IPC::System::Simple qw(capturex);
use Perl6::Slurp;
-use Test::More tests => 4;
+use Test::More tests => 5;
# Load the module.
BEGIN { use_ok('App::DocKnot') }
@@ -29,7 +29,7 @@ BEGIN { use_ok('App::DocKnot') }
#
# Returns: undef
# Throws: Exception on failure to read or write files or run diff
-sub is_diff {
+sub is_file_contents {
my ($got, $expected, $message) = @_;
# If they're equal, this is simple.
@@ -71,9 +71,9 @@ for my $test (@tests) {
isa_ok($docknot, 'App::DocKnot', "for $test");
# Loop through the possible templates.
- for my $template (qw(readme thread)) {
+ for my $template (qw(readme readme-md thread)) {
my $got = $docknot->generate($template);
my $path = File::Spec->catfile($dataroot, $test, 'output', $template);
- is_diff($got, $path, "$template for $test");
+ is_file_contents($got, $path, "$template for $test");
}
}
diff --git a/t/data/lbcd/metadata/description b/t/data/lbcd/metadata/description
index f634859..41b7657 100644
--- a/t/data/lbcd/metadata/description
+++ b/t/data/lbcd/metadata/description
@@ -6,7 +6,7 @@ be used as input to a load-balancing system to choose the best system to
which to direct new incoming connections. It was designed for use with
the lbnamed DNS load balancer, available at:
- <http://www.stanford.edu/~riepel/lbnamed/>
+ https://www.stanford.edu/~riepel/lbnamed/
It was originally written by Roland Schemers, was rewritten by Larry
Schwimmer to add protocol version 3 with some additional features and
diff --git a/t/data/lbcd/metadata/metadata.json b/t/data/lbcd/metadata/metadata.json
index 4c4974c..6638d71 100644
--- a/t/data/lbcd/metadata/metadata.json
+++ b/t/data/lbcd/metadata/metadata.json
@@ -28,8 +28,8 @@
},
"readme": {
"sections": [
- { "title": "INSTALLATION" },
- { "title": "TESTING" },
+ { "title": "Installation" },
+ { "title": "Testing" },
],
},
"distribution": {
diff --git a/t/data/lbcd/output/readme b/t/data/lbcd/output/readme
index 2cae81f..b538f34 100644
--- a/t/data/lbcd/output/readme
+++ b/t/data/lbcd/output/readme
@@ -26,7 +26,7 @@ DESCRIPTION
best system to which to direct new incoming connections. It was
designed for use with the lbnamed DNS load balancer, available at:
- <http://www.stanford.edu/~riepel/lbnamed/>
+ https://www.stanford.edu/~riepel/lbnamed/
It was originally written by Roland Schemers, was rewritten by Larry
Schwimmer to add protocol version 3 with some additional features and
diff --git a/t/data/lbcd/output/readme-md b/t/data/lbcd/output/readme-md
new file mode 100644
index 0000000..5198d38
--- /dev/null
+++ b/t/data/lbcd/output/readme-md
@@ -0,0 +1,175 @@
+# lbcd 3.4.2
+
+Copyright 1993-1994, 1996-1998, 2000, 2003-2009, 2012-2013 The Board of
+Trustees of the Leland Stanford Junior University. This software is
+distributed under a BSD-style license. Please see the section LICENSE
+below for more information.
+
+## Blurb
+
+lbcd is a daemon that runs on a UNIX system and answers UDP queries with
+information about system load, number of logged-on users, uptime, and free
+/tmp space. This information can be used to accumulate system status
+across a cluster with light-weight queries or can be used as input to a
+load-balancing system to choose the best system to which to direct new
+incoming connections.
+
+## Description
+
+The lbcd daemon runs on a UNIX system and answers UDP queries (by default
+on port 4330) with information about system load, number of logged on
+users, uptime, and free /tmp space. This information can be used to
+accumulate system status across a cluster with light-weight queries or can
+be used as input to a load-balancing system to choose the best system to
+which to direct new incoming connections. It was designed for use with
+the lbnamed DNS load balancer, available at:
+
+ https://www.stanford.edu/~riepel/lbnamed/
+
+It was originally written by Roland Schemers, was rewritten by Larry
+Schwimmer to add protocol version 3 with some additional features and
+service probing, and is currently maintained by Russ Allbery.
+
+The information provided isn't particularly sophisticated, and a good
+hardware load balancer will be able to consider such things as connection
+latency and responsiveness to make better decisions, but lbcd with lbnamed
+works quite well for smaller scale problems, scales well to multiple load
+balance pools for different services, and is much simpler and cheaper to
+understand and deploy.
+
+Included in this package is a small client program, lbcdclient, which can
+query an lbcd server and display a formatted version of the returned
+information.
+
+## Requirements
+
+lbcd is written in C, so you'll need a C compiler. It also uses kernel
+calls to obtain load and uptime information, and at present has only been
+ported to Linux, Solaris, AIX, various BSD systems, Mac OS X, HP-UX, IRIX,
+and Tru64. It is currently primarily tested on Linux. Platforms not
+listed may require some porting effort, as may old or unusual platforms
+that aren't regularly tested.
+
+The lbcdclient program requires Perl (any version should do).
+
+To bootstrap from a Git checkout, or if you change the Automake files and
+need to regenerate Makefile.in, you will need Automake 1.11 or later. For
+bootstrap or if you change configure.ac or any of the m4 files it includes
+and need to regenerate configure or config.h.in, you will need Autoconf
+2.64 or later.
+
+## Installation
+
+You can build and install remctl with the standard commands:
+
+ ./configure make make install
+
+Pass --enable-silent-rules to configure for a quieter build (similar to
+the Linux kernel). Use make warnings instead of make to build with full
+GCC compiler warnings (requires a relatively current version of GCC).
+
+The last step will probably have to be done as root. By default, remctl
+installs itself under /usr/local; you can change that path by passing the
+--prefix=PATH argument to configure.
+
+lbcd looks for $sysconfdir/nolbcd and returns the maximum load if that
+file is present, allowing one to effectively drop a system out of a
+load-balanced pool by touching that file. By default, the path is
+/usr/local/etc/nolbcd, but you may want to pass --sysconfdir=/etc to
+configure to use /etc/nolbcd.
+
+lbcdclient is written in Perl, so you may have to edit the first line of
+the script to point to the correct Perl location on your system. It does
+not use any sophisticated Perl features or add-on modules.
+
+You will generally want to start lbcd at system boot. All that is needed
+is a simple init script to start lbcd with the appropriate options or kill
+it again. It writes its PID into /var/run/lbcd.pid by default (and this
+can be changed with the -P option). On many systems, lbcd will need to
+run as root or as a member of particular groups to obtain system load
+average and uptime information.
+
+## Testing
+
+lbcd comes with a rudimentary test suite, which you can run after building
+lbcd with:
+
+ make check
+
+If a test case fails, please run the that individual test case with
+verbose output using:
+
+ tests/runtests -o <name-of-test>
+
+and send me the output when reporting the problem. Currently, the test
+suite only checks the portability and utility libraries; tests for lbcd
+and lbcdclient are coming in later releases.
+
+## Support
+
+The lbcd web page at:
+
+ https://www.eyrie.org/~eagle/software/lbcd/
+
+will always have the current version of this package, the current
+documentation, and pointers to any additional resources.
+
+New lbcd releases are announced on the lbnamed-users mailing list. To
+subscribe or see the list archives, go to:
+
+ https://mailman.stanford.edu/mailman/listinfo/lbnamed-users
+
+I welcome bug reports and patches for this package at eagle@eyrie.org.
+However, please be aware that I tend to be extremely busy and work
+projects often take priority. I'll save your mail and get to it as soon
+as I can, but it may take me a couple of months.
+
+## Source Repository
+
+lbcd is maintained using Git. You can access the current source by
+cloning the repository at:
+
+ git://git.eyrie.org/system/lbcd.git
+
+or view the repository via the web at:
+
+ http://git.eyrie.org/?p=system/lbcd.git
+
+When contributing modifications, patches (possibly generated by
+git-format-patch) are preferred to Git pull requests.
+
+## License
+
+The lbcd package as a whole is covered by the following copyright
+statement and license:
+
+ Copyright 1993-1994, 1996-1998, 2000, 2003-2009, 2012-2013
+ The Board of Trustees of the Leland Stanford Junior University
+
+ Permission is hereby granted, free of charge, to any person obtaining a
+ copy of this software and associated documentation files (the
+ "Software"), to deal in the Software without restriction, including
+ without limitation the rights to use, copy, modify, merge, publish,
+ distribute, sublicense, and/or sell copies of the Software, and to
+ permit persons to whom the Software is furnished to do so, subject to
+ the following conditions:
+
+ The above copyright notice and this permission notice shall be included
+ in all copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
+ IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Some files in this distribution are individually released under different
+licenses, all of which are compatible with the above general package
+license but which may require preservation of additional notices. All
+required notices, and detailed information about the licensing of each
+file, are recorded in the LICENSE file.
+
+For any copyright range specified by files in this package as YYYY-ZZZZ,
+the range specifies every single year in that closed interval.
diff --git a/t/data/lbcd/output/thread b/t/data/lbcd/output/thread
index 59895c1..ab18a51 100644
--- a/t/data/lbcd/output/thread
+++ b/t/data/lbcd/output/thread
@@ -54,7 +54,7 @@ be used as input to a load-balancing system to choose the best system to
which to direct new incoming connections. It was designed for use with
the lbnamed DNS load balancer, available at:
- <http://www.stanford.edu/~riepel/lbnamed/>
+ https://www.stanford.edu/~riepel/lbnamed/
It was originally written by Roland Schemers, was rewritten by Larry
Schwimmer to add protocol version 3 with some additional features and