Switch to Module::Install
Peter Rabbitson [Mon, 1 Jun 2009 11:53:44 +0000 (11:53 +0000)]
Create a 'share' directory to be used with Module::Install::ShareDir / File::ShareDir
Move DiaUml tt2 files to share, adjust DiaUml producer (no tests but I think I got it right)
Move grammar files to sharedir too (only one for now, but this is where we will eventually keep all of them)

15 files changed:
Build.PL [deleted file]
Changes
Makefile.PL
lib/SQL/Translator/Producer/ClassDBI.pm [changed mode: 0755->0644]
lib/SQL/Translator/Producer/DiaUml.pm
lib/SQL/Translator/Producer/Storable.pm [changed mode: 0755->0644]
share/DiaUml/diagram.tt2 [moved from lib/SQL/Translator/Producer/DiaUml/diagram.tt2 with 100% similarity]
share/DiaUml/layer.tt2 [moved from lib/SQL/Translator/Producer/DiaUml/layer.tt2 with 100% similarity]
share/DiaUml/schema.tt2 [moved from lib/SQL/Translator/Producer/DiaUml/schema.tt2 with 100% similarity]
share/DiaUml/uml-attribute.tt2 [moved from lib/SQL/Translator/Producer/DiaUml/uml-attribute.tt2 with 100% similarity]
share/DiaUml/uml-class-all.tt2 [moved from lib/SQL/Translator/Producer/DiaUml/uml-class-all.tt2 with 100% similarity]
share/DiaUml/uml-class-end.tt2 [moved from lib/SQL/Translator/Producer/DiaUml/uml-class-end.tt2 with 100% similarity]
share/DiaUml/uml-class-start.tt2 [moved from lib/SQL/Translator/Producer/DiaUml/uml-class-start.tt2 with 100% similarity]
share/DiaUml/uml-class.tt2 [moved from lib/SQL/Translator/Producer/DiaUml/uml-class.tt2 with 100% similarity]
share/Grammar/DB2.gra [moved from lib/SQL/Translator/Parser/Grammar/DB2.gra with 100% similarity]

diff --git a/Build.PL b/Build.PL
deleted file mode 100644 (file)
index f49026a..0000000
--- a/Build.PL
+++ /dev/null
@@ -1,86 +0,0 @@
-use strict;
-use lib './lib';
-use Module::Build;
-
-my $builder = Module::Build->new(
-  module_name           => 'SQL::Translator',
-  dist_author           => 'Ken Youens-Clark <kclark@cpan.org>',
-  dist_version_from     => 'lib/SQL/Translator.pm',
-  dist_abstract         => 'SQL DDL transformations and more',
-  license               => 'gpl',
-  dynamic_config        => 0,
-  create_readme         => 0,
-  recursive_test_files  => 1,
-  sign                  => 1,
-  create_packlist       => 1,
-  sign                  => 1,
-  recursive_test_files  => 1,
-  create_makefile_pl    => 'passthrough',
-
-  requires => {
-    'Class::Base'              => 0,
-    'Class::Data::Inheritable' => 0.02,
-    'Class::MakeMethods'       => 0,
-    'Digest::SHA1'             => 2.00,
-    'Carp::Clan',              => 0,
-    'IO::Dir'                  => 0,
-    'Parse::RecDescent'        => 1.95,
-    'Pod::Usage'               => 0,
-    'Class::Accessor::Fast'    => 0,
-    'DBI'                      => 0,
-  },
-  recommends => {
-    'Template'                => 2.10,
-    'GD'                      => 0,
-    'GraphViz'                => 0,
-    'Graph::Directed'         => 0,
-    'IO::File'                => 0,
-    'IO::Scalar'              => 0,
-    'Spreadsheet::ParseExcel' => '>= 0.2602, != 0.33',
-    'Text::ParseWords'        => 0,
-    'Text::RecordParser'      => 0.02,
-    'XML::Writer'             => 0.500,
-    'XML::LibXML'             => 1.61,
-  },
-  build_requires => {
-    'File::Basename'          => 0,
-    'File::Spec'              => 0,
-    'Test::More'              => 0.6,
-    'Test::Differences'       => 0,
-    'Test::Exception'         => 0,
-    'YAML'                    => 0.39,
-  },
-
-  add_to_cleanup => [ 'SQL-Translator-*' ],
-  script_files => [
-    'bin/sqlt-diagram',
-    'bin/sqlt-diff',
-    'bin/sqlt-diff-old',
-    'bin/sqlt-dumper',
-    'bin/sqlt-graph',
-    'bin/sqlt',
-  ],
-
-  get_options => {
-    # Where to store additional files such as templates.
-    # TODO: Should be OS dependant. See Module::Build::os_type()
-    install_dir => { type=>'=s', default=>'/usr/local/share/sqlfairy' },
-  },
-  meta_merge => {
-    resources => {
-      # Custom resources (must begin with an uppercase letter)
-      Ratings      => 'http://cpanratings.perl.org/d/SQL-Translator',
-
-      # Official keys (homepage, license, bugtracker)
-      repository   => 'https://sqlfairy.svn.sourceforge.net/svnroot/sqlfairy',
-      bugtracker   => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Translator',
-      license      => 'http://fsf.org/licensing/licenses/gpl.html',
-    },
-  },
-);
-
-# Copy .tt2 files in lib into blib/lib
-$builder->add_build_element('tt2');
-
-$builder->create_build_script;
-print "Now run './Build', './Build test', and './Build install'\n";
diff --git a/Changes b/Changes
index a52440e..98d71c1 100644 (file)
--- a/Changes
+++ b/Changes
@@ -12,6 +12,7 @@
 * MySQL producer skips length attribute for columns which do not support that
   attribute. Currently following column types are added to that list:
   date time timestamp datetime year
+* Sitch to Module::Install (mandates minimum perl 5.005)
 
 # ----------------------------------------------------------
 # 0.09004 2009-02-13
index 08eebde..45eaa98 100644 (file)
@@ -1,31 +1,80 @@
-# Note: this file was auto-generated by Module::Build::Compat version 0.31012
-    
-    unless (eval "use Module::Build::Compat 0.02; 1" ) {
-      print "This module requires Module::Build to install itself.\n";
-      
-      require ExtUtils::MakeMaker;
-      my $yn = ExtUtils::MakeMaker::prompt
-       ('  Install Module::Build now from CPAN?', 'y');
-      
-      unless ($yn =~ /^y/i) {
-       die " *** Cannot install without Module::Build.  Exiting ...\n";
-      }
-      
-      require Cwd;
-      require File::Spec;
-      require CPAN;
-      
-      # Save this 'cause CPAN will chdir all over the place.
-      my $cwd = Cwd::cwd();
-      
-      CPAN::Shell->install('Module::Build::Compat');
-      CPAN::Shell->expand("Module", "Module::Build::Compat")->uptodate
-       or die "Couldn't install Module::Build, giving up.\n";
-      
-      chdir $cwd or die "Cannot chdir() back to $cwd: $!";
-    }
-    eval "use Module::Build::Compat 0.02; 1" or die $@;
-    
-    Module::Build::Compat->run_build_pl(args => \@ARGV);
-    require Module::Build;
-    Module::Build::Compat->write_makefile(build_class => 'Module::Build');
+use inc::Module::Install 0.89;
+use strict;
+use warnings;
+
+my $deps = {
+  requires => {
+    'Class::Base'              => 0,
+    'Class::Data::Inheritable' => 0.02,
+    'Class::MakeMethods'       => 0,
+    'Digest::SHA1'             => 2.00,
+    'Carp::Clan',              => 0,
+    'IO::Dir'                  => 0,
+    'Parse::RecDescent'        => 1.096000,   # PBP ftw
+    'Pod::Usage'               => 0,
+    'Class::Accessor::Fast'    => 0,
+    'DBI'                      => 0,
+    'File::ShareDir'           => 1.0,
+    'File::Spec'               => 0,
+  },
+  recommends => {
+    'Template'                => 2.10,
+    'GD'                      => 0,
+    'GraphViz'                => 0,
+    'Graph::Directed'         => 0,
+    'IO::File'                => 0,
+    'IO::Scalar'              => 0,
+    'Spreadsheet::ParseExcel' => 0.41,
+    'Text::ParseWords'        => 0,
+    'Text::RecordParser'      => 0.02,
+    'XML::Writer'             => 0.500,
+    'XML::LibXML'             => 1.61,
+  },
+  test_requires => {
+    'File::Basename'          => 0,
+    'Test::More'              => 0.6,
+    'Test::Differences'       => 0,
+    'Test::Exception'         => 0,
+    'YAML'                    => 0.39,
+  },
+};
+
+perl_version '5.005';
+
+name        'SQL-Translator';
+author      'Ken Youens-Clark <kclark@cpan.org>';
+abstract    'SQL DDL transformations and more';
+license     'http://fsf.org/licensing/licenses/gpl.html';
+repository  'https://sqlfairy.svn.sourceforge.net/svnroot/sqlfairy';
+bugtracker  'http://rt.cpan.org/NoAuth/Bugs.html?Dist=SQL-Translator';
+
+resources Ratings => 'http://cpanratings.perl.org/d/SQL-Translator';
+
+all_from    'lib/SQL/Translator.pm';
+
+for my $type (qw/requires recommends test_requires/) {
+  no strict qw/refs/;
+  my $f = \&$type;
+  for my $mod (keys %{$deps->{$type} || {} }) {
+    $f->($mod, $deps->{$type}{$mod});
+  }
+}
+
+tests_recursive ();
+
+install_script (qw|
+  bin/sqlt-diagram
+  bin/sqlt-diff
+  bin/sqlt-diff-old
+  bin/sqlt-dumper
+  bin/sqlt-graph
+  bin/sqlt
+|);
+
+install_share();
+
+auto_provides();
+
+auto_install();
+
+WriteAll();
old mode 100755 (executable)
new mode 100644 (file)
index ea985f1..7c02d33 100644 (file)
@@ -60,17 +60,15 @@ use vars qw[ $DEBUG $VERSION @EXPORT_OK ];
 $VERSION = '1.59';
 $DEBUG   = 0 unless defined $DEBUG;
 
+use File::ShareDir qw/dist_dir/;
+
 use SQL::Translator::Utils 'debug';
 use base qw/SQL::Translator::Producer::TT::Base/;
 # Convert produce call into a method call on our class
 sub produce { return __PACKAGE__->new( translator => shift )->run; };
 
-# Uses dir in lib with this mods name as the template dir
-my $_TEMPLATE_DIR = __FILE__;
-$_TEMPLATE_DIR =~ s/\.pm$//;
-
 sub tt_config {
-    ( INCLUDE_PATH => $_TEMPLATE_DIR );
+    ( INCLUDE_PATH => File::Spec->catdir (dist_dir('SQL-Translator'), 'DiaUml') );
 }
 
 sub tt_schema { 'schema.tt2' }
old mode 100755 (executable)
new mode 100644 (file)