CC: | Mark Grimes <mgrimes [...] cpan.org> |
Subject: | [PATCH] Creates a ReplaceSource::DefaultGitHub version of the section plugin |
Date: | Tue, 26 Jan 2016 18:09:30 -0500 |
To: | bug-Pod-Weaver-Section-Source-DefaultGitHub [...] rt.cpan.org |
From: | Mark Grimes <mgrimes [...] cpan.org> |
- Uses the Pod::Weaver::Role::SectionReplacer role to replace the
section if it already exists. This is useful for standalone podweaver
usage. It has been use/proven in
Pod::Weaver::PluginBundle::ReplaceBoilerplate,
Pod::Weaver::Section::Replace{Name,Version,Authors,etc}.
---
.../Weaver/Section/ReplaceSource/DefaultGitHub.pm | 59 ++++++++++++++++++++++
1 file changed, 59 insertions(+)
create mode 100644 lib/Pod/Weaver/Section/ReplaceSource/DefaultGitHub.pm
diff --git a/lib/Pod/Weaver/Section/ReplaceSource/DefaultGitHub.pm b/lib/Pod/Weaver/Section/ReplaceSource/DefaultGitHub.pm
new file mode 100644
index 0000000..4f5fe2f
--- /dev/null
+++ b/lib/Pod/Weaver/Section/ReplaceSource/DefaultGitHub.pm
@@ -0,0 +1,59 @@
+package Pod::Weaver::Section::ReplaceSource::DefaultGitHub;
+
+# DATE
+# VERSION
+
+use 5.010001;
+use Moose;
+#use Text::Wrap ();
+extends 'Pod::Weaver::Section::Source::DefaultGitHub';
+with 'Pod::Weaver::Role::SectionReplacer';
+
+sub default_section_name { 'SOURCE' }
+
+no Moose;
+1;
+# ABSTRACT: Replaces a SOURCE section (repository defaults to GitHub)
+
+=for Pod::Coverage weave_section
+
+=head1 SYNOPSIS
+
+This section plugin provides the same behaviour as
+L<Pod::Weaver::Section::Source::DefaultGitHub> but with the
+Pod::Weaver::Role::SectionReplacer role applied.
+
+In your C<weaver.ini>:
+
+ [Source::DefaultGitHub]
+
+If C<repository> is not specified in dist.ini, will search for github user/repo
+name from git config file (C<.git/config>).
+
+To specify a source repository other than C<https://github.com/USER/REPO>, in
+dist.ini:
+
+ [MetaResources]
+ repository=http://example.com/
+
+
+=head1 DESCRIPTION
+
+This section plugin adds a SOURCE section, using C<repository> metadata or (if
+not specified) GitHub.
+
+
+=head1 ATTRIBUTES
+
+=head2 text
+
+The text that is added. C<%s> is replaced by the repository url.
+
+Default: C<Source repository is at LE<lt>%sE<gt>.>
+
+
+=head1 SEE ALSO
+
+L<Pod::Weaver::Section::SourceGitHub>
+
+=cut
--
2.7.0