[Rt-commit] rtfm branch, master, updated. 643d4fa53228d04e36a7282b73b27188fa3e5db3
Jesse Vincent
jesse at bestpractical.com
Mon Aug 16 12:47:33 EDT 2010
The branch, master has been updated
via 643d4fa53228d04e36a7282b73b27188fa3e5db3 (commit)
via dfcf17f4f3efda5e6c9585819849f4bb23d0b6ae (commit)
via db2602ae836163a732e8ada3fe381afcefc9db15 (commit)
via 2884eba180aa569107442d6a169e6dd7938e61ea (commit)
from 71c2c88bc201061568e5d89758b3807f8f463e1f (commit)
Summary of changes:
META.yml | 2 +-
Makefile.PL | 12 +++
etc/{drop_schema.mysql => drop_schema.SQLite} | 0
etc/{schema.Pg => schema.SQLite} | 20 ++---
inc/Module/Install.pm | 10 +--
inc/Module/Install/AutoInstall.pm | 10 +--
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 | 12 +--
inc/Module/Install/Metadata.pm | 13 +--
inc/Module/Install/RTx.pm | 2 +-
inc/Module/Install/Substitute.pm | 131 +++++++++++++++++++++++++
inc/Module/Install/Win32.pm | 2 +-
inc/Module/Install/WriteAll.pm | 2 +-
16 files changed, 171 insertions(+), 53 deletions(-)
copy etc/{drop_schema.mysql => drop_schema.SQLite} (100%)
copy etc/{schema.Pg => schema.SQLite} (80%)
create mode 100644 inc/Module/Install/Substitute.pm
- Log -----------------------------------------------------------------
commit 2884eba180aa569107442d6a169e6dd7938e61ea
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Aug 16 12:47:20 2010 -0400
Update inc to 1.00 (as a side effect of needing substitute
diff --git a/inc/Module/Install.pm b/inc/Module/Install.pm
index 8ee839d..5871e1e 100644
--- a/inc/Module/Install.pm
+++ b/inc/Module/Install.pm
@@ -22,6 +22,7 @@ use strict 'vars';
use Cwd ();
use File::Find ();
use File::Path ();
+use FindBin;
use vars qw{$VERSION $MAIN};
BEGIN {
@@ -31,7 +32,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.00';
+ $VERSION = '0.97';
# Storage for the pseudo-singleton
$MAIN = undef;
@@ -230,12 +231,7 @@ sub preload {
sub new {
my ($class, %args) = @_;
- delete $INC{'FindBin.pm'};
- {
- # to suppress the redefine warning
- local $SIG{__WARN__} = sub {};
- require FindBin;
- }
+ FindBin->again;
# ignore the prefix on extension modules built from top level.
my $base_path = Cwd::abs_path($FindBin::Bin);
diff --git a/inc/Module/Install/AutoInstall.pm b/inc/Module/Install/AutoInstall.pm
index f1f5356..fea975d 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.00';
+ $VERSION = '0.97';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -48,14 +48,6 @@ sub auto_install {
while (my ($mod, $ver) = splice(@requires, 0, 2)) {
$seen{$mod}{$ver}++;
}
- my @build_requires = map @$_, map @$_, grep ref, $self->build_requires;
- while (my ($mod, $ver) = splice(@build_requires, 0, 2)) {
- $seen{$mod}{$ver}++;
- }
- my @configure_requires = map @$_, map @$_, grep ref, $self->configure_requires;
- while (my ($mod, $ver) = splice(@configure_requires, 0, 2)) {
- $seen{$mod}{$ver}++;
- }
my @deduped;
while (my ($mod, $ver) = splice(@features_require, 0, 2)) {
diff --git a/inc/Module/Install/Base.pm b/inc/Module/Install/Base.pm
index b55bda3..754fb90 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.00';
+ $VERSION = '0.97';
}
# Suspend handler for "redefined" warnings
diff --git a/inc/Module/Install/Can.pm b/inc/Module/Install/Can.pm
index 71ccc27..5757a67 100644
--- a/inc/Module/Install/Can.pm
+++ b/inc/Module/Install/Can.pm
@@ -9,7 +9,7 @@ use Module::Install::Base ();
use vars qw{$VERSION @ISA $ISCORE};
BEGIN {
- $VERSION = '1.00';
+ $VERSION = '0.97';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Fetch.pm b/inc/Module/Install/Fetch.pm
index ec1f106..4f77e2e 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.00';
+ $VERSION = '0.97';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Include.pm b/inc/Module/Install/Include.pm
index a28cd4c..83223a1 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.00';
+ $VERSION = '0.97';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/Makefile.pm b/inc/Module/Install/Makefile.pm
index 5dfd0e9..20955cd 100644
--- a/inc/Module/Install/Makefile.pm
+++ b/inc/Module/Install/Makefile.pm
@@ -4,11 +4,10 @@ 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 = '1.00';
+ $VERSION = '0.97';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -365,9 +364,9 @@ sub fix_up_makefile {
. ($self->postamble || '');
local *MAKEFILE;
- open MAKEFILE, "+< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
- eval { flock MAKEFILE, LOCK_EX };
+ open MAKEFILE, "< $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
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;
@@ -387,8 +386,7 @@ 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;
- seek MAKEFILE, 0, SEEK_SET;
- truncate MAKEFILE, 0;
+ open MAKEFILE, "> $makefile_name" or die "fix_up_makefile: Couldn't open $makefile_name: $!";
print MAKEFILE "$preamble$makefile$postamble" or die $!;
close MAKEFILE or die $!;
@@ -412,4 +410,4 @@ sub postamble {
__END__
-#line 541
+#line 539
diff --git a/inc/Module/Install/Metadata.pm b/inc/Module/Install/Metadata.pm
index cfe45b3..bebb73f 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.00';
+ $VERSION = '0.97';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
@@ -616,15 +616,8 @@ 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 b780a6c..5480124 100644
--- a/inc/Module/Install/RTx.pm
+++ b/inc/Module/Install/RTx.pm
@@ -42,8 +42,8 @@ sub RTx {
$INC{'RT.pm'} = "$RT::LocalPath/lib/RT.pm";
} else {
local @INC = (
- $ENV{RTHOME} ? ( $ENV{RTHOME}, "$ENV{RTHOME}/lib" ) : (),
@INC,
+ $ENV{RTHOME} ? ( $ENV{RTHOME}, "$ENV{RTHOME}/lib" ) : (),
map { ( "$_/rt3/lib", "$_/lib/rt3", "$_/lib" ) } grep $_,
@prefixes
);
diff --git a/inc/Module/Install/Substitute.pm b/inc/Module/Install/Substitute.pm
new file mode 100644
index 0000000..56af7fe
--- /dev/null
+++ b/inc/Module/Install/Substitute.pm
@@ -0,0 +1,131 @@
+#line 1
+package Module::Install::Substitute;
+
+use strict;
+use warnings;
+use 5.008; # I don't care much about earlier versions
+
+use Module::Install::Base;
+our @ISA = qw(Module::Install::Base);
+
+our $VERSION = '0.03';
+
+require File::Temp;
+require File::Spec;
+require Cwd;
+
+#line 89
+
+sub substitute
+{
+ my $self = shift;
+ $self->{__subst} = shift;
+ $self->{__option} = {};
+ if( UNIVERSAL::isa( $_[0], 'HASH' ) ) {
+ my $opts = shift;
+ while( my ($k,$v) = each( %$opts ) ) {
+ $self->{__option}->{ lc( $k ) } = $v || '';
+ }
+ }
+ $self->_parse_options;
+
+ my @file = @_;
+ foreach my $f (@file) {
+ $self->_rewrite_file( $f );
+ }
+
+ return;
+}
+
+sub _parse_options
+{
+ my $self = shift;
+ my $cwd = Cwd::getcwd();
+ foreach my $t ( qw(from to) ) {
+ $self->{__option}->{$t} = $cwd unless $self->{__option}->{$t};
+ my $d = $self->{__option}->{$t};
+ die "Couldn't read directory '$d'" unless -d $d && -r _;
+ }
+}
+
+sub _rewrite_file
+{
+ my ($self, $file) = @_;
+ my $source = File::Spec->catfile( $self->{__option}{from}, $file );
+ $source .= $self->{__option}{sufix} if $self->{__option}{sufix};
+ unless( -f $source && -r _ ) {
+ print STDERR "Couldn't find file '$source'\n";
+ return;
+ }
+ my $dest = File::Spec->catfile( $self->{__option}{to}, $file );
+ return $self->__rewrite_file( $source, $dest );
+}
+
+sub __rewrite_file
+{
+ my ($self, $source, $dest) = @_;
+
+ my $mode = (stat($source))[2];
+
+ open my $sfh, "<$source" or die "Couldn't open '$source' for read";
+ print "Open input '$source' file for substitution\n";
+
+ my ($tmpfh, $tmpfname) = File::Temp::tempfile('mi-subst-XXXX', UNLINK => 1);
+ $self->__process_streams( $sfh, $tmpfh, ($source eq $dest)? 1: 0 );
+ close $sfh;
+
+ seek $tmpfh, 0, 0 or die "Couldn't seek in tmp file";
+
+ open my $dfh, ">$dest" or die "Couldn't open '$dest' for write";
+ print "Open output '$dest' file for substitution\n";
+
+ while( <$tmpfh> ) {
+ print $dfh $_;
+ }
+ close $dfh;
+ chmod $mode, $dest or "Couldn't change mode on '$dest'";
+}
+
+sub __process_streams
+{
+ my ($self, $in, $out, $replace) = @_;
+
+ my @queue = ();
+ my $subst = $self->{'__subst'};
+ my $re_subst = join('|', map {"\Q$_"} keys %{ $subst } );
+
+ while( my $str = <$in> ) {
+ if( $str =~ /^###\s*(before|replace|after)\:\s?(.*)$/s ) {
+ my ($action, $nstr) = ($1,$2);
+ $nstr =~ s/\@($re_subst)\@/$subst->{$1}/ge;
+
+ die "Replace action is bad idea for situations when dest is equal to source"
+ if $replace && $action eq 'replace';
+ if( $action eq 'before' ) {
+ die "no line before 'before' action" unless @queue;
+ # overwrite prev line;
+ pop @queue;
+ push @queue, $nstr;
+ push @queue, $str;
+ } elsif( $action eq 'replace' ) {
+ push @queue, $nstr;
+ } elsif( $action eq 'after' ) {
+ push @queue, $str;
+ push @queue, $nstr;
+ # skip one line;
+ <$in>;
+ }
+ } else {
+ push @queue, $str;
+ }
+ while( @queue > 3 ) {
+ print $out shift(@queue);
+ }
+ }
+ while( scalar @queue ) {
+ print $out shift(@queue);
+ }
+}
+
+1;
+
diff --git a/inc/Module/Install/Win32.pm b/inc/Module/Install/Win32.pm
index edc18b4..bbfda8d 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.00';
+ $VERSION = '0.97';
@ISA = 'Module::Install::Base';
$ISCORE = 1;
}
diff --git a/inc/Module/Install/WriteAll.pm b/inc/Module/Install/WriteAll.pm
index d0f6599..e6afa42 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.00';
+ $VERSION = '0.97';;
@ISA = qw{Module::Install::Base};
$ISCORE = 1;
}
commit db2602ae836163a732e8ada3fe381afcefc9db15
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Aug 16 12:47:58 2010 -0400
actually make it possible to run tests for RTFM from somewhere other
than /opt/rt3 using substitute logic from RTIR
diff --git a/Makefile.PL b/Makefile.PL
index 466fcca..b927639 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -15,4 +15,16 @@ requires(
);
auto_install();
+
+# XXX: This should be reported by M::I::RTx
+my ($lib_path) = $INC{'RT.pm'} =~ /^(.*)[\\\/]/;
+my $local_lib_path = "$RT::LocalPath/lib";
+
+substitute( {
+ RT_LIB_PATH => join( ' ', $local_lib_path, $lib_path ),
+ },
+ 't/lib/RT/FM/Test.pm',
+);
+
+
WriteAll();
commit dfcf17f4f3efda5e6c9585819849f4bb23d0b6ae
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Aug 16 12:48:25 2010 -0400
META.yml update to keep pace with new M::I
diff --git a/META.yml b/META.yml
index c2b3a2f..0cf3593 100644
--- a/META.yml
+++ b/META.yml
@@ -5,7 +5,7 @@ build_requires:
configure_requires:
ExtUtils::MakeMaker: 6.42
distribution_type: module
-generated_by: 'Module::Install version 1.00'
+generated_by: 'Module::Install version 0.97'
license: gpl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
commit 643d4fa53228d04e36a7282b73b27188fa3e5db3
Author: Jesse Vincent <jesse at bestpractical.com>
Date: Mon Aug 16 12:49:16 2010 -0400
Port RTFM to SQLite.
diff --git a/etc/drop_schema.SQLite b/etc/drop_schema.SQLite
new file mode 100644
index 0000000..27902ef
--- /dev/null
+++ b/etc/drop_schema.SQLite
@@ -0,0 +1,4 @@
+DROP TABLE FM_Classes ;
+DROP TABLE FM_Articles ;
+DROP TABLE FM_ObjectTopics ;
+DROP TABLE FM_Topics ;
diff --git a/etc/schema.SQLite b/etc/schema.SQLite
new file mode 100644
index 0000000..82069d8
--- /dev/null
+++ b/etc/schema.SQLite
@@ -0,0 +1,45 @@
+
+CREATE TABLE FM_Classes (
+id INTEGER PRIMARY KEY,
+Name varchar(255) NOT NULL DEFAULT '',
+Description varchar(255) NOT NULL DEFAULT '',
+SortOrder integer NOT NULL DEFAULT 0,
+Disabled smallint NOT NULL DEFAULT 0,
+Creator integer NOT NULL DEFAULT 0,
+Created TIMESTAMP NULL,
+LastUpdatedBy integer NOT NULL DEFAULT 0,
+LastUpdated TIMESTAMP NULL,
+HotList smallint NOT NULL DEFAULT 0
+);
+
+CREATE TABLE FM_Articles (
+id INTEGER PRIMARY KEY,
+Name varchar(255) NOT NULL DEFAULT '',
+Summary varchar(255) NOT NULL DEFAULT '',
+SortOrder integer NOT NULL DEFAULT 0,
+Class integer NOT NULL DEFAULT 0,
+Parent integer NOT NULL DEFAULT 0,
+URI varchar(255),
+Creator integer NOT NULL DEFAULT 0,
+Created TIMESTAMP NULL,
+LastUpdatedBy integer NOT NULL DEFAULT 0,
+LastUpdated TIMESTAMP NULL
+);
+
+
+CREATE TABLE FM_Topics (
+id INTEGER PRIMARY KEY,
+Parent integer NOT NULL DEFAULT 0,
+Name varchar(255) NOT NULL DEFAULT '',
+Description varchar(255) NOT NULL DEFAULT '',
+ObjectType varchar(64) NOT NULL DEFAULT '',
+ObjectId integer NOT NULL
+);
+
+
+CREATE TABLE FM_ObjectTopics (
+id INTEGER PRIMARY KEY,
+Topic integer NOT NULL,
+ObjectType varchar(64) NOT NULL DEFAULT '',
+ObjectId integer NOT NULL
+);
-----------------------------------------------------------------------
More information about the Rt-commit
mailing list