[Bps-public-commit] rt-extension-commentoncreate branch, master, updated. 0.02_01-3-g3e745cb

Kevin Falcone falcone at bestpractical.com
Thu Feb 6 18:23:30 EST 2014


The branch, master has been updated
       via  3e745cb7de48dc2a1f5dcee73aee23d6c0012c30 (commit)
       via  50a289010990a537cf9a4e16e226bd0f579ad665 (commit)
       via  162043e11d45da5bfa092319d0c687bad79aec5d (commit)
      from  f97950ce2df91f2917ca235f0e0798a7d816f08c (commit)

Summary of changes:
 .gitignore                          |   1 -
 Changes                             |  11 ++--
 META.yml                            |  24 +++++++++
 README                              |  50 ++++++++++++-----
 inc/Module/Install/RTx.pm           | 104 +++++++++++++++++-------------------
 inc/Module/Install/ReadmeFromPod.pm |   2 +-
 lib/RT/Extension/CommentOnCreate.pm |  64 ++++++++++++++--------
 7 files changed, 159 insertions(+), 97 deletions(-)
 create mode 100644 META.yml

- Log -----------------------------------------------------------------
commit 162043e11d45da5bfa092319d0c687bad79aec5d
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Feb 6 18:12:31 2014 -0500

    tidy and update changelog

diff --git a/Changes b/Changes
index 8878a23..a4b30d0 100644
--- a/Changes
+++ b/Changes
@@ -1,12 +1,15 @@
 Revision history for RT-Extension-CommentOnCreate
 
+0.03 2014-02-06
+  - release packaged for 4.2
+  - includes development release for ignoring articles.
+
 0.02_01
-       Don't include articles in comments (requires RT patch
-       for RT version <= 4.0.6)
+ - Don't include articles in comments (requires RT patch for RT version <= 4.0.6)
 
 0.02
-       Make width/height of the boxes configurable
+ - Make width/height of the boxes configurable
 
 0.01
-       Initial release.
+ - Initial release.
 

commit 50a289010990a537cf9a4e16e226bd0f579ad665
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Feb 6 18:12:43 2014 -0500

    modernize README

diff --git a/README b/README
index c6e086e..d184c33 100644
--- a/README
+++ b/README
@@ -3,22 +3,36 @@ NAME
     Creation
 
 INSTALLATION
-        How to install:
+    "perl Makefile.PL"
+    "make"
+    "make install"
+        May need root permissions
+
+    "patch rt (see patches directory)"
+        if you're running a version less than 3.8.8
 
-        1. perl Makefile.PL
-        2. make
-        3. make install (may need root permissions)
-        4. patch rt (see patches directory)
-           * if you're running a version less than 3.8.8
             patch -p1 < 3.8.7-after_message_box_callback.diff
-           * if you're running a version less than 4.0.7
+
+        you're running a version less than 4.0.7
+
             patch -p1 < 4.0.6-include_article_flag.diff
-        5. Edit your /opt/rt4/etc/RT_SiteConfig.pm
-            Set(@Plugins, (qw(RT::Extension::CommentOnCreate)));
-            or add RT::Extension::CommentOnCreate to your existing @Plugins line
-        6. Clear your mason cache
-             rm -rf /opt/rt4/var/mason_data/obj
-        7. Restart your webserver
+
+    Edit your /opt/rt4/etc/RT_SiteConfig.pm
+        If you are using RT 4.2 or greater, add this line:
+
+            Plugin('RT::Extension::CommentOnCreate');
+
+        For earlier releases of RT 4, add this line:
+
+            Set(@Plugins, qw(RT::Extension::CommentOnCreate));
+
+        or add "RT::Extension::CommentOnCreate" to your existing @Plugins
+        line.
+
+    Clear your mason cache
+            rm -rf /opt/rt4/var/mason_data/obj
+
+    Restart your webserver
 
 CONFIGURATION
     Optional configuration options to control the width and height of the
@@ -41,7 +55,8 @@ AUTHOR
     Kevin Falcone "<falcone at bestpractical.com>"
 
 LICENCE AND COPYRIGHT
-    Copyright (c) 2010, Best Practical Solutions, LLC. All rights reserved.
+    Copyright (c) 2010-2014, Best Practical Solutions, LLC. All rights
+    reserved.
 
     This module is free software; you can redistribute it and/or modify it
     under the terms of version 2 of the GNU General Public License.
@@ -68,3 +83,10 @@ DISCLAIMER OF WARRANTY
     SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
     DAMAGES.
 
+POD ERRORS
+    Hey! The above document had some coding errors, which are explained
+    below:
+
+    Around line 26:
+        Unterminated C<...> sequence
+
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 73b9cda..b2c1e0c 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -8,13 +8,13 @@ no warnings 'once';
 
 use Module::Install::Base;
 use base 'Module::Install::Base';
-our $VERSION = '0.29';
+our $VERSION = '0.32_01';
 
 use FindBin;
 use File::Glob     ();
 use File::Basename ();
 
-my @DIRS = qw(etc lib html bin sbin po var);
+my @DIRS = qw(etc lib html static bin sbin po var);
 my @INDEX_DIRS = qw(lib bin sbin);
 
 sub RTx {
@@ -62,10 +62,11 @@ sub RTx {
     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::LocalLibPath  ||= "$RT::LocalPath/lib";
+    $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 }
@@ -129,23 +130,13 @@ install ::
 
     my %has_etc;
     if ( File::Glob::bsd_glob("$FindBin::Bin/etc/schema.*") ) {
-
-        # got schema, load factory module
         $has_etc{schema}++;
-        $self->load('RTxFactory');
-        $self->postamble(<< ".");
-factory ::
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxFactory(qw($RTx $name))"
-
-dropdb ::
-\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxFactory(qw($RTx $name drop))"
-
-.
     }
     if ( File::Glob::bsd_glob("$FindBin::Bin/etc/acl.*") ) {
         $has_etc{acl}++;
     }
     if ( -e 'etc/initialdata' ) { $has_etc{initialdata}++; }
+    if ( -d 'etc/upgrade/' )    { $has_etc{upgrade}++; }
 
     $self->postamble("$postamble\n");
     unless ( $subdirs{'lib'} ) {
@@ -164,68 +155,69 @@ dropdb ::
         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))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(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))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(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))"
+\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Minc::Module::Install -e"RTxInitDB(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|;
+            $self->postamble("upgrade-database ::\n$upgradedb\n");
+            $self->postamble("upgradedb ::\n$upgradedb\n");
+        }
     }
 }
 
-sub RTxInit {
-    unshift @INC, substr( delete( $INC{'RT.pm'} ), 0, -5 ) if $INC{'RT.pm'};
-    require RT;
-    RT::LoadConfig();
-    RT::ConnectToDatabase();
-
-    die "Cannot load RT" unless $RT::Handle and $RT::DatabaseType;
-}
-
-# 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) = @_;
 
     # 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;
+    _load_rt_handle();
+    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 "\nWarning: prerequisite RT $version not found. Your installed version of RT ($RT::VERSION) is too old.\n\n";
+    }
+}
+
+sub rt_too_new {
+    my ($self,$version,$msg) = @_;
+    $msg ||= "Your version %s is too new, this extension requires a release of RT older than %s";
+
+    _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 348
+#line 360
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
index fb7075f..b5e03c3 100644
--- a/inc/Module/Install/ReadmeFromPod.pm
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -7,7 +7,7 @@ use warnings;
 use base qw(Module::Install::Base);
 use vars qw($VERSION);
 
-$VERSION = '0.18';
+$VERSION = '0.22';
 
 sub readme_from {
   my $self = shift;
diff --git a/lib/RT/Extension/CommentOnCreate.pm b/lib/RT/Extension/CommentOnCreate.pm
index 9902c49..6450040 100644
--- a/lib/RT/Extension/CommentOnCreate.pm
+++ b/lib/RT/Extension/CommentOnCreate.pm
@@ -11,24 +11,47 @@ use Carp;
 
 RT::Extension::CommentOnCreate - Adds an optional Comment box to Ticket Creation
 
-=head1 INSTALLATION
-
-    How to install:
-
-    1. perl Makefile.PL
-    2. make
-    3. make install (may need root permissions)
-    4. patch rt (see patches directory)
-       * if you're running a version less than 3.8.8
-        patch -p1 < 3.8.7-after_message_box_callback.diff
-       * if you're running a version less than 4.0.7
-        patch -p1 < 4.0.6-include_article_flag.diff
-    5. Edit your /opt/rt4/etc/RT_SiteConfig.pm
-        Set(@Plugins, (qw(RT::Extension::CommentOnCreate)));
-        or add RT::Extension::CommentOnCreate to your existing @Plugins line
-    6. Clear your mason cache
-         rm -rf /opt/rt4/var/mason_data/obj
-    7. Restart your webserver
+=head1 INSTALLATION 
+
+=over
+
+=item C<perl Makefile.PL>
+
+=item C<make>
+
+=item C<make install>
+
+May need root permissions
+
+=item C<patch rt (see patches directory)
+
+if you're running a version less than 3.8.8
+
+    patch -p1 < 3.8.7-after_message_box_callback.diff
+
+you're running a version less than 4.0.7
+
+    patch -p1 < 4.0.6-include_article_flag.diff
+
+=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::CommentOnCreate');
+
+For earlier releases of RT 4, add this line:
+
+    Set(@Plugins, qw(RT::Extension::CommentOnCreate));
+
+or add C<RT::Extension::CommentOnCreate> to your existing C<@Plugins> line.
+
+=item Clear your mason cache
+
+    rm -rf /opt/rt4/var/mason_data/obj
+
+=item Restart your webserver
+
+=back
 
 =head1 CONFIGURATION
 
@@ -48,7 +71,6 @@ Please report any bugs or feature requests to
 C<bug-rt-extension-commentoncreate at rt.cpan.org>, or through the web interface at
 L<http://rt.cpan.org>.
 
-
 =head1 AUTHOR
 
 Kevin Falcone  C<< <falcone at bestpractical.com> >>
@@ -56,7 +78,7 @@ Kevin Falcone  C<< <falcone at bestpractical.com> >>
 
 =head1 LICENCE AND COPYRIGHT
 
-Copyright (c) 2010, Best Practical Solutions, LLC.  All rights reserved.
+Copyright (c) 2010-2014, Best Practical Solutions, LLC.  All rights reserved.
 
 This module is free software; you can redistribute it and/or
 modify it under the terms of version 2 of the GNU General Public License.

commit 3e745cb7de48dc2a1f5dcee73aee23d6c0012c30
Author: Kevin Falcone <falcone at bestpractical.com>
Date:   Thu Feb 6 18:21:09 2014 -0500

    Bump for 0.05
    
    Jump over 3 because there was a 0.03_01 tag before 0.02_01 shipped and I
    just want a clear 'larger' release number.

diff --git a/.gitignore b/.gitignore
index a10c060..75e5cfc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,5 +10,4 @@ pm_to_blib*
 cover_db
 pod2htm*.tmp
 RT-Extension-SquelchWatchers-*
-META.yml
 /MYMETA*
diff --git a/Changes b/Changes
index a4b30d0..695e117 100644
--- a/Changes
+++ b/Changes
@@ -1,6 +1,6 @@
 Revision history for RT-Extension-CommentOnCreate
 
-0.03 2014-02-06
+0.05 2014-02-06
   - release packaged for 4.2
   - includes development release for ignoring articles.
 
diff --git a/META.yml b/META.yml
new file mode 100644
index 0000000..97ab003
--- /dev/null
+++ b/META.yml
@@ -0,0 +1,24 @@
+---
+abstract: 'Adds an optional Comment box to Ticket Creation'
+author:
+  - 'Kevin Falcone  C<< <falcone at bestpractical.com> >>'
+  - 'Kevin Falcone <falcone at bestpractical.com>'
+build_requires:
+  ExtUtils::MakeMaker: 6.36
+configure_requires:
+  ExtUtils::MakeMaker: 6.36
+distribution_type: module
+dynamic_config: 1
+generated_by: 'Module::Install version 1.06'
+license: gplv2
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
+name: RT-Extension-CommentOnCreate
+no_index:
+  directory:
+    - html
+    - inc
+resources:
+  license: http://opensource.org/licenses/gpl-license.php
+version: 0.05
diff --git a/lib/RT/Extension/CommentOnCreate.pm b/lib/RT/Extension/CommentOnCreate.pm
index 6450040..896e326 100644
--- a/lib/RT/Extension/CommentOnCreate.pm
+++ b/lib/RT/Extension/CommentOnCreate.pm
@@ -1,6 +1,6 @@
 package RT::Extension::CommentOnCreate;
 
-our $VERSION = '0.02_01';
+our $VERSION = '0.05';
 
 use warnings;
 use strict;

-----------------------------------------------------------------------



More information about the Bps-public-commit mailing list