[Bps-public-commit] RT-BugTracker branch, rt4, created. f8c71c4980f519573abfb4b4e919c27fb8974c7a
Thomas Sibley
trs at bestpractical.com
Thu Feb 28 18:35:39 EST 2013
The branch, rt4 has been created
at f8c71c4980f519573abfb4b4e919c27fb8974c7a (commit)
- Log -----------------------------------------------------------------
commit d394e04b0807c43ca4e2b6db14eaee7eca505423
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Jun 4 22:36:03 2012 +0800
Port menus to RT 4 framework
diff --git a/html/Callbacks/BugTracker/Elements/Tabs/Default b/html/Callbacks/BugTracker/Elements/Tabs/Privileged
similarity index 91%
rename from html/Callbacks/BugTracker/Elements/Tabs/Default
rename to html/Callbacks/BugTracker/Elements/Tabs/Privileged
index 2add599..a63deac 100644
--- a/html/Callbacks/BugTracker/Elements/Tabs/Default
+++ b/html/Callbacks/BugTracker/Elements/Tabs/Privileged
@@ -46,13 +46,5 @@
%#
%# END BPS TAGGED BLOCK }}}
<%INIT>
-my $Name = $session{'CurrentUser'}->UserObj->Name;
-
-$toptabs->{Ag} = {
- title => loc('Distributions'),
- path => 'Dist/ByMaintainer.html?Name=' . $Name,
-};
+ $m->comp('/Callbacks/BugTracker/Elements/Tabs/SelfService');
</%INIT>
-<%ARGS>
-$toptabs => undef
-</%ARGS>
diff --git a/html/Callbacks/BugTracker/Elements/Tabs/SelfService b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
new file mode 100644
index 0000000..8dc5f01
--- /dev/null
+++ b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
@@ -0,0 +1,132 @@
+%# BEGIN BPS TAGGED BLOCK {{{
+%#
+%# COPYRIGHT:
+%#
+%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
+%# <jesse at bestpractical.com>
+%#
+%# (Except where explicitly superseded by other copyright notices)
+%#
+%#
+%# LICENSE:
+%#
+%# This work is made available to you under the terms of Version 2 of
+%# the GNU General Public License. A copy of that license should have
+%# been provided with this software, but in any event can be snarfed
+%# from www.gnu.org.
+%#
+%# This work is distributed in the hope that it will be useful, but
+%# WITHOUT ANY WARRANTY; without even the implied warranty of
+%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+%# General Public License for more details.
+%#
+%# You should have received a copy of the GNU General Public License
+%# along with this program; if not, write to the Free Software
+%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+%# 02110-1301 or visit their web page on the internet at
+%# http://www.gnu.org/copyleft/gpl.html.
+%#
+%#
+%# CONTRIBUTION SUBMISSION POLICY:
+%#
+%# (The following paragraph is not intended to limit the rights granted
+%# to you to modify and distribute this software under the terms of
+%# the GNU General Public License and is only of importance to you if
+%# you choose to contribute your changes and enhancements to the
+%# community by submitting them to Best Practical Solutions, LLC.)
+%#
+%# By intentionally submitting any modifications, corrections or
+%# derivatives to this work, or any other work intended for use with
+%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
+%# you are the copyright holder for those contributions and you grant
+%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
+%# royalty-free, perpetual, license to use, copy, create derivative
+%# works based on those contributions, and sublicense and distribute
+%# those contributions and any derivatives thereof.
+%#
+%# END BPS TAGGED BLOCK }}}
+<%INIT>
+my $Name = $session{'CurrentUser'}->UserObj->Name;
+my $escaped_uname = $m->interp->apply_escapes(
+ $session{'CurrentUser'}->UserObj->Name, 'u'
+);
+
+my $tracker = Menu()->child(
+ bugtracker => title => loc('Distributions'),
+);
+
+$tracker->child(
+ by_maintainer => title => loc('My Distributions'),
+ path => '/Dist/ByMaintainer.html?Name=' . $escaped_uname,
+);
+
+$tracker->child(
+ search => title => loc('Search'),
+ path => '/Dist/Search.html',
+);
+
+$tracker->child(
+ browse => title => loc('Browse'),
+ path => '/Dist/Browse.html',
+);
+
+my $request_path = $HTML::Mason::Commands::r->path_info;
+$request_path =~ s!^/{2,}!/!;
+if ( $request_path =~ /^\/Dist/ ) {
+ my $Queue = $DECODED_ARGS->{'Queue'} || $DECODED_ARGS->{'Name'};
+ my $queue_obj;
+ if ($Queue) {
+ my $tmp = RT::Queue->new( $session{'CurrentUser'} );
+ $tmp->Load($Queue);
+ unless ( $tmp->id ) {
+ $RT::Logger->warning("Couldn't load queue '$Queue'");
+ }
+ else {
+ $queue_obj = $tmp;
+ $Queue = $queue_obj->Name;
+ }
+ }
+
+ my $escaped_queue = $m->interp->apply_escapes( $Queue, 'u' );
+
+ if ($queue_obj) {
+ $tracker->child(
+ queue_display => title => $Queue,
+ path => '/Dist/Display.html?Queue=' . $escaped_queue,
+ );
+ PageMenu()->child(
+ active => title => loc("Active bugs"),
+ path => "/Dist/Display.html?Status=Active&Queue=" . $escaped_queue,
+ );
+
+ PageMenu()->child(
+ resolved => title => loc("Resolved bugs"),
+ path => "/Dist/Display.html?Status=Resolved&Queue="
+ . $escaped_queue,
+ );
+
+ PageMenu()->child(
+ rejected => title => loc("Rejected bugs"),
+ path => "/Dist/Display.html?Status=Rejected&Queue="
+ . $escaped_queue,
+ );
+
+ if ( !$queue_obj->Disabled ) {
+ PageMenu()->child(
+ report => title => loc("Report a new bug"),
+ path => '/Ticket/Create.html?Queue=' . $escaped_queue,
+ );
+ }
+
+ if ( $queue_obj->IsAdminCc( $session{'CurrentUser'}->id )
+ || $queue_obj->CurrentUserHasRight('AdminQueue') )
+ {
+ PageMenu()->child(
+ manage => title => loc("Manage"),
+ path => '/Dist/Manage.html?Queue=' . $escaped_queue,
+ );
+ }
+ }
+
+}
+</%INIT>
diff --git a/html/Dist/Browse.html b/html/Dist/Browse.html
index cbf9e20..4344613 100755
--- a/html/Dist/Browse.html
+++ b/html/Dist/Browse.html
@@ -46,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Elements/Header, Title => $title &>
-<& /Dist/Elements/Tabs,
- Title => $title,
- current_tab => 'Dist/Browse.html',
-&>
+<& /Elements/Tabs &>
<& /Dist/Elements/BeginsWith, Name => $Name &>
diff --git a/html/Dist/ByMaintainer.html b/html/Dist/ByMaintainer.html
index 108e899..9cbed77 100755
--- a/html/Dist/ByMaintainer.html
+++ b/html/Dist/ByMaintainer.html
@@ -46,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Elements/Header, Title => loc("Distributions maintained by [_1]", $user->Name) &>
-<& /Dist/Elements/Tabs,
- Title => loc("Distributions maintained by [_1]", $user->Name),
- current_tab => $current_tab,
- &>
+<& /Elements/Tabs &>
<& /Dist/Elements/DistributionList, queues => $watched_queues &>
@@ -68,14 +65,6 @@ if (not $user->Id) {
my $watched_queues = $user->WatchedQueues('AdminCc');
-my $current_tab;
-if ($Name eq $user->Name) {
- $current_tab = 'Dist/ByMaintainer.html?Name=' . $Name;
-}
-else {
- $current_tab = 'Dist/Browse.html';
-}
-
</%init>
<%args>
$Name => undef
diff --git a/html/Dist/Display.html b/html/Dist/Display.html
index 0e4c329..78edcec 100755
--- a/html/Dist/Display.html
+++ b/html/Dist/Display.html
@@ -50,12 +50,7 @@
RSSAutoDiscovery => $RSSFeedURL,
&>
-<& /Dist/Elements/Tabs,
- current_tab => '/Dist/Display.html',
- current_subtab => $current_subtab,
- Queue => $Name,
- Title => $title,
-&>
+<& /Elements/Tabs &>
<& /Dist/Elements/ShowNotes, Queue => $QueueObj &>
diff --git a/html/Dist/Elements/ErrorDisabled b/html/Dist/Elements/ErrorDisabled
index ec74319..f40cb63 100644
--- a/html/Dist/Elements/ErrorDisabled
+++ b/html/Dist/Elements/ErrorDisabled
@@ -1,9 +1,6 @@
<& /Dist/Elements/Header, Title => loc("Error") &>
-<& /Dist/Elements/Tabs,
- Title => loc("Queue for the distribution is disabled"),
- current_tab => '',
-&>
+<& /Elements/Tabs &>
<& /Dist/Elements/ShowNotes, Queue => $Queue &>
diff --git a/html/Dist/Elements/Tabs b/html/Dist/Elements/Tabs
deleted file mode 100644
index b20a65d..0000000
--- a/html/Dist/Elements/Tabs
+++ /dev/null
@@ -1,154 +0,0 @@
-%# BEGIN BPS TAGGED BLOCK {{{
-%#
-%# COPYRIGHT:
-%#
-%# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
-%# <jesse at bestpractical.com>
-%#
-%# (Except where explicitly superseded by other copyright notices)
-%#
-%#
-%# LICENSE:
-%#
-%# This work is made available to you under the terms of Version 2 of
-%# the GNU General Public License. A copy of that license should have
-%# been provided with this software, but in any event can be snarfed
-%# from www.gnu.org.
-%#
-%# This work is distributed in the hope that it will be useful, but
-%# WITHOUT ANY WARRANTY; without even the implied warranty of
-%# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-%# General Public License for more details.
-%#
-%# You should have received a copy of the GNU General Public License
-%# along with this program; if not, write to the Free Software
-%# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-%# 02110-1301 or visit their web page on the internet at
-%# http://www.gnu.org/copyleft/gpl.html.
-%#
-%#
-%# CONTRIBUTION SUBMISSION POLICY:
-%#
-%# (The following paragraph is not intended to limit the rights granted
-%# to you to modify and distribute this software under the terms of
-%# the GNU General Public License and is only of importance to you if
-%# you choose to contribute your changes and enhancements to the
-%# community by submitting them to Best Practical Solutions, LLC.)
-%#
-%# By intentionally submitting any modifications, corrections or
-%# derivatives to this work, or any other work intended for use with
-%# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-%# you are the copyright holder for those contributions and you grant
-%# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-%# royalty-free, perpetual, license to use, copy, create derivative
-%# works based on those contributions, and sublicense and distribute
-%# those contributions and any derivatives thereof.
-%#
-%# END BPS TAGGED BLOCK }}}
-<& /Elements/Tabs,
- actions => $actions,
- current_toptab => $current_toptab,
- current_tab => $current_tab,
- tabs => $tabs,
- Title => $Title,
-&>
-
-<%INIT>
-my $escaped_uname = $m->interp->apply_escapes(
- $session{'CurrentUser'}->UserObj->Name, 'u'
-);
-my $current_toptab = "Dist/ByMaintainer.html?Name=$escaped_uname";
-
-my $tabs = {
- A => {
- title => loc('My Distributions'),
- path => "Dist/ByMaintainer.html?Name=$escaped_uname",
- },
- B => {
- title => loc('Search'),
- path => 'Dist/Search.html',
- },
- C => {
- title => loc('Browse'),
- path => 'Dist/Browse.html',
- },
-};
-
-my $queue_obj;
-if ( $Queue ) {
- if (ref($Queue)) {
- $Queue = $Queue->Name;
- }
- else {
- my $tmp = RT::Queue->new( $session{'CurrentUser'} );
- $tmp->Load( $Queue );
- unless ( $tmp->id ) {
- $RT::Logger->warning( "Couldn't load queue '$Queue'");
- } else {
- $queue_obj = $tmp;
- }
- $Queue = $queue_obj->Name;
- }
-}
-
-my $escaped_queue = $m->interp->apply_escapes( $Queue, 'u' );
-
-if ($Queue) {
- my $queue_display_path = 'Dist/Display.html?Queue='. $escaped_queue;
- $tabs->{'H'} = {
- title => $Queue,
- path => $queue_display_path,
- };
-}
-
-my $dist_subtabs = {
- A => {
- title => loc("Active bugs"),
- path => "Dist/Display.html?Status=Active&Queue=". $escaped_queue,
- },
- Ab => {
- title => loc("Resolved bugs"),
- path => "Dist/Display.html?Status=Resolved&Queue=". $escaped_queue,
- },
- Ac => {
- title => loc("Rejected bugs"),
- path => "Dist/Display.html?Status=Rejected&Queue=". $escaped_queue,
- },
-};
-
-if ( $queue_obj && !$queue_obj->Disabled ) {
- $dist_subtabs->{'G'} = {
- title => loc("Report a new bug"),
- path => 'Ticket/Create.html?Queue='. $escaped_queue,
- };
-}
-
-if ( $queue_obj
- && (
- $queue_obj->IsAdminCc( $session{'CurrentUser'}->id )
- || $queue_obj->CurrentUserHasRight('AdminQueue') ) )
-{
- $dist_subtabs->{'J'} = {
- title => loc("Manage"),
- path => 'Dist/Manage.html?Queue='. $escaped_queue,
- };
-}
-
-# if we're looking at a page with a submenu, add it to the hash and set the
-# current tab
-if ($current_subtab =~ m!^(Dist/Display|Ticket/Create)\.html!) {
- $tabs->{'H'}->{'subtabs'} = $dist_subtabs;
- $tabs->{'H'}->{'current_subtab'} = $current_subtab;
- $current_tab = 'Dist/Display.html?Queue='. $escaped_queue;
-}
-
-</%INIT>
-
-<%ARGS>
-$Queue => undef
-$actions => undef
-$subtabs => undef
-$current_tab => ''
-$current_subtab => ''
-$Title => undef
-</%ARGS>
diff --git a/html/Dist/Manage.html b/html/Dist/Manage.html
index 8dee8bf..725afcb 100644
--- a/html/Dist/Manage.html
+++ b/html/Dist/Manage.html
@@ -2,12 +2,7 @@
Title => $title,
&>
-<& /Dist/Elements/Tabs,
- current_tab => '/Dist/Manage.html',
- current_subtab => $current_subtab,
- Queue => $Name,
- Title => $title,
-&>
+<& /Elements/Tabs &>
<& /Elements/ListActions, actions => \@results &>
diff --git a/html/Dist/Search.html b/html/Dist/Search.html
index cdafd88..2aba765 100755
--- a/html/Dist/Search.html
+++ b/html/Dist/Search.html
@@ -46,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Elements/Header, Title => loc("Public Bug Tracker") &>
-<& Elements/Tabs,
- current_tab => "Dist/Search.html",
- Title => loc("Search Distributions")
-&>
+<& /Elements/Tabs &>
<p>
<form action="/Dist/Display.html" method="get">
diff --git a/html/Elements/ErrorNoDist b/html/Elements/ErrorNoDist
index 52057f7..2b572cb 100644
--- a/html/Elements/ErrorNoDist
+++ b/html/Elements/ErrorNoDist
@@ -46,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Elements/Header, Title => loc("Error") &>
-<& /Public/Elements/Tabs,
- Title => loc("Unable to find distribution"),
- current_tab => '',
- &>
+<& /Public/Elements/Tabs, Title => loc("Unable to find distribution") &>
<p>
% if ($Queue) {
diff --git a/html/Elements/ErrorNoUser b/html/Elements/ErrorNoUser
index 02ce3e9..cd26605 100644
--- a/html/Elements/ErrorNoUser
+++ b/html/Elements/ErrorNoUser
@@ -46,10 +46,7 @@
%#
%# END BPS TAGGED BLOCK }}}
<& /Elements/Header, Title => loc("Error") &>
-<& /Public/Elements/Tabs,
- Title => loc("Unable to find user"),
- current_tab => '',
- &>
+<& /Public/Elements/Tabs, Title => loc("Unable to find user") &>
<p>
The user you specified, <strong><% $Name %></strong>, could not be found.
commit 6e05b8f7d84b112423dec5c13371f46780e469b3
Author: sunnavy <sunnavy at bestpractical.com>
Date: Mon Jun 4 23:43:11 2012 +0800
Name has higher precedence than Queue
Adjusted based on comments from beta testers of rt.perl.org.
diff --git a/html/Callbacks/BugTracker/Elements/Tabs/SelfService b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
index 8dc5f01..d810c5c 100644
--- a/html/Callbacks/BugTracker/Elements/Tabs/SelfService
+++ b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
@@ -72,8 +72,14 @@ $tracker->child(
my $request_path = $HTML::Mason::Commands::r->path_info;
$request_path =~ s!^/{2,}!/!;
-if ( $request_path =~ /^\/Dist/ ) {
- my $Queue = $DECODED_ARGS->{'Queue'} || $DECODED_ARGS->{'Name'};
+if ( $request_path =~ m{^/Dist} ) {
+ my $Queue;
+ if ( $request_path !~ m{^/Dist/ByMaintainer\.html} ) {
+ $Queue = $DECODED_ARGS->{'Name'};
+ }
+
+ $Queue ||= $DECODED_ARGS->{'Queue'};
+
my $queue_obj;
if ($Queue) {
my $tmp = RT::Queue->new( $session{'CurrentUser'} );
commit 44094ecb5b267bb923b067cf709aa62916e1a863
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Sat Dec 8 16:24:30 2012 -0800
update the MANIFEST for rt4
diff --git a/MANIFEST b/MANIFEST
index 756e595..caf0f6b 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,7 +1,8 @@
Changes
etc/initialdata
html/Callbacks/BugTracker/autohandler/Default
-html/Callbacks/BugTracker/Elements/Tabs/Default
+html/Callbacks/BugTracker/Elements/Tabs/Privileged
+html/Callbacks/BugTracker/Elements/Tabs/SelfService
html/Callbacks/BugTracker/Search/Simple.html/ModifyQuery
html/Callbacks/BugTracker/Ticket/Create.html/Default
html/Callbacks/BugTracker/Ticket/Create.html/FormStart
@@ -18,7 +19,6 @@ html/Dist/Elements/ErrorDisabled
html/Dist/Elements/ShowBugs
html/Dist/Elements/ShowMaintainers
html/Dist/Elements/ShowNotes
-html/Dist/Elements/Tabs
html/Dist/Manage.html
html/Dist/Search.html
html/Elements/ErrorNoDist
@@ -30,6 +30,7 @@ inc/Module/Install/Can.pm
inc/Module/Install/Fetch.pm
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/Win32.pm
@@ -39,3 +40,4 @@ lib/RT/BugTracker.pm
Makefile.PL
MANIFEST This list of files
META.yml
+README
commit 69f0c2e6e1d273f88e25c89f95589d1b9f270c86
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Sat Dec 8 16:24:36 2012 -0800
ignore mymeta
diff --git a/.gitignore b/.gitignore
index 0a12b71..87cc78c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@ cover_db/
nytprof/
*.tar.gz
*.sw[po]
+/MYMETA.*
commit 4d3b594114958451abe5b1c7ef28a9187ddacc6b
Author: Kevin Falcone <falcone at bestpractical.com>
Date: Mon Feb 25 13:21:44 2013 -0500
bump version to 0.06_01
diff --git a/lib/RT/BugTracker.pm b/lib/RT/BugTracker.pm
index 7ce1781..9121a02 100644
--- a/lib/RT/BugTracker.pm
+++ b/lib/RT/BugTracker.pm
@@ -52,7 +52,7 @@ use warnings;
package RT::BugTracker;
use 5.008003;
-our $VERSION = '0.06';
+our $VERSION = '0.06_01';
=head1 NAME
commit 1f75262121f8665c06e0a8907db2c325e19d569c
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Feb 28 14:50:05 2013 -0800
Update M::I
diff --git a/META.yml b/META.yml
index a11e67f..4be00b4 100644
--- a/META.yml
+++ b/META.yml
@@ -3,11 +3,12 @@ abstract: 'Adds a UI designed for bug-tracking for developers to RT'
author:
- 'Kevin Riggle <kevinr at bestpractical.com>'
build_requires:
- ExtUtils::MakeMaker: 6.42
+ ExtUtils::MakeMaker: 6.59
configure_requires:
- ExtUtils::MakeMaker: 6.42
+ ExtUtils::MakeMaker: 6.59
distribution_type: module
-generated_by: 'Module::Install version 0.97'
+dynamic_config: 1
+generated_by: 'Module::Install version 1.06'
license: gpl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
@@ -22,4 +23,4 @@ requires:
perl: 5.8.3
resources:
license: http://opensource.org/licenses/gpl-license.php
-version: 0.06
+version: 0.06_01
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 5871e1e..4ecf46b 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -22,7 +22,6 @@ use strict 'vars';
use Cwd ();
use File::Find ();
use File::Path ();
-use FindBin;
use vars qw{$VERSION $MAIN};
BEGIN {
@@ -32,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 = '0.97';
+ $VERSION = '1.06';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -231,7 +230,12 @@ sub preload {
sub new {
my ($class, %args) = @_;
- FindBin->again;
+ delete $INC{'FindBin.pm'};
+ {
+ # to suppress the redefine warning
+ local $SIG{__WARN__} = sub {};
+ require FindBin;
+ }
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
@@ -447,7 +451,7 @@ sub _version ($) {
}
sub _cmp ($$) {
- _version($_[0]) <=> _version($_[1]);
+ _version($_[1]) <=> _version($_[2]);
}
# Cloned from Params::Util::_CLASS
@@ -463,4 +467,4 @@ sub _CLASS ($) {
1;
-# Copyright 2008 - 2010 Adam Kennedy.
+# Copyright 2008 - 2012 Adam Kennedy.
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index 754fb90..802844a 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 = '0.97';
+ $VERSION = '1.06';
}
# Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 5757a67..22167b8 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -3,13 +3,12 @@ package Module::Install::Can;
use strict;
use Config ();
-use File::Spec ();
use ExtUtils::MakeMaker ();
use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.97';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -29,7 +28,7 @@ sub can_use {
eval { require $mod; $pkg->VERSION($ver || 0); 1 };
}
-# check if we can run some command
+# Check if we can run some command
sub can_run {
my ($self, $cmd) = @_;
@@ -38,14 +37,88 @@ sub can_run {
for my $dir ((split /$Config::Config{path_sep}/, $ENV{PATH}), '.') {
next if $dir eq '';
- my $abs = File::Spec->catfile($dir, $_[1]);
+ require File::Spec;
+ my $abs = File::Spec->catfile($dir, $cmd);
return $abs if (-x $abs or $abs = MM->maybe_command($abs));
}
return;
}
-# can we locate a (the) C compiler
+# Can our C compiler environment build XS files
+sub can_xs {
+ my $self = shift;
+
+ # Ensure we have the CBuilder module
+ $self->configure_requires( 'ExtUtils::CBuilder' => 0.27 );
+
+ # Do we have the configure_requires checker?
+ local $@;
+ eval "require ExtUtils::CBuilder;";
+ if ( $@ ) {
+ # They don't obey configure_requires, so it is
+ # someone old and delicate. Try to avoid hurting
+ # them by falling back to an older simpler test.
+ return $self->can_cc();
+ }
+
+ # Do we have a working C compiler
+ my $builder = ExtUtils::CBuilder->new(
+ quiet => 1,
+ );
+ unless ( $builder->have_compiler ) {
+ # No working C compiler
+ return 0;
+ }
+
+ # Write a C file representative of what XS becomes
+ require File::Temp;
+ my ( $FH, $tmpfile ) = File::Temp::tempfile(
+ "compilexs-XXXXX",
+ SUFFIX => '.c',
+ );
+ binmode $FH;
+ print $FH <<'END_C';
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+int main(int argc, char **argv) {
+ return 0;
+}
+
+int boot_sanexs() {
+ return 1;
+}
+
+END_C
+ close $FH;
+
+ # Can the C compiler access the same headers XS does
+ my @libs = ();
+ my $object = undef;
+ eval {
+ local $^W = 0;
+ $object = $builder->compile(
+ source => $tmpfile,
+ );
+ @libs = $builder->link(
+ objects => $object,
+ module_name => 'sanexs',
+ );
+ };
+ my $result = $@ ? 0 : 1;
+
+ # Clean up all the build files
+ foreach ( $tmpfile, $object, @libs ) {
+ next unless defined $_;
+ 1 while unlink;
+ }
+
+ return $result;
+}
+
+# Can we locate a (the) C compiler
sub can_cc {
my $self = shift;
my @chunks = split(/ /, $Config::Config{cc}) or return;
@@ -78,4 +151,4 @@ if ( $^O eq 'cygwin' ) {
__END__
-#line 156
+#line 236
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index 4f77e2e..bee0c4f 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 = '0.97';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 20955cd..7052f36 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -4,10 +4,11 @@ package Module::Install::Makefile;
use strict 'vars';
use ExtUtils::MakeMaker ();
use Module::Install::Base ();
+use Fcntl qw/:flock :seek/;
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '0.97';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -214,18 +215,22 @@ sub write {
require ExtUtils::MakeMaker;
if ( $perl_version and $self->_cmp($perl_version, '5.006') >= 0 ) {
- # MakeMaker can complain about module versions that include
- # an underscore, even though its own version may contain one!
- # Hence the funny regexp to get rid of it. See RT #35800
- # for details.
- my $v = $ExtUtils::MakeMaker::VERSION =~ /^(\d+\.\d+)/;
- $self->build_requires( 'ExtUtils::MakeMaker' => $v );
- $self->configure_requires( 'ExtUtils::MakeMaker' => $v );
+ # This previous attempted to inherit the version of
+ # ExtUtils::MakeMaker in use by the module author, but this
+ # was found to be untenable as some authors build releases
+ # using future dev versions of EU:MM that nobody else has.
+ # Instead, #toolchain suggests we use 6.59 which is the most
+ # stable version on CPAN at time of writing and is, to quote
+ # ribasushi, "not terminally fucked, > and tested enough".
+ # TODO: We will now need to maintain this over time to push
+ # the version up as new versions are released.
+ $self->build_requires( 'ExtUtils::MakeMaker' => 6.59 );
+ $self->configure_requires( 'ExtUtils::MakeMaker' => 6.59 );
} else {
# Allow legacy-compatibility with 5.005 by depending on the
# most recent EU:MM that supported 5.005.
- $self->build_requires( 'ExtUtils::MakeMaker' => 6.42 );
- $self->configure_requires( 'ExtUtils::MakeMaker' => 6.42 );
+ $self->build_requires( 'ExtUtils::MakeMaker' => 6.36 );
+ $self->configure_requires( 'ExtUtils::MakeMaker' => 6.36 );
}
# Generate the MakeMaker params
@@ -240,7 +245,6 @@ in a module, and provide its file path via 'version_from' (or
'all_from' if you prefer) in Makefile.PL.
EOT
- $DB::single = 1;
if ( $self->tests ) {
my @tests = split ' ', $self->tests;
my %seen;
@@ -364,9 +368,9 @@ sub fix_up_makefile {
. ($self->postamble || '');
local *MAKEFILE;
- open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+ open MAKEFILE, "+< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+ eval { flock MAKEFILE, LOCK_EX };
my $makefile = do { local $/; <MAKEFILE> };
- close MAKEFILE or die $!;
$makefile =~ s/\b(test_harness\(\$\(TEST_VERBOSE\), )/$1'inc', /;
$makefile =~ s/( -I\$\(INST_ARCHLIB\))/ -Iinc$1/g;
@@ -386,7 +390,8 @@ sub fix_up_makefile {
# XXX - This is currently unused; not sure if it breaks other MM-users
# $makefile =~ s/^pm_to_blib\s+:\s+/pm_to_blib :: /mg;
- open MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
+ seek MAKEFILE, 0, SEEK_SET;
+ truncate MAKEFILE, 0;
print MAKEFILE "$preamble$makefile$postamble" or die $!;
close MAKEFILE or die $!;
@@ -410,4 +415,4 @@ sub postamble {
__END__
-#line 539
+#line 544
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index bebb73f..58430f3 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 = '0.97';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -151,15 +151,21 @@ sub install_as_site { $_[0]->installdirs('site') }
sub install_as_vendor { $_[0]->installdirs('vendor') }
sub dynamic_config {
- my $self = shift;
- unless ( @_ ) {
- warn "You MUST provide an explicit true/false value to dynamic_config\n";
- return $self;
+ my $self = shift;
+ my $value = @_ ? shift : 1;
+ if ( $self->{values}->{dynamic_config} ) {
+ # Once dynamic we never change to static, for safety
+ return 0;
}
- $self->{values}->{dynamic_config} = $_[0] ? 1 : 0;
+ $self->{values}->{dynamic_config} = $value ? 1 : 0;
return 1;
}
+# Convenience command
+sub static_config {
+ shift->dynamic_config(0);
+}
+
sub perl_version {
my $self = shift;
return $self->{values}->{perl_version} unless @_;
@@ -170,7 +176,7 @@ sub perl_version {
# Normalize the version
$version = $self->_perl_version($version);
- # We don't support the reall old versions
+ # We don't support the really old versions
unless ( $version >= 5.005 ) {
die "Module::Install only supports 5.005 or newer (use ExtUtils::MakeMaker)\n";
}
@@ -515,6 +521,7 @@ sub __extract_license {
'GNU Free Documentation license' => 'unrestricted', 1,
'GNU Affero General Public License' => 'open_source', 1,
'(?:Free)?BSD license' => 'bsd', 1,
+ 'Artistic license 2\.0' => 'artistic_2', 1,
'Artistic license' => 'artistic', 1,
'Apache (?:Software )?license' => 'apache', 1,
'GPL' => 'gpl', 1,
@@ -550,9 +557,9 @@ sub license_from {
sub _extract_bugtracker {
my @links = $_[0] =~ m#L<(
- \Qhttp://rt.cpan.org/\E[^>]+|
- \Qhttp://github.com/\E[\w_]+/[\w_]+/issues|
- \Qhttp://code.google.com/p/\E[\w_\-]+/issues/list
+ https?\Q://rt.cpan.org/\E[^>]+|
+ https?\Q://github.com/\E[\w_]+/[\w_]+/issues|
+ https?\Q://code.google.com/p/\E[\w_\-]+/issues/list
)>#gx;
my %links;
@links{@links}=();
@@ -581,7 +588,7 @@ sub bugtracker_from {
sub requires_from {
my $self = shift;
my $content = Module::Install::_readperl($_[0]);
- my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+([\d\.]+)/mg;
+ my @requires = $content =~ m/^use\s+([^\W\d]\w*(?:::\w+)*)\s+(v?[\d\.]+)/mg;
while ( @requires ) {
my $module = shift @requires;
my $version = shift @requires;
@@ -616,8 +623,15 @@ sub _perl_version {
return $v;
}
-
-
+sub add_metadata {
+ my $self = shift;
+ my %hash = @_;
+ for my $key (keys %hash) {
+ warn "add_metadata: $key is not prefixed with 'x_'.\n" .
+ "Use appopriate function to add non-private metadata.\n" unless $key =~ /^x_/;
+ $self->{values}->{$key} = $hash{$key};
+ }
+}
######################################################################
diff --git a/inc/Module/Install/RTx.pm b/inc/Module/Install/RTx.pm
index 5480124..abf6aea 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.25';
+our $VERSION = '0.30';
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 {
@@ -42,10 +42,10 @@ sub RTx {
$INC{'RT.pm'} = "$RT::LocalPath/lib/RT.pm";
} else {
local @INC = (
- @INC,
$ENV{RTHOME} ? ( $ENV{RTHOME}, "$ENV{RTHOME}/lib" ) : (),
- map { ( "$_/rt3/lib", "$_/lib/rt3", "$_/lib" ) } grep $_,
- @prefixes
+ @INC,
+ map { ( "$_/rt4/lib", "$_/lib/rt4", "$_/rt3/lib", "$_/lib/rt3", "$_/lib" )
+ } grep $_, @prefixes
);
until ( eval { require RT; $RT::LocalPath } ) {
warn
@@ -60,11 +60,13 @@ sub RTx {
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::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 }
@@ -128,18 +130,7 @@ 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}++;
@@ -163,30 +154,59 @@ 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");
}
}
-sub RTxInit {
- unshift @INC, substr( delete( $INC{'RT.pm'} ), 0, -5 ) if $INC{'RT.pm'};
- require RT;
- RT::LoadConfig();
- RT::ConnectToDatabase();
+# 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);
- die "Cannot load RT" unless $RT::Handle and $RT::DatabaseType;
+ my @sorted = sort 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";
+ }
}
1;
__END__
-#line 303
+#line 329
diff --git a/inc/Module/Install/RTx/Factory.pm b/inc/Module/Install/RTx/Factory.pm
index 23ce911..76ab761 100644
--- a/inc/Module/Install/RTx/Factory.pm
+++ b/inc/Module/Install/RTx/Factory.pm
@@ -6,7 +6,7 @@ use strict;
use File::Basename ();
sub RTxInitDB {
- my ($self, $action) = @_;
+ my ($self, $action, $name, $version) = @_;
unshift @INC, substr(delete($INC{'RT.pm'}), 0, -5) if $INC{'RT.pm'};
@@ -23,6 +23,8 @@ sub RTxInitDB {
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;
@@ -32,452 +34,13 @@ sub RTxInitDB {
"--action" => $action,
"--datadir" => "etc",
(($action eq 'insert') ? ("--datafile" => "etc/initialdata") : ()),
- "--dba" => $RT::DatabaseUser,
- "--prompt-for-dba-password" => ''
+ "--dba" => $RT::DatabaseAdmin || $RT::DatabaseUser,
+ "--prompt-for-dba-password" => '',
+ (RT::System->can('AddUpgradeHistory') ? ("--package" => $name, "--ext-version" => $version) : ()),
);
+
print "$^X @args\n";
(system($^X, @args) == 0) or die "...returned with error: $?\n";
}
-sub RTxFactory {
- my ($self, $RTx, $name, $drop) = @_;
- my $namespace = "$RTx\::$name";
-
- $self->RTxInit;
-
- my $dbh = $RT::Handle->dbh;
- # get all tables out of database
- my @tables = $dbh->tables;
- my ( %tablemap, %typemap, %modulemap );
- my $driver = $RT::DatabaseType;
-
- my $CollectionBaseclass = 'RT::SearchBuilder';
- my $RecordBaseclass = 'RT::Record';
- my $LicenseBlock = << '.';
-# BEGIN LICENSE BLOCK
-#
-# END LICENSE BLOCK
-.
- my $Attribution = << '.';
-# Autogenerated by Module::Intall::RTx::Factory
-# WARNING: THIS FILE IS AUTOGENERATED. ALL CHANGES TO THIS FILE WILL BE LOST.
-#
-# !! DO NOT EDIT THIS FILE !!
-#
-
-use strict;
-.
- my $RecordInit = '';
-
- @tables = map { do { {
- my $table = $_;
- $table =~ s/.*\.//g;
- $table =~ s/\W//g;
- $table =~ s/^\Q$name\E_//i or next;
- $table ne 'sessions' or next;
-
- $table = ucfirst(lc($table));
- $table =~ s/$_/\u$_/ for qw(field group custom member value);
- $table =~ s/(?<=Scrip)$_/\u$_/ for qw(action condition);
- $table =~ s/$_/\U$_/ for qw(Acl);
- $table = $name . '_' . $table;
-
- $tablemap{$table} = $table;
- $modulemap{$table} = $table;
- if ( $table =~ /^(.*)s$/ ) {
- $tablemap{$1} = $table;
- $modulemap{$1} = $1;
- }
- $table;
- } } } @tables;
-
- $tablemap{'CreatedBy'} = 'User';
- $tablemap{'UpdatedBy'} = 'User';
-
- $typemap{'id'} = 'ro';
- $typemap{'Creator'} = 'auto';
- $typemap{'Created'} = 'auto';
- $typemap{'Updated'} = 'auto';
- $typemap{'UpdatedBy'} = 'auto';
- $typemap{'LastUpdated'} = 'auto';
- $typemap{'LastUpdatedBy'} = 'auto';
-
- $typemap{lc($_)} = $typemap{$_} for keys %typemap;
-
- foreach my $table (@tables) {
- if ($drop) {
- $dbh->do("DROP TABLE $table");
- $dbh->do("DROP sequence ${table}_id_seq") if $driver eq 'Pg';
- $dbh->do("DROP sequence ${table}_seq") if $driver eq 'Oracle';
- next;
- }
-
- my $tablesingle = $table;
- $tablesingle =~ s/^\Q$name\E_//i;
- $tablesingle =~ s/s$//;
- my $tableplural = $tablesingle . "s";
-
- if ( $tablesingle eq 'ACL' ) {
- $tablesingle = "ACE";
- $tableplural = "ACL";
- }
-
- my %requirements;
-
- my $CollectionClassName = $namespace . "::" . $tableplural;
- my $RecordClassName = $namespace . "::" . $tablesingle;
-
- my $path = $namespace;
- $path =~ s/::/\//g;
-
- my $RecordClassPath = $path . "/" . $tablesingle . ".pm";
- my $CollectionClassPath = $path . "/" . $tableplural . ".pm";
-
- #create a collection class
- my $CreateInParams;
- my $CreateOutParams;
- my $ClassAccessible = "";
- my $FieldsPod = "";
- my $CreatePod = "";
- my $CreateSub = "";
- my %fields;
- my $sth = $dbh->prepare("DESCRIBE $table");
-
- if ( $driver eq 'Pg' ) {
- $sth = $dbh->prepare(<<".");
- SELECT a.attname, format_type(a.atttypid, a.atttypmod),
- a.attnotnull, a.atthasdef, a.attnum
- FROM pg_class c, pg_attribute a
- WHERE c.relname ILIKE '$table'
- AND a.attnum > 0
- AND a.attrelid = c.oid
-ORDER BY a.attnum
-.
- }
- elsif ( $driver eq 'mysql' ) {
- $sth = $dbh->prepare("DESCRIBE $table");
- }
- else {
- die "$driver is currently unsupported";
- }
-
- $sth->execute;
-
- while ( my $row = $sth->fetchrow_hashref() ) {
- my ( $field, $type, $default );
- if ( $driver eq 'Pg' ) {
-
- $field = $row->{'attname'};
- $type = $row->{'format_type'};
- $default = $row->{'atthasdef'};
-
- if ( $default != 0 ) {
- my $tth = $dbh->prepare(<<".");
-SELECT substring(d.adsrc for 128)
- FROM pg_attrdef d, pg_class c
- WHERE c.relname = 'acct'
- AND c.oid = d.adrelid
- AND d.adnum = $row->{'attnum'}
-.
- $tth->execute();
- my @default = $tth->fetchrow_array;
- $default = $default[0];
- }
-
- }
- elsif ( $driver eq 'mysql' ) {
- $field = $row->{'Field'};
- $type = $row->{'Type'};
- $default = $row->{'Default'};
- }
-
- $fields{$field} = 1;
-
- #generate the 'accessible' datastructure
-
- if ( $typemap{$field} eq 'auto' ) {
- $ClassAccessible .= " $field =>
- {read => 1, auto => 1,";
- }
- elsif ( $typemap{$field} eq 'ro' ) {
- $ClassAccessible .= " $field =>
- {read => 1,";
- }
- else {
- $ClassAccessible .= " $field =>
- {read => 1, write => 1,";
-
- }
-
- $ClassAccessible .= " type => '$type', default => '$default'},\n";
-
- #generate pod for the accessible fields
- $FieldsPod .= $self->_pod(<<".");
-^head2 $field
-
-Returns the current value of $field.
-(In the database, $field is stored as $type.)
-
-.
-
- unless ( $typemap{$field} eq 'auto' || $typemap{$field} eq 'ro' ) {
- $FieldsPod .= $self->_pod(<<".");
-
-^head2 Set$field VALUE
-
-
-Set $field to VALUE.
-Returns (1, 'Status message') on success and (0, 'Error Message') on failure.
-(In the database, $field will be stored as a $type.)
-
-.
- }
-
- $FieldsPod .= $self->_pod(<<".");
-^cut
-
-.
-
- if ( $modulemap{$field} ) {
- $FieldsPod .= $self->_pod(<<".");
-^head2 ${field}Obj
-
-Returns the $modulemap{$field} Object which has the id returned by $field
-
-
-^cut
-
-sub ${field}Obj {
- my \$self = shift;
- my \$$field = ${namespace}::$modulemap{$field}->new(\$self->CurrentUser);
- \$$field->Load(\$self->__Value('$field'));
- return(\$$field);
-}
-.
- $requirements{ $tablemap{$field} } =
- "use ${namespace}::$modulemap{$field};";
-
- }
-
- unless ( $typemap{$field} eq 'auto' || $field eq 'id' ) {
-
- #generate create statement
- $CreateInParams .= " $field => '$default',\n";
- $CreateOutParams .=
- " $field => \$args{'$field'},\n";
-
- #gerenate pod for the create statement
- $CreatePod .= " $type '$field'";
- $CreatePod .= " defaults to '$default'" if ($default);
- $CreatePod .= ".\n";
-
- }
-
- }
-
- $CreateSub = <<".";
-sub Create {
- my \$self = shift;
- my \%args = (
-$CreateInParams
- \@_);
- \$self->SUPER::Create(
-$CreateOutParams);
-
-}
-.
- $CreatePod .= "\n=cut\n\n";
-
- my $CollectionClass = $LicenseBlock . $Attribution . $self->_pod(<<".") . $self->_magic_import($CollectionClassName);
-
-^head1 NAME
-
-$CollectionClassName -- Class Description
-
-^head1 SYNOPSIS
-
-use $CollectionClassName
-
-^head1 DESCRIPTION
-
-
-^head1 METHODS
-
-^cut
-
-package $CollectionClassName;
-
-use $CollectionBaseclass;
-use $RecordClassName;
-
-use vars qw( \@ISA );
-\@ISA= qw($CollectionBaseclass);
-
-
-sub _Init {
- my \$self = shift;
- \$self->{'table'} = '$table';
- \$self->{'primary_key'} = 'id';
-
-.
-
- if ( $fields{'SortOrder'} ) {
-
- $CollectionClass .= $self->_pod(<<".");
-
-# By default, order by name
-\$self->OrderBy( ALIAS => 'main',
- FIELD => 'SortOrder',
- ORDER => 'ASC');
-.
- }
- $CollectionClass .= $self->_pod(<<".");
- return ( \$self->SUPER::_Init(\@_) );
-}
-
-
-^head2 NewItem
-
-Returns an empty new $RecordClassName item
-
-^cut
-
-sub NewItem {
- my \$self = shift;
- return($RecordClassName->new(\$self->CurrentUser));
-}
-.
-
- my $RecordClassHeader = $Attribution . "
-
-^head1 NAME
-
-$RecordClassName
-
-
-^head1 SYNOPSIS
-
-^head1 DESCRIPTION
-
-^head1 METHODS
-
-^cut
-
-package $RecordClassName;
-use $RecordBaseclass;
-";
-
- foreach my $key ( keys %requirements ) {
- $RecordClassHeader .= $requirements{$key} . "\n";
- }
- $RecordClassHeader .= <<".";
-
-use vars qw( \@ISA );
-\@ISA= qw( $RecordBaseclass );
-
-sub _Init {
-my \$self = shift;
-
-\$self->Table('$table');
-\$self->SUPER::_Init(\@_);
-}
-
-.
-
- my $RecordClass = $LicenseBlock . $RecordClassHeader . $self->_pod(<<".") . $self->_magic_import($RecordClassName);
-
-$RecordInit
-
-^head2 Create PARAMHASH
-
-Create takes a hash of values and creates a row in the database:
-
-$CreatePod
-
-$CreateSub
-
-$FieldsPod
-
-sub _CoreAccessible {
- {
-
-$ClassAccessible
-}
-};
-
-.
-
- print "About to make $RecordClassPath, $CollectionClassPath\n";
- `mkdir -p $path`;
-
- open( RECORD, ">$RecordClassPath" );
- print RECORD $RecordClass;
- close(RECORD);
-
- open( COL, ">$CollectionClassPath" );
- print COL $CollectionClass;
- close(COL);
-
- }
-}
-
-sub _magic_import {
- my $self = shift;
- my $class = ref($self) || $self;
-
- #if (exists \$warnings::{unimport}) {
- # no warnings qw(redefine);
-
- my $path = $class;
- $path =~ s#::#/#gi;
-
-
- my $content = $self->_pod(<<".");
- eval \"require ${class}_Overlay\";
- if (\$@ && \$@ !~ qr{^Can't locate ${path}_Overlay.pm}) {
- die \$@;
- };
-
- eval \"require ${class}_Vendor\";
- if (\$@ && \$@ !~ qr{^Can't locate ${path}_Vendor.pm}) {
- die \$@;
- };
-
- eval \"require ${class}_Local\";
- if (\$@ && \$@ !~ qr{^Can't locate ${path}_Local.pm}) {
- die \$@;
- };
-
-
-
-
-^head1 SEE ALSO
-
-This class allows \"overlay\" methods to be placed
-into the following files _Overlay is for a System overlay by the original author,
-_Vendor is for 3rd-party vendor add-ons, while _Local is for site-local customizations.
-
-These overlay files can contain new subs or subs to replace existing subs in this module.
-
-If you'll be working with perl 5.6.0 or greater, each of these files should begin with the line
-
- no warnings qw(redefine);
-
-so that perl does not kick and scream when you redefine a subroutine or variable in your overlay.
-
-${class}_Overlay, ${class}_Vendor, ${class}_Local
-
-^cut
-
-
1;
-.
-
- return $content;
-}
-
-sub _pod {
- my ($self, $text) = @_;
- $text =~ s/^\^/=/mg;
- return $text;
-}
diff --git a/inc/Module/Install/ReadmeFromPod.pm b/inc/Module/Install/ReadmeFromPod.pm
index d5d89f4..6a80818 100644
--- a/inc/Module/Install/ReadmeFromPod.pm
+++ b/inc/Module/Install/ReadmeFromPod.pm
@@ -1,36 +1,138 @@
#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.08';
+$VERSION = '0.20';
sub readme_from {
my $self = shift;
- return unless $Module::Install::AUTHOR;
- my $file = shift || return;
- my $clean = shift;
- require Pod::Text;
- my $parser = Pod::Text->new();
- open README, '> README' or die "$!\n";
- $parser->output_fh( *README );
- $parser->parse_file( $file );
- return 1 unless $clean;
- $self->postamble(<<"END");
-distclean :: license_clean
-
-license_clean:
-\t\$(RM_F) README
-END
+ 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 89
+#line 254
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index bbfda8d..eeaa3fe 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 = '0.97';
+ $VERSION = '1.06';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index e6afa42..85d8018 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 = '0.97';;
+ $VERSION = '1.06';
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
commit 45d84a9589e3a882aecc81f452813757a2abdb6a
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Feb 28 15:19:23 2013 -0800
Restore highlighting of distribution page menu items
Request paths are canonicalized to use ; as the query param separator
when comparing the request path to possible active menu paths. This
canonicalization happens regardless of what the actual request URL uses
for a separator. Thus, using & as the param separator guarantees a menu
item will never be highlighted as active.
diff --git a/html/Callbacks/BugTracker/Elements/Tabs/SelfService b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
index d810c5c..eeaeab2 100644
--- a/html/Callbacks/BugTracker/Elements/Tabs/SelfService
+++ b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
@@ -102,18 +102,18 @@ if ( $request_path =~ m{^/Dist} ) {
);
PageMenu()->child(
active => title => loc("Active bugs"),
- path => "/Dist/Display.html?Status=Active&Queue=" . $escaped_queue,
+ path => "/Dist/Display.html?Status=Active;Queue=" . $escaped_queue,
);
PageMenu()->child(
resolved => title => loc("Resolved bugs"),
- path => "/Dist/Display.html?Status=Resolved&Queue="
+ path => "/Dist/Display.html?Status=Resolved;Queue="
. $escaped_queue,
);
PageMenu()->child(
rejected => title => loc("Rejected bugs"),
- path => "/Dist/Display.html?Status=Rejected&Queue="
+ path => "/Dist/Display.html?Status=Rejected;Queue="
. $escaped_queue,
);
commit 68ed7273ff2793f8962b04033fc5fddc23586489
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Feb 28 15:32:34 2013 -0800
Only try to load a distribution (queue) for the display/manage pages
The browsing pages shouldn't try to incorrectly load a queue, as they
never refer to a specific queue.
diff --git a/html/Callbacks/BugTracker/Elements/Tabs/SelfService b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
index eeaeab2..4aedc90 100644
--- a/html/Callbacks/BugTracker/Elements/Tabs/SelfService
+++ b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
@@ -72,13 +72,8 @@ $tracker->child(
my $request_path = $HTML::Mason::Commands::r->path_info;
$request_path =~ s!^/{2,}!/!;
-if ( $request_path =~ m{^/Dist} ) {
- my $Queue;
- if ( $request_path !~ m{^/Dist/ByMaintainer\.html} ) {
- $Queue = $DECODED_ARGS->{'Name'};
- }
-
- $Queue ||= $DECODED_ARGS->{'Queue'};
+if ( $request_path =~ m{^/Dist/(?:Display|Manage)\.html} ) {
+ my $Queue = $DECODED_ARGS->{'Name'} || $DECODED_ARGS->{'Queue'};
my $queue_obj;
if ($Queue) {
commit f8c71c4980f519573abfb4b4e919c27fb8974c7a
Author: Thomas Sibley <trs at bestpractical.com>
Date: Thu Feb 28 15:33:30 2013 -0800
Link the top-level "Distributions" item to "My Distributions"
diff --git a/html/Callbacks/BugTracker/Elements/Tabs/SelfService b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
index 4aedc90..e541a9c 100644
--- a/html/Callbacks/BugTracker/Elements/Tabs/SelfService
+++ b/html/Callbacks/BugTracker/Elements/Tabs/SelfService
@@ -53,6 +53,7 @@ my $escaped_uname = $m->interp->apply_escapes(
my $tracker = Menu()->child(
bugtracker => title => loc('Distributions'),
+ path => '/Dist/ByMaintainer.html?Name=' . $escaped_uname,
);
$tracker->child(
-----------------------------------------------------------------------
More information about the Bps-public-commit
mailing list