[Rt-commit] [rtir] 01/01: Prevent Module::Install::RTx from clobbering README
Kevin Falcone
falcone at bestpractical.com
Wed Sep 17 15:34:57 EDT 2014
This is an automated email from the git hooks/post-receive script.
falcone pushed a commit to branch 3.0-trunk
in repository rtir.
commit 4ce70f44da417ceeaa18945eaee4f75644d9ab25
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Mon Aug 11 14:59:43 2014 -0400
Prevent Module::Install::RTx from clobbering README
(cherry picked from commit 3d82ec5426eca35023173a4765888b6f2ef04036)
Conflicts:
META.yml
---
META.yml | 2 +-
Makefile.PL | 2 +-
inc/Module/Install/RTx.pm | 19 +++--
inc/Module/Install/ReadmeFromPod.pm | 138 ------------------------------------
4 files changed, 14 insertions(+), 147 deletions(-)
diff --git a/META.yml b/META.yml
index cea780d..02dfc8d 100644
--- a/META.yml
+++ b/META.yml
@@ -33,6 +33,6 @@ requires:
resources:
license: http://opensource.org/licenses/gpl-license.php
version: 3.0.HEAD
-x_module_install_rtx_version: 0.34_05
+x_module_install_rtx_version: 0.35_01
x_requires_rt: 4.0.14
x_rt_too_new: 4.2.0
diff --git a/Makefile.PL b/Makefile.PL
index 21e37e7..332e093 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,6 +1,6 @@
use inc::Module::Install;
-RTx('RT-IR');
+RTx('RT-IR', { no_readme_generation => 1 });
license('GPL Version 2');
author('Best Practical Solutions <sales at bestpractical.com>');
all_from('lib/RT/IR.pm');
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 160d13a..02e645b 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -8,7 +8,7 @@ no warnings 'once';
use Module::Install::Base;
use base 'Module::Install::Base';
-our $VERSION = '0.34_05';
+our $VERSION = '0.35_01';
use FindBin;
use File::Glob ();
@@ -18,7 +18,8 @@ my @DIRS = qw(etc lib html static bin sbin po var);
my @INDEX_DIRS = qw(lib bin sbin);
sub RTx {
- my ( $self, $name ) = @_;
+ my ( $self, $name, $extra_args ) = @_;
+ $extra_args ||= {};
# Set up names
my $fname = $name;
@@ -30,8 +31,10 @@ sub RTx {
unless $self->version;
$self->abstract("$name Extension")
unless $self->abstract;
- $self->readme_from( "lib/$fname.pm",
- { options => [ quotes => "none" ] } );
+ unless ( $extra_args->{no_readme_generation} ) {
+ $self->readme_from( "lib/$fname.pm",
+ { options => [ quotes => "none" ] } );
+ }
$self->add_metadata("x_module_install_rtx_version", $VERSION );
# Try to find RT.pm
@@ -62,7 +65,9 @@ sub RTx {
unshift @INC, $lib_path;
# Set a baseline minimum version
- $self->requires_rt('4.0.0');
+ unless ( $extra_args->{deprecated_rt} ) {
+ $self->requires_rt('4.0.0');
+ }
# Installation locations
my %path;
@@ -193,7 +198,7 @@ sub requires_rt_plugin {
my ( $plugin ) = @_;
if ($self->is_admin) {
- my $plugins = $self->{values}{"x_requires_rt_plugins"} || [];
+ my $plugins = $self->Meta->{values}{"x_requires_rt_plugins"} || [];
push @{$plugins}, $plugin;
$self->add_metadata("x_requires_rt_plugins", $plugins);
}
@@ -253,4 +258,4 @@ sub _load_rt_handle {
__END__
-#line 372
+#line 390
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
deleted file mode 100644
index b5e03c3..0000000
--- a/inc/Module/Install/ReadmeFromPod.pm
+++ /dev/null
@@ -1,138 +0,0 @@
-#line 1
-package Module::Install::ReadmeFromPod;
-
-use 5.006;
-use strict;
-use warnings;
-use base qw(Module::Install::Base);
-use vars qw($VERSION);
-
-$VERSION = '0.22';
-
-sub readme_from {
- my $self = shift;
- return unless $self->is_admin;
-
- # Input file
- my $in_file = shift || $self->_all_from
- or die "Can't determine file to make readme_from";
-
- # Get optional arguments
- my ($clean, $format, $out_file, $options);
- my $args = shift;
- if ( ref $args ) {
- # Arguments are in a hashref
- if ( ref($args) ne 'HASH' ) {
- die "Expected a hashref but got a ".ref($args)."\n";
- } else {
- $clean = $args->{'clean'};
- $format = $args->{'format'};
- $out_file = $args->{'output_file'};
- $options = $args->{'options'};
- }
- } else {
- # Arguments are in a list
- $clean = $args;
- $format = shift;
- $out_file = shift;
- $options = \@_;
- }
-
- # Default values;
- $clean ||= 0;
- $format ||= 'txt';
-
- # Generate README
- print "readme_from $in_file to $format\n";
- if ($format =~ m/te?xt/) {
- $out_file = $self->_readme_txt($in_file, $out_file, $options);
- } elsif ($format =~ m/html?/) {
- $out_file = $self->_readme_htm($in_file, $out_file, $options);
- } elsif ($format eq 'man') {
- $out_file = $self->_readme_man($in_file, $out_file, $options);
- } elsif ($format eq 'pdf') {
- $out_file = $self->_readme_pdf($in_file, $out_file, $options);
- }
-
- if ($clean) {
- $self->clean_files($out_file);
- }
-
- return 1;
-}
-
-
-sub _readme_txt {
- my ($self, $in_file, $out_file, $options) = @_;
- $out_file ||= 'README';
- require Pod::Text;
- my $parser = Pod::Text->new( @$options );
- open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
- $parser->output_fh( *$out_fh );
- $parser->parse_file( $in_file );
- close $out_fh;
- return $out_file;
-}
-
-
-sub _readme_htm {
- my ($self, $in_file, $out_file, $options) = @_;
- $out_file ||= 'README.htm';
- require Pod::Html;
- Pod::Html::pod2html(
- "--infile=$in_file",
- "--outfile=$out_file",
- @$options,
- );
- # Remove temporary files if needed
- for my $file ('pod2htmd.tmp', 'pod2htmi.tmp') {
- if (-e $file) {
- unlink $file or warn "Warning: Could not remove file '$file'.\n$!\n";
- }
- }
- return $out_file;
-}
-
-
-sub _readme_man {
- my ($self, $in_file, $out_file, $options) = @_;
- $out_file ||= 'README.1';
- require Pod::Man;
- my $parser = Pod::Man->new( @$options );
- $parser->parse_from_file($in_file, $out_file);
- return $out_file;
-}
-
-
-sub _readme_pdf {
- my ($self, $in_file, $out_file, $options) = @_;
- $out_file ||= 'README.pdf';
- eval { require App::pod2pdf; }
- or die "Could not generate $out_file because pod2pdf could not be found\n";
- my $parser = App::pod2pdf->new( @$options );
- $parser->parse_from_file($in_file);
- open my $out_fh, '>', $out_file or die "Could not write file $out_file:\n$!\n";
- select $out_fh;
- $parser->output;
- select STDOUT;
- close $out_fh;
- return $out_file;
-}
-
-
-sub _all_from {
- my $self = shift;
- return unless $self->admin->{extensions};
- my ($metadata) = grep {
- ref($_) eq 'Module::Install::Metadata';
- } @{$self->admin->{extensions}};
- return unless $metadata;
- return $metadata->{values}{all_from} || '';
-}
-
-'Readme!';
-
-__END__
-
-#line 254
-
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the rt-commit
mailing list