[Bps-public-commit] rt-extension-repeatticket branch, master, updated. 1.00
Alex Vandiver
alexmv at bestpractical.com
Tue Dec 16 18:57:31 EST 2014
The branch, master has been updated
via 201e9a8dee6cb075cbc8f1e478251fb9054cdbc6 (commit)
from f3733df8eaff6598a68bf2fb523f0621bf8b15d7 (commit)
Summary of changes:
.gitignore | 11 +-
Changes | 37 +++---
MANIFEST | 4 +-
META.yml | 13 +-
Makefile.PL | 9 +-
README | 76 +++++++-----
inc/Module/AutoInstall.pm | 42 ++++---
inc/Module/Install.pm | 18 +--
inc/Module/Install/AutoInstall.pm | 2 +-
inc/Module/Install/Base.pm | 2 +-
inc/Module/Install/Can.pm | 2 +-
inc/Module/Install/Fetch.pm | 2 +-
inc/Module/Install/Include.pm | 2 +-
inc/Module/Install/Makefile.pm | 4 +-
inc/Module/Install/Metadata.pm | 6 +-
inc/Module/Install/RTx.pm | 252 ++++++++++++++++++++++----------------
inc/Module/Install/RTx/Factory.pm | 53 --------
inc/Module/Install/Win32.pm | 2 +-
inc/Module/Install/WriteAll.pm | 2 +-
lib/RT/Extension/RepeatTicket.pm | 92 +++++++++-----
20 files changed, 342 insertions(+), 289 deletions(-)
delete mode 100644 inc/Module/Install/RTx/Factory.pm
- Log -----------------------------------------------------------------
commit 201e9a8dee6cb075cbc8f1e478251fb9054cdbc6
Author: Alex Vandiver <alexmv at bestpractical.com>
Date: Tue Dec 16 18:56:21 2014 -0500
Version 1.00 releng
diff --git a/.gitignore b/.gitignore
index f9c6a8b..833bed5 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,15 +1,16 @@
blib*
Makefile
Makefile.old
-Build
-Build.bat
-_build*
pm_to_blib*
*.tar.gz
.lwpcookies
cover_db
pod2htm*.tmp
-RT-Extension-RepeatTicket-*
+/RT-Extension-RepeatTicket*
+*.bak
+*.swp
+/MYMETA.*
+/t/tmp
+/xt/tmp
/bin/rt-repeat-ticket
/lib/RT/Extension/RepeatTicket/Test.pm
-/MYMETA.*
\ No newline at end of file
diff --git a/Changes b/Changes
index d7e4e12..8c4a8d7 100644
--- a/Changes
+++ b/Changes
@@ -1,21 +1,28 @@
Revision history for RT-Extension-RepeatTicket
-0.07 2014-02-13
- * Styling on RT 4.2
- * Use <label>s to make radio button selection easier
- * Fix translation strings to use phrases, not words
+1.00 2014-12-16
+ - Add a missing WebPath to Original Ticket link
+ - Improve display on RT 4.2
+ - Support a lead time of 0 days
+ - Packaging and documentation updates
-0.06 2013-12-11
- * Fix copying of RefersTo links on repeated tickets
+0.07 2014-02-13
+ - Styling on RT 4.2
+ - Use <label>s to make radio button selection easier
+ - Fix translation strings to use phrases, not words
-0.05 2013-10-10
- * Updates for RT 4.2
+0.06 2013-12-11
+ - Fix copying of RefersTo links on repeated tickets
-0.04 2013-07-01
- * Fixed bug with CFs on repeated tickets
- * Added subject format config option
- * Move tests to xt
- * Add note on supported versions of RT
+0.05 2013-10-10
+ - Updates for RT 4.2
+
+0.04 2013-07-01
+ - Fixed bug with CFs on repeated tickets
+ - Added subject format config option
+ - Move tests to xt
+ - Add note on supported versions of RT
+
+0.03 2013-03-28
+ - First version, released on an unsuspecting world.
-0.03 2013-03-28
- * First version, released on an unsuspecting world.
diff --git a/MANIFEST b/MANIFEST
index 3e1e51d..ca6f6d6 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -17,10 +17,12 @@ inc/Module/Install/Makefile.pm
inc/Module/Install/Metadata.pm
inc/Module/Install/ReadmeFromPod.pm
inc/Module/Install/RTx.pm
-inc/Module/Install/RTx/Factory.pm
+inc/Module/Install/RTx/Runtime.pm
inc/Module/Install/Substitute.pm
inc/Module/Install/Win32.pm
inc/Module/Install/WriteAll.pm
+inc/unicore/Name.pm
+inc/YAML/Tiny.pm
lib/RT/Extension/RepeatTicket.pm
lib/RT/Extension/RepeatTicket/Test.pm.in
Makefile.PL
diff --git a/META.yml b/META.yml
index 2e8a09c..516147c 100644
--- a/META.yml
+++ b/META.yml
@@ -1,14 +1,14 @@
---
abstract: 'Repeat tickets based on schedule'
author:
- - 'sunnavy, <sunnavy at bestpractical.com>'
+ - 'Best Practical Solutions, LLC <modules at bestpractical.com>'
build_requires:
- ExtUtils::MakeMaker: 6.36
+ ExtUtils::MakeMaker: 6.59
configure_requires:
- ExtUtils::MakeMaker: 6.36
+ ExtUtils::MakeMaker: 6.59
distribution_type: module
dynamic_config: 1
-generated_by: 'Module::Install version 1.06'
+generated_by: 'Module::Install version 1.12'
license: gpl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -24,6 +24,9 @@ no_index:
- xt
requires:
DateTime::Event::ICal: 0
+ perl: 5.8.3
resources:
license: http://opensource.org/licenses/gpl-license.php
-version: 0.07
+version: '1.00'
+x_module_install_rtx_version: '0.36'
+x_requires_rt: 4.0.6
diff --git a/Makefile.PL b/Makefile.PL
index 3a74070..ccf3d68 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,8 +1,8 @@
use inc::Module::Install;
RTx('RT-Extension-RepeatTicket');
-all_from('lib/RT/Extension/RepeatTicket.pm');
-readme_from('lib/RT/Extension/RepeatTicket.pm');
+
requires('DateTime::Event::ICal');
+
requires_rt('4.0.6');
my ($lp) = ($INC{'RT.pm'} =~ /^(.*)[\\\/]/);
@@ -30,5 +30,6 @@ substitute(
qw(lib/RT/Extension/RepeatTicket/Test.pm),
);
-&auto_install();
-&WriteAll;
+auto_install();
+sign();
+WriteAll();
diff --git a/README b/README
index 41c4907..83b2c39 100644
--- a/README
+++ b/README
@@ -1,28 +1,6 @@
NAME
RT::Extension::RepeatTicket - Repeat tickets based on schedule
-INSTALLATION
- To install this module, run the following commands:
-
- perl Makefile.PL
- make
- make install # May need sudo/root
- make initdb # May need sudo/root
-
- add RT::Extension::RepeatTicket to @Plugins in RT's
- etc/RT_SiteConfig.pm:
-
- Set( @Plugins, qw(... RT::Extension::RepeatTicket) );
- Set( $RepeatTicketCoexistentNumber, 1 ); # Optional
- Set( $RepeatTicketLeadTime, 14 ); # Optional
- Set( $RepeatTicketSubjectFormat, '__Subject__' );
-
- add bin/rt-repeat-ticket to the daily cron job.
-
- This extension is known to work on RT 4.0.6 and later. Makefile.PL will
- warn you if your RT is older than this. It relies on jQuery, so it won't
- work as-is on RT 3.8 or earlier.
-
DESCRIPTION
The RepeatTicket extension allows you to set up recurring tickets so new
tickets are automatically created based on a schedule. The new tickets
@@ -38,6 +16,39 @@ DESCRIPTION
tickets are needed, and when your daily cron job runs the
rt-repeat-ticket script.
+INSTALLATION
+ perl Makefile.PL
+ make
+ make install
+ May need root permissions
+
+ make initdb
+ Only run this the first time you install this module.
+
+ If you run this twice, you may end up with duplicate data in your
+ database.
+
+ If you are upgrading this module, check for upgrading instructions
+ in case changes need to be made to your database.
+
+ Edit your /opt/rt4/etc/RT_SiteConfig.pm
+ If you are using RT 4.2 or greater, add this line:
+
+ Plugin('RT::Extension::RepeatTicket');
+
+ For RT 4.0, add this line:
+
+ Set(@Plugins, qw(RT::Extension::RepeatTicket));
+
+ or add RT::Extension::RepeatTicket to your existing @Plugins line.
+
+ Clear your mason cache
+ rm -rf /opt/rt4/var/mason_data/obj
+
+ Add bin/rt-repeat-ticket to the daily cron job.
+ Restart your webserver
+
+CONFIGURATION
$RepeatTicketCoexistentNumber
The $RepeatTicketCoexistentNumber determines how many tickets can be in
an active status for a recurrence at any time. A value of 1 means one
@@ -149,7 +160,7 @@ FAQ
METHODS
Run( RT::Attribute $attr, DateTime $checkday )
Repeat the ticket if $checkday meets the repeat settings. It also tries
- to repeat more to meet config "RepeatTicketCoexistentNumber".
+ to repeat more to meet config RepeatTicketCoexistentNumber.
Return ids of new created tickets.
@@ -169,16 +180,21 @@ METHODS
Return ( RT::Attribute, UPDATE MESSAGE )
AUTHOR
- sunnavy, <sunnavy at bestpractical.com>
+ Best Practical Solutions, LLC <modules at bestpractical.com>
+
+BUGS
+ All bugs should be reported via email to
+
+ L<bug-RT-Extension-RepeatTicket at rt.cpan.org|mailto:bug-RT-Extension-RepeatTicket at rt.cpan.org>
+
+ or via the web at
- Jim Brandt, <jbrandt at bestpractical.com>
+ L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-RepeatTicket>.
LICENSE AND COPYRIGHT
- Copyright 2013 Best Practical Solutions, LLC.
+ This software is Copyright (c) 2014 by Best Practical Solutions
- This program is free software; you can redistribute it and/or modify it
- under the terms of either: the GNU General Public License as published
- by the Free Software Foundation; or the Artistic License.
+ This is free software, licensed under:
- See http://dev.perl.org/licenses/ for more information.
+ The GNU General Public License, Version 2, June 1991
diff --git a/inc/Module/AutoInstall.pm b/inc/Module/AutoInstall.pm
index aa7aa92..4aca606 100644
--- a/inc/Module/AutoInstall.pm
+++ b/inc/Module/AutoInstall.pm
@@ -8,7 +8,7 @@ use ExtUtils::MakeMaker ();
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.12';
}
# special map on pre-defined feature sets
@@ -115,7 +115,7 @@ sub import {
print "*** $class version " . $class->VERSION . "\n";
print "*** Checking for Perl dependencies...\n";
- my $cwd = Cwd::cwd();
+ my $cwd = Cwd::getcwd();
$Config = [];
@@ -166,7 +166,7 @@ sub import {
$modules = [ %{$modules} ] if UNIVERSAL::isa( $modules, 'HASH' );
unshift @$modules, -default => &{ shift(@$modules) }
- if ( ref( $modules->[0] ) eq 'CODE' ); # XXX: bugward combatability
+ if ( ref( $modules->[0] ) eq 'CODE' ); # XXX: bugward compatibility
while ( my ( $mod, $arg ) = splice( @$modules, 0, 2 ) ) {
if ( $mod =~ m/^-(\w+)$/ ) {
@@ -345,22 +345,26 @@ sub install {
my $i; # used below to strip leading '-' from config keys
my @config = ( map { s/^-// if ++$i; $_ } @{ +shift } );
- my ( @modules, @installed );
- while ( my ( $pkg, $ver ) = splice( @_, 0, 2 ) ) {
+ my ( @modules, @installed, @modules_to_upgrade );
+ while (my ($pkg, $ver) = splice(@_, 0, 2)) {
- # grep out those already installed
- if ( _version_cmp( _version_of($pkg), $ver ) >= 0 ) {
- push @installed, $pkg;
- }
- else {
- push @modules, $pkg, $ver;
- }
- }
+ # grep out those already installed
+ if (_version_cmp(_version_of($pkg), $ver) >= 0) {
+ push @installed, $pkg;
+ if ($UpgradeDeps) {
+ push @modules_to_upgrade, $pkg, $ver;
+ }
+ }
+ else {
+ push @modules, $pkg, $ver;
+ }
+ }
- if ($UpgradeDeps) {
- push @modules, @installed;
- @installed = ();
- }
+ if ($UpgradeDeps) {
+ push @modules, @modules_to_upgrade;
+ @installed = ();
+ @modules_to_upgrade = ();
+ }
return @installed unless @modules; # nothing to do
return @installed if _check_lock(); # defer to the CPAN shell
@@ -611,7 +615,7 @@ sub _under_cpan {
require Cwd;
require File::Spec;
- my $cwd = File::Spec->canonpath( Cwd::cwd() );
+ my $cwd = File::Spec->canonpath( Cwd::getcwd() );
my $cpan = File::Spec->canonpath( $CPAN::Config->{cpan_home} );
return ( index( $cwd, $cpan ) > -1 );
@@ -927,4 +931,4 @@ END_MAKE
__END__
-#line 1193
+#line 1197
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 4ecf46b..5460dd5 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -17,7 +17,7 @@ package Module::Install;
# 3. The ./inc/ version of Module::Install loads
# }
-use 5.005;
+use 5.006;
use strict 'vars';
use Cwd ();
use File::Find ();
@@ -31,7 +31,7 @@ BEGIN {
# This is not enforced yet, but will be some time in the next few
# releases once we can make sure it won't clash with custom
# Module::Install extensions.
- $VERSION = '1.06';
+ $VERSION = '1.12';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -156,10 +156,10 @@ END_DIE
sub autoload {
my $self = shift;
my $who = $self->_caller;
- my $cwd = Cwd::cwd();
+ my $cwd = Cwd::getcwd();
my $sym = "${who}::AUTOLOAD";
$sym->{$cwd} = sub {
- my $pwd = Cwd::cwd();
+ my $pwd = Cwd::getcwd();
if ( my $code = $sym->{$pwd} ) {
# Delegate back to parent dirs
goto &$code unless $cwd eq $pwd;
@@ -239,7 +239,7 @@ sub new {
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
- unless ( Cwd::abs_path(Cwd::cwd()) eq $base_path ) {
+ unless ( Cwd::abs_path(Cwd::getcwd()) eq $base_path ) {
delete $args{prefix};
}
return $args{_self} if $args{_self};
@@ -338,7 +338,7 @@ sub find_extensions {
if ( $subpath eq lc($subpath) || $subpath eq uc($subpath) ) {
my $content = Module::Install::_read($subpath . '.pm');
my $in_pod = 0;
- foreach ( split //, $content ) {
+ foreach ( split /\n/, $content ) {
$in_pod = 1 if /^=\w/;
$in_pod = 0 if /^=cut/;
next if ($in_pod || /^=cut/); # skip pod text
@@ -434,7 +434,7 @@ END_OLD
# _version is for processing module versions (eg, 1.03_05) not
# Perl versions (eg, 5.8.1).
-sub _version ($) {
+sub _version {
my $s = shift || 0;
my $d =()= $s =~ /(\.)/g;
if ( $d >= 2 ) {
@@ -450,12 +450,12 @@ sub _version ($) {
return $l + 0;
}
-sub _cmp ($$) {
+sub _cmp {
_version($_[1]) <=> _version($_[2]);
}
# Cloned from Params::Util::_CLASS
-sub _CLASS ($) {
+sub _CLASS {
(
defined $_[0]
and
diff --git a/inc/Module/Install/AutoInstall.pm b/inc/Module/Install/AutoInstall.pm
index 6efe4fe..ab1e5fa 100644
--- a/inc/Module/Install/AutoInstall.pm
+++ b/inc/Module/Install/AutoInstall.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.12';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index 802844a..f9bf5de 100644
--- a/inc/Module/Install/Base.pm
+++ b/inc/Module/Install/Base.pm
@@ -4,7 +4,7 @@ package Module::Install::Base;
use strict 'vars';
use vars qw{$VERSION};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.12';
}
# Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 22167b8..b4e5e3b 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -8,7 +8,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.12';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index bee0c4f..54f14fb 100644
--- a/inc/Module/Install/Fetch.pm
+++ b/inc/Module/Install/Fetch.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.12';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index 8310e4c..7224cff 100644
--- a/inc/Module/Install/Include.pm
+++ b/inc/Module/Install/Include.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.12';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 7052f36..81cddd5 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -8,7 +8,7 @@ use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.12';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -133,7 +133,7 @@ sub makemaker_args {
return $args;
}
-# For mm args that take multiple space-seperated args,
+# For mm args that take multiple space-separated args,
# append an argument to the current list.
sub makemaker_append {
my $self = shift;
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index 58430f3..2c66b1e 100644
--- a/inc/Module/Install/Metadata.pm
+++ b/inc/Module/Install/Metadata.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.12';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -347,7 +347,7 @@ sub name_from {
^ \s*
package \s*
([\w:]+)
- \s* ;
+ [\s|;]*
/ixms
) {
my ($name, $module_name) = ($1, $1);
@@ -705,7 +705,7 @@ sub _write_mymeta_data {
my @yaml = Parse::CPAN::Meta::LoadFile('META.yml');
my $meta = $yaml[0];
- # Overwrite the non-configure dependency hashs
+ # Overwrite the non-configure dependency hashes
delete $meta->{requires};
delete $meta->{build_requires};
delete $meta->{recommends};
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index ac04c79..73e7245 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.32';
+our $VERSION = '0.36';
use FindBin;
use File::Glob ();
@@ -18,95 +18,79 @@ 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 ||= {};
- my $original_name = $name;
- my $RTx = 'RTx';
- $RTx = $1 if $name =~ s/^(\w+)-//;
+ # Set up names
my $fname = $name;
$fname =~ s!-!/!g;
- $self->name("$RTx-$name")
+ $self->name( $name )
unless $self->name;
- $self->all_from( -e "$name.pm" ? "$name.pm" : "lib/$RTx/$fname.pm" )
+ $self->all_from( "lib/$fname.pm" )
unless $self->version;
- $self->abstract("RT $name Extension")
+ $self->abstract("$name Extension")
unless $self->abstract;
-
- my @prefixes = (qw(/opt /usr/local /home /usr /sw ));
- my $prefix = $ENV{PREFIX};
- @ARGV = grep { /PREFIX=(.*)/ ? ( ( $prefix = $1 ), 0 ) : 1 } @ARGV;
-
- if ($prefix) {
- $RT::LocalPath = $prefix;
- $INC{'RT.pm'} = "$RT::LocalPath/lib/RT.pm";
- } else {
- local @INC = (
- $ENV{RTHOME} ? ( $ENV{RTHOME}, "$ENV{RTHOME}/lib" ) : (),
- @INC,
- map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/rt3/lib", "$_/lib/rt3", "$_/lib" )
- } grep $_, @prefixes
- );
- until ( eval { require RT; $RT::LocalPath } ) {
- warn
- "Cannot find the location of RT.pm that defines \$RT::LocalPath in: @INC\n";
- $_ = $self->prompt("Path to directory containing your RT.pm:") or exit;
- $_ =~ s/\/RT\.pm$//;
- push @INC, $_, "$_/rt3/lib", "$_/lib/rt3", "$_/lib";
- }
+ 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
+ my @prefixes = qw( /opt /usr/local /home /usr /sw /usr/share/request-tracker4);
+ $ENV{RTHOME} =~ s{/RT\.pm$}{} if defined $ENV{RTHOME};
+ $ENV{RTHOME} =~ s{/lib/?$}{} if defined $ENV{RTHOME};
+ my @try = $ENV{RTHOME} ? ($ENV{RTHOME}, "$ENV{RTHOME}/lib") : ();
+ while (1) {
+ my @look = @INC;
+ unshift @look, grep {defined and -d $_} @try;
+ push @look, grep {defined and -d $_}
+ map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/lib" ) } @prefixes;
+ last if eval {local @INC = @look; require RT; $RT::LocalLibPath};
+
+ warn
+ "Cannot find the location of RT.pm that defines \$RT::LocalPath in: @look\n";
+ my $given = $self->prompt("Path to directory containing your RT.pm:") or exit;
+ $given =~ s{/RT\.pm$}{};
+ $given =~ s{/lib/?$}{};
+ @try = ($given, "$given/lib");
}
- my $lib_path = File::Basename::dirname( $INC{'RT.pm'} );
- my $local_lib_path = "$RT::LocalPath/lib";
print "Using RT configuration from $INC{'RT.pm'}:\n";
- unshift @INC, "$RT::LocalPath/lib" if $RT::LocalPath;
- unshift @INC, $lib_path;
-
- $RT::LocalVarPath ||= $RT::VarPath;
- $RT::LocalPoPath ||= $RT::LocalLexiconPath;
- $RT::LocalHtmlPath ||= $RT::MasonComponentRoot;
- $RT::LocalStaticPath ||= $RT::StaticPath;
- $RT::LocalLibPath ||= "$RT::LocalPath/lib";
- my $with_subdirs = $ENV{WITH_SUBDIRS};
- @ARGV = grep { /WITH_SUBDIRS=(.*)/ ? ( ( $with_subdirs = $1 ), 0 ) : 1 }
- @ARGV;
+ my $local_lib_path = $RT::LocalLibPath;
+ unshift @INC, $local_lib_path;
+ my $lib_path = File::Basename::dirname( $INC{'RT.pm'} );
+ unshift @INC, $lib_path;
- my %subdirs;
- %subdirs = map { $_ => 1 } split( /\s*,\s*/, $with_subdirs )
- if defined $with_subdirs;
- unless ( keys %subdirs ) {
- $subdirs{$_} = 1 foreach grep -d "$FindBin::Bin/$_", @DIRS;
+ # Set a baseline minimum version
+ unless ( $extra_args->{deprecated_rt} ) {
+ $self->requires_rt('4.0.0');
}
- # If we're running on RT 3.8 with plugin support, we really wany
- # to install libs, mason templates and po files into plugin specific
- # directories
+ # Installation locations
my %path;
- if ( $RT::LocalPluginPath ) {
- die "Because of bugs in RT 3.8.0 this extension can not be installed.\n"
- ."Upgrade to RT 3.8.1 or newer.\n" if $RT::VERSION =~ /^3\.8\.0/;
- $path{$_} = $RT::LocalPluginPath . "/$original_name/$_"
- foreach @DIRS;
- } else {
- foreach ( @DIRS ) {
- no strict 'refs';
- my $varname = "RT::Local" . ucfirst($_) . "Path";
- $path{$_} = ${$varname} || "$RT::LocalPath/$_";
- }
+ $path{$_} = $RT::LocalPluginPath . "/$name/$_"
+ foreach @DIRS;
- $path{$_} .= "/$name" for grep $path{$_}, qw(etc po var);
- }
+ # Copy RT 4.2.0 static files into NoAuth; insufficient for
+ # images, but good enough for css and js.
+ $path{static} = "$path{html}/NoAuth/"
+ unless $RT::StaticPath;
+
+ # Delete the ones we don't need
+ delete $path{$_} for grep {not -d "$FindBin::Bin/$_"} keys %path;
my %index = map { $_ => 1 } @INDEX_DIRS;
$self->no_index( directory => $_ ) foreach grep !$index{$_}, @DIRS;
my $args = join ', ', map "q($_)", map { ($_, $path{$_}) }
- grep $subdirs{$_}, keys %path;
+ sort keys %path;
- print "./$_\t=> $path{$_}\n" for sort keys %subdirs;
+ printf "%-10s => %s\n", $_, $path{$_} for sort keys %path;
- if ( my @dirs = map { ( -D => $_ ) } grep $subdirs{$_}, qw(bin html sbin) ) {
+ if ( my @dirs = map { ( -D => $_ ) } grep $path{$_}, qw(bin html sbin etc) ) {
my @po = map { ( -o => $_ ) }
grep -f,
File::Glob::bsd_glob("po/*.po");
@@ -116,12 +100,15 @@ lexicons ::
.
}
+ $self->include('Module::Install::RTx::Runtime') if $self->admin;
+ $self->include_deps( 'YAML::Tiny', 0 ) if $self->admin;
my $postamble = << ".";
install ::
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxPlugin()"
\t\$(NOECHO) \$(PERL) -MExtUtils::Install -e \"install({$args})\"
.
- if ( $subdirs{var} and -d $RT::MasonDataDir ) {
+ if ( $path{var} and -d $RT::MasonDataDir ) {
my ( $uid, $gid ) = ( stat($RT::MasonDataDir) )[ 4, 5 ];
$postamble .= << ".";
\t\$(NOECHO) chown -R $uid:$gid $path{var}
@@ -136,14 +123,16 @@ install ::
$has_etc{acl}++;
}
if ( -e 'etc/initialdata' ) { $has_etc{initialdata}++; }
- if ( -d 'etc/upgrade/' ) { $has_etc{upgrade}++; }
+ if ( grep { /\d+\.\d+(\.\d+)?.*$/ } glob('etc/upgrade/*.*') ) {
+ $has_etc{upgrade}++;
+ }
$self->postamble("$postamble\n");
- unless ( $subdirs{'lib'} ) {
- $self->makemaker_args( PM => { "" => "" }, );
- } else {
+ if ( $path{lib} ) {
$self->makemaker_args( INSTALLSITELIB => $path{'lib'} );
$self->makemaker_args( INSTALLARCHLIB => $path{'lib'} );
+ } else {
+ $self->makemaker_args( PM => { "" => "" }, );
}
$self->makemaker_args( INSTALLSITEMAN1DIR => "$RT::LocalPath/man/man1" );
@@ -151,69 +140,122 @@ install ::
$self->makemaker_args( INSTALLSITEARCH => "$RT::LocalPath/man" );
if (%has_etc) {
- $self->load('RTxInitDB');
print "For first-time installation, type 'make initdb'.\n";
my $initdb = '';
$initdb .= <<"." if $has_etc{schema};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(schema \$(NAME) \$(VERSION)))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxDatabase(qw(schema \$(NAME) \$(VERSION)))"
.
$initdb .= <<"." if $has_etc{acl};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(acl \$(NAME) \$(VERSION)))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxDatabase(qw(acl \$(NAME) \$(VERSION)))"
.
$initdb .= <<"." if $has_etc{initialdata};
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(insert \$(NAME) \$(VERSION)))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxDatabase(qw(insert \$(NAME) \$(VERSION)))"
.
$self->postamble("initdb ::\n$initdb\n");
$self->postamble("initialize-database ::\n$initdb\n");
if ($has_etc{upgrade}) {
print "To upgrade from a previous version of this extension, use 'make upgrade-database'\n";
- my $upgradedb = qq|\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(qw(upgrade \$(NAME) \$(VERSION)))"\n|;
+ my $upgradedb = qq|\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxDatabase(qw(upgrade \$(NAME) \$(VERSION)))"\n|;
$self->postamble("upgrade-database ::\n$upgradedb\n");
$self->postamble("upgradedb ::\n$upgradedb\n");
}
}
+
}
-# stolen from RT::Handle so we work on 3.6 (cmp_versions came in with 3.8)
-{ my %word = (
- a => -4,
- alpha => -4,
- b => -3,
- beta => -3,
- pre => -2,
- rc => -1,
- head => 9999,
-);
-sub cmp_version($$) {
- my ($a, $b) = (@_);
- my @a = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef }
- split /([^0-9]+)/, $a;
- my @b = grep defined, map { /^[0-9]+$/? $_ : /^[a-zA-Z]+$/? $word{$_}|| -10 : undef }
- split /([^0-9]+)/, $b;
- @a > @b
- ? push @b, (0) x (@a- at b)
- : push @a, (0) x (@b- at a);
- for ( my $i = 0; $i < @a; $i++ ) {
- return $a[$i] <=> $b[$i] if $a[$i] <=> $b[$i];
- }
- return 0;
-}}
sub requires_rt {
my ($self,$version) = @_;
+ _load_rt_handle();
+
+ if ($self->is_admin) {
+ $self->add_metadata("x_requires_rt", $version);
+ my @sorted = sort RT::Handle::cmp_version $version,'4.0.0';
+ $self->perl_version('5.008003') if $sorted[0] eq '4.0.0'
+ and (not $self->perl_version or '5.008003' > $self->perl_version);
+ @sorted = sort RT::Handle::cmp_version $version,'4.2.0';
+ $self->perl_version('5.010001') if $sorted[0] eq '4.2.0'
+ and (not $self->perl_version or '5.010001' > $self->perl_version);
+ }
+
# if we're exactly the same version as what we want, silently return
return if ($version eq $RT::VERSION);
- my @sorted = sort cmp_version $version,$RT::VERSION;
+ my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
if ($sorted[-1] eq $version) {
- # should we die?
- warn "\nWarning: prerequisite RT $version not found. Your installed version of RT ($RT::VERSION) is too old.\n\n";
+ die <<"EOT";
+
+**** Error: This extension requires RT $version. Your installed version
+ of RT ($RT::VERSION) is too old.
+
+EOT
+ }
+}
+
+sub requires_rt_plugin {
+ my $self = shift;
+ my ( $plugin ) = @_;
+
+ if ($self->is_admin) {
+ my $plugins = $self->Meta->{values}{"x_requires_rt_plugins"} || [];
+ push @{$plugins}, $plugin;
+ $self->add_metadata("x_requires_rt_plugins", $plugins);
+ }
+
+ my $path = $plugin;
+ $path =~ s{\:\:}{-}g;
+ $path = "$RT::LocalPluginPath/$path/lib";
+ if ( -e $path ) {
+ unshift @INC, $path;
+ } else {
+ my $name = $self->name;
+ warn <<"EOT";
+
+**** Warning: $name requires that the $plugin plugin be installed and
+ enabled; it does not appear to be installed.
+
+EOT
+ }
+ $self->requires(@_);
+}
+
+sub rt_too_new {
+ my ($self,$version,$msg) = @_;
+ my $name = $self->name;
+ $msg ||= <<EOT;
+
+**** Error: Your installed version of RT (%s) is too new; this extension
+ only works with versions older than %s.
+
+EOT
+ $self->add_metadata("x_rt_too_new", $version) if $self->is_admin;
+
+ _load_rt_handle();
+ my @sorted = sort RT::Handle::cmp_version $version,$RT::VERSION;
+
+ if ($sorted[0] eq $version) {
+ die sprintf($msg,$RT::VERSION,$version);
+ }
+}
+
+# RT::Handle runs FinalizeDatabaseType which calls RT->Config->Get
+# On 3.8, this dies. On 4.0/4.2 ->Config transparently runs LoadConfig.
+# LoadConfig requires being able to read RT_SiteConfig.pm (root) so we'd
+# like to avoid pushing that on users.
+# Fake up just enough Config to let FinalizeDatabaseType finish, and
+# anyone later calling LoadConfig will overwrite our shenanigans.
+sub _load_rt_handle {
+ unless ($RT::Config) {
+ require RT::Config;
+ $RT::Config = RT::Config->new;
+ RT->Config->Set('DatabaseType','mysql');
}
+ require RT::Handle;
}
1;
__END__
-#line 336
+#line 390
diff --git a/inc/Module/Install/RTx/Factory.pm b/inc/Module/Install/RTx/Factory.pm
deleted file mode 100644
index 6776688..0000000
--- a/inc/Module/Install/RTx/Factory.pm
+++ /dev/null
@@ -1,53 +0,0 @@
-#line 1
-package Module::Install::RTx::Factory;
-use Module::Install::Base; @ISA = qw(Module::Install::Base);
-
-use strict;
-use File::Basename ();
-
-sub RTxInitDB {
- my ($self, $action, $name, $version) = @_;
-
- unshift @INC, substr(delete($INC{'RT.pm'}), 0, -5) if $INC{'RT.pm'};
-
- require RT;
- unshift @INC, "$RT::LocalPath/lib" if $RT::LocalPath;
-
- $RT::SbinPath ||= $RT::LocalPath;
- $RT::SbinPath =~ s/local$/sbin/;
-
- foreach my $file ($RT::CORE_CONFIG_FILE, $RT::SITE_CONFIG_FILE) {
- next if !-e $file or -r $file;
- die "No permission to read $file\n-- please re-run $0 with suitable privileges.\n";
- }
-
- RT::LoadConfig();
-
- require RT::System;
-
- my $lib_path = File::Basename::dirname($INC{'RT.pm'});
- my @args = ("-Ilib");
- push @args, "-I$RT::LocalPath/lib" if $RT::LocalPath;
- push @args, (
- "-I$lib_path",
- "$RT::SbinPath/rt-setup-database",
- "--action" => $action,
- ($action eq 'upgrade' ? () : ("--datadir" => "etc")),
- (($action eq 'insert') ? ("--datafile" => "etc/initialdata") : ()),
- "--dba" => $RT::DatabaseAdmin || $RT::DatabaseUser,
- "--prompt-for-dba-password" => '',
- (RT::System->can('AddUpgradeHistory') ? ("--package" => $name, "--ext-version" => $version) : ()),
- );
- # If we're upgrading against an RT which isn't at least 4.2 (has
- # AddUpgradeHistory) then pass --package. Upgrades against later RT
- # releases will pick up --package from AddUpgradeHistory.
- if ($action eq 'upgrade' and
- not RT::System->can('AddUpgradeHistory')) {
- push @args, "--package" => $name;
- }
-
- print "$^X @args\n";
- (system($^X, @args) == 0) or die "...returned with error: $?\n";
-}
-
-1;
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index eeaa3fe..e48c32d 100644
--- a/inc/Module/Install/Win32.pm
+++ b/inc/Module/Install/Win32.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.12';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index 85d8018..409ef40 100644
--- a/inc/Module/Install/WriteAll.pm
+++ b/inc/Module/Install/WriteAll.pm
@@ -6,7 +6,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.06';
+ $VERSION = '1.12';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
diff --git a/lib/RT/Extension/RepeatTicket.pm b/lib/RT/Extension/RepeatTicket.pm
index 99010c0..86ca748 100644
--- a/lib/RT/Extension/RepeatTicket.pm
+++ b/lib/RT/Extension/RepeatTicket.pm
@@ -3,7 +3,7 @@ use strict;
package RT::Extension::RepeatTicket;
-our $VERSION = "0.07";
+our $VERSION = "1.00";
use RT::Interface::Web;
use DateTime;
@@ -766,28 +766,6 @@ __END__
RT::Extension::RepeatTicket - Repeat tickets based on schedule
-=head1 INSTALLATION
-
-To install this module, run the following commands:
-
- perl Makefile.PL
- make
- make install # May need sudo/root
- make initdb # May need sudo/root
-
-add RT::Extension::RepeatTicket to @Plugins in RT's etc/RT_SiteConfig.pm:
-
- Set( @Plugins, qw(... RT::Extension::RepeatTicket) );
- Set( $RepeatTicketCoexistentNumber, 1 ); # Optional
- Set( $RepeatTicketLeadTime, 14 ); # Optional
- Set( $RepeatTicketSubjectFormat, '__Subject__' );
-
-add bin/rt-repeat-ticket to the daily cron job.
-
-This extension is known to work on RT 4.0.6 and later. Makefile.PL will
-warn you if your RT is older than this. It relies on jQuery, so it
-won't work as-is on RT 3.8 or earlier.
-
=head1 DESCRIPTION
The RepeatTicket extension allows you to set up recurring tickets so
@@ -804,6 +782,52 @@ New tickets are created when you initially save the recurrence, if new
tickets are needed, and when your daily cron job runs the rt-repeat-ticket
script.
+=head1 INSTALLATION
+
+=over
+
+=item C<perl Makefile.PL>
+
+=item C<make>
+
+=item C<make install>
+
+May need root permissions
+
+=item C<make initdb>
+
+Only run this the first time you install this module.
+
+If you run this twice, you may end up with duplicate data
+in your database.
+
+If you are upgrading this module, check for upgrading instructions
+in case changes need to be made to your database.
+
+=item Edit your F</opt/rt4/etc/RT_SiteConfig.pm>
+
+If you are using RT 4.2 or greater, add this line:
+
+ Plugin('RT::Extension::RepeatTicket');
+
+For RT 4.0, add this line:
+
+ Set(@Plugins, qw(RT::Extension::RepeatTicket));
+
+or add C<RT::Extension::RepeatTicket> to your existing C<@Plugins> line.
+
+=item Clear your mason cache
+
+ rm -rf /opt/rt4/var/mason_data/obj
+
+=item Add F<bin/rt-repeat-ticket> to the daily cron job.
+
+=item Restart your webserver
+
+=back
+
+=head1 CONFIGURATION
+
=head2 C<$RepeatTicketCoexistentNumber>
The C<$RepeatTicketCoexistentNumber>
@@ -973,18 +997,24 @@ Return ( RT::Attribute, UPDATE MESSAGE )
=head1 AUTHOR
-sunnavy, <sunnavy at bestpractical.com>
+Best Practical Solutions, LLC E<lt>modules at bestpractical.comE<gt>
-Jim Brandt, <jbrandt at bestpractical.com>
+=head1 BUGS
-=head1 LICENSE AND COPYRIGHT
+All bugs should be reported via email to
-Copyright 2013 Best Practical Solutions, LLC.
+ L<bug-RT-Extension-RepeatTicket at rt.cpan.org|mailto:bug-RT-Extension-RepeatTicket at rt.cpan.org>
+
+or via the web at
+
+ L<rt.cpan.org|http://rt.cpan.org/Public/Dist/Display.html?Name=RT-Extension-RepeatTicket>.
+
+=head1 LICENSE AND COPYRIGHT
-This program is free software; you can redistribute it and/or modify it
-under the terms of either: the GNU General Public License as published
-by the Free Software Foundation; or the Artistic License.
+This software is Copyright (c) 2014 by Best Practical Solutions
-See http://dev.perl.org/licenses/ for more information.
+This is free software, licensed under:
+ The GNU General Public License, Version 2, June 1991
+=cut
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list