Skip to content

Commit 6248938

Browse files
committed
Update M:I:RTx to 0.45 and make sure RT::IR is enabled before "make initdb"
1 parent d6ca4a5 commit 6248938

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

META.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ requires:
3434
resources:
3535
license: http://opensource.org/licenses/gpl-license.php
3636
version: 5.0.8
37-
x_module_install_rtx_version: '0.44'
37+
x_module_install_rtx_version: '0.45'
3838
x_requires_rt: 5.0.0
3939
x_rt_too_new: 5.2.0

Makefile.PL

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
BEGIN { push @INC, '.' }
22
use inc::Module::Install;
33

4-
RTx('RT-IR', { no_readme_generation => 1, remove_files => 1 });
4+
RTx('RT-IR', { no_readme_generation => 1, remove_files => 1, initialdata_requires_plugin => 1 });
55
license('GPL Version 2');
66
author('Best Practical Solutions <sales@bestpractical.com>');
77
all_from('lib/RT/IR.pm');

inc/Module/Install/RTx.pm

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ no warnings 'once';
99
use Term::ANSIColor qw(:constants);
1010
use Module::Install::Base;
1111
use base 'Module::Install::Base';
12-
our $VERSION = '0.44';
12+
our $VERSION = '0.45';
1313

1414
use FindBin;
1515
use File::Glob ();
@@ -204,9 +204,17 @@ install ::
204204
$initdb .= <<"." if $has_etc{acl};
205205
\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxDatabase(qw(acl \$(NAME) \$(VERSION)))"
206206
.
207-
$initdb .= <<"." if $has_etc{initialdata};
207+
if ($has_etc{initialdata}) {
208+
if ($extra_args->{initialdata_requires_plugin}) {
209+
(my $plugin_name = $name) =~ s/-/::/g;
210+
$initdb .= <<"CHECK";
211+
\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxInitialdataRequiresPlugin('$plugin_name')"
212+
CHECK
213+
}
214+
$initdb .= <<"INSERT";
208215
\t\$(NOECHO) \$(PERL) -Ilib -I"$local_lib_path" -I"$lib_path" -Iinc -MModule::Install::RTx::Runtime -e"RTxDatabase(qw(insert \$(NAME) \$(VERSION)))"
209-
.
216+
INSERT
217+
}
210218
$self->postamble("initdb ::\n$initdb\n");
211219
$self->postamble("initialize-database ::\n$initdb\n");
212220
if ($has_etc{upgrade}) {
@@ -313,4 +321,4 @@ sub _load_rt_handle {
313321

314322
__END__
315323
316-
#line 484
324+
#line 500

inc/Module/Install/RTx/Runtime.pm

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
package Module::Install::RTx::Runtime;
33

44
use base 'Exporter';
5-
our @EXPORT = qw/RTxDatabase RTxPlugin/;
5+
our @EXPORT = qw/RTxDatabase RTxPlugin RTxInitialdataRequiresPlugin/;
66

77
use strict;
88
use File::Basename ();
@@ -56,6 +56,17 @@ sub RTxDatabase {
5656
(system($^X, @args) == 0) or die "...returned with error: $?\n";
5757
}
5858

59+
sub RTxInitialdataRequiresPlugin {
60+
my ($name) = @_;
61+
62+
_rt_runtime_load();
63+
64+
my @plugins = RT->Config->Get('Plugins');
65+
unless (grep { $_ eq $name } @plugins) {
66+
die "\nERROR: You must add Plugin('$name') to your RT_SiteConfig.pm before running 'make initdb'.\n\n";
67+
}
68+
}
69+
5970
sub RTxPlugin {
6071
my ($name) = @_;
6172

0 commit comments

Comments
 (0)