CC: | Evan Carroll <me [...] evancarroll.com> |
Subject: | [PATCH] moved to module::install |
Date: | Wed, 25 Mar 2009 10:42:52 -0500 |
To: | bug-MooseX-Types-DateTime [...] rt.cpan.org |
From: | Evan Carroll <me [...] evancarroll.com> |
---
Changes | 7 ++-
MANIFEST | 17 +++-
MANIFEST.SKIP | 2 +
Makefile.PL | 44 +++++------
lib/MooseX/Types/DateTime.pm | 4 +-
lib/MooseX/Types/DateTimeX.pm | 102 ------------------------
t/02_datetimex.t | 171 -----------------------------------------
7 files changed, 41 insertions(+), 306 deletions(-)
mode change 100755 => 100644 Changes
mode change 100644 => 100755 Makefile.PL
delete mode 100755 lib/MooseX/Types/DateTimeX.pm
delete mode 100755 t/02_datetimex.t
diff --git a/Changes b/Changes
old mode 100755
new mode 100644
index bd35db1..849806e
--- a/Changes
+++ b/Changes
@@ -1,6 +1,11 @@
+0.04
+ - Updated to Module::Install ( Evan Carroll )
+ - removed MooseX::Types::DateTime ( Evan Caroll )
+
0.03
- more explicit versions for dependencies
- - removed a test that doesn't seem to cleanly pass in all timezones
+ - removed a test that doesn't seem to cleanly pass in all timezones
+
0.02
- Use namespace::clean in some places
- Try to skip out of the test suite gracefully when bad crap happens
diff --git a/MANIFEST b/MANIFEST
index 7421262..70ca5ad 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,10 +1,19 @@
Changes
+inc/Module/AutoInstall.pm
+inc/Module/Install.pm
+inc/Module/Install/AutoInstall.pm
+inc/Module/Install/Base.pm
+inc/Module/Install/Can.pm
+inc/Module/Install/Fetch.pm
+inc/Module/Install/Include.pm
+inc/Module/Install/Makefile.pm
+inc/Module/Install/Metadata.pm
+inc/Module/Install/Win32.pm
+inc/Module/Install/WriteAll.pm
lib/MooseX/Types/DateTime.pm
-lib/MooseX/Types/DateTimeX.pm
Makefile.PL
MANIFEST This list of files
MANIFEST.SKIP
+META.yml
+SIGNATURE
t/01_basic.t
-t/02_datetimex.t
-META.yml Module meta-data (added by MakeMaker)
-SIGNATURE Public-key signature (added by MakeMaker)
diff --git a/MANIFEST.SKIP b/MANIFEST.SKIP
index 167f961..854433e 100644
--- a/MANIFEST.SKIP
+++ b/MANIFEST.SKIP
@@ -37,3 +37,5 @@
(\w+-)*(\w+)-\d\.\d+(?:\.tar\.gz)?$
\.t\.log$
+
+\.gitignore$
diff --git a/Makefile.PL b/Makefile.PL
old mode 100644
new mode 100755
index c981b3b..d539422
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,29 +1,23 @@
-#!/usr/bin/perl -w
+use inc::Module::Install;
-use strict;
+name 'MooseX-Types-DateTime';
+all_from 'lib/MooseX/Types/DateTime.pm';
+author 'Evan Carroll <me@evancarroll.com>';
+license 'perl';
-use ExtUtils::MakeMaker;
+requires 'Moose' => '0.41'; # class_type
+requires 'MooseX::Types' => '0.04';
+requires 'namespace::clean' => '0.08';
-WriteMakefile(
- NAME => 'MooseX::Types::DateTime',
- VERSION_FROM => 'lib/MooseX/Types/DateTime.pm',
- INSTALLDIRS => 'site',
- SIGN => 1,
- PL_FILES => { },
- PREREQ_PM => {
- 'Moose' => '0.41', # class_type
- 'DateTime' => '0.4302',
- 'DateTime::Locale' => '0.4001',
- 'DateTime::TimeZone' => '0.7701',
- 'Test::use::ok' => '0.02',
- 'Test::Exception' => '0.27',
- 'MooseX::Types' => '0.04',
- 'DateTime::Format::DateParse' => '0.04',
- 'DateTime::Format::Natural' => '0.71',
- 'DateTime::Format::Flexible' => '0.05',
- 'DateTimeX::Easy' => '0.082',
- 'Time::Duration::Parse' => '0.06',
- 'namespace::clean' => '0.08',
- },
-);
+# Datetime stuff
+requires 'DateTime' => '0.4302';
+requires 'DateTime::Locale' => '0.4001';
+requires 'DateTime::TimeZone' => '0.7701';
+test_requires 'Test::use::ok' => '0.02';
+test_requires 'Test::Exception' => '0.27';
+test_requires 'Test::More';
+
+auto_install;
+
+WriteAll;
diff --git a/lib/MooseX/Types/DateTime.pm b/lib/MooseX/Types/DateTime.pm
index 0b68a49..841a22b 100644
--- a/lib/MooseX/Types/DateTime.pm
+++ b/lib/MooseX/Types/DateTime.pm
@@ -1,11 +1,9 @@
-#!/usr/bin/perl
-
package MooseX::Types::DateTime;
use strict;
use warnings;
-our $VERSION = "0.03";
+our $VERSION = "0.04";
use DateTime ();
use DateTime::Locale ();
diff --git a/lib/MooseX/Types/DateTimeX.pm b/lib/MooseX/Types/DateTimeX.pm
deleted file mode 100755
index bfe52c1..0000000
--- a/lib/MooseX/Types/DateTimeX.pm
+++ /dev/null
@@ -1,102 +0,0 @@
-package MooseX::Types::DateTimeX;
-
-use strict;
-use warnings;
-
-use DateTime;
-use DateTime::Duration;
-use DateTimeX::Easy;
-use Time::Duration::Parse qw(parse_duration);
-use MooseX::Types::DateTime ();
-use MooseX::Types::Moose qw/Num HashRef Str/;
-
-use namespace::clean;
-
-use MooseX::Types -declare => [qw( DateTime Duration)];
-
-=head1 NAME
-
-MooseX::Types::DateTimeX - Extensions to L<MooseX::Types::DateTime>
-
-=head1 SYNOPSIS
-
- package MyApp::MyClass;
-
- use MooseX::Types::DateTimeX qw( DateTime );
-
- has created => (
- isa => DateTime,
- is => "rw",
- coerce => 1,
- );
-
- my $instance = MyApp::MyClass->new(created=>'January 1, 1980');
- print $instance->created->year; # is 1980
-
- ## Coercions from the base type continue to work as normal.
- my $instance = MyApp::MyClass->new(created=>{year=>2000,month=>1,day=>10});
-
-Please see the test case for more example usage.
-
-=head1 DESCRIPTION
-
-This module builds on L<MooseX::Types::DateTime> to add additional custom
-types and coercions. Since it builds on an existing type, all coercions and
-constraints are inherited.
-
-=head1 SUBTYPES
-
-This module defines the following additional subtypes.
-
-=head2 DateTime
-
-Subtype of 'DateTime'. Adds an additional coercion from strings.
-
-Uses L<DateTimeX::Easy> to try and convert strings, like "yesterday" into a
-valid L<DateTime> object. Please note that due to ambiguity with how different
-systems might localize their timezone, string parsing may not always return
-the most expected value. IN general we try to localize to UTC whenever
-possible. Feedback welcomed!
-
-=cut
-
-subtype DateTime, as MooseX::Types::DateTime::DateTime;
-
-coerce( DateTime,
- @{ $MooseX::Types::DateTime::coercions{DateTime} },
- from Str, via { DateTimeX::Easy->new($_) },
-);
-
-
-=head2 Duration
-
-Subtype of 'DateTime::Duration' that coerces from a string. We use the module
-L<Time::Duration::Parse> to attempt this.
-
-=cut
-
-subtype Duration, as MooseX::Types::DateTime::Duration;
-
-coerce( Duration,
- @{ $MooseX::Types::DateTime::coercions{"DateTime::Duration"} },
- from Str, via {
- DateTime::Duration->new(
- seconds => parse_duration($_)
- );
- },
-);
-
-=head1 AUTHOR
-
-John Napiorkowski E<lt>jjn1056 at yahoo.comE<gt>
-
-=head1 LICENSE
-
- Copyright (c) 2008 John Napiorkowski.
-
- This program is free software; you can redistribute
- it and/or modify it under the same terms as Perl itself.
-
-=cut
-
-1;
diff --git a/t/02_datetimex.t b/t/02_datetimex.t
deleted file mode 100755
index c1077b1..0000000
--- a/t/02_datetimex.t
+++ /dev/null
@@ -1,171 +0,0 @@
-use strict;
-use warnings;
-
-use Test::More;
-
-BEGIN {
- plan skip_all => "DateTime::Format::DateManip required" unless eval { require DateTime::Format::DateManip };
- plan tests => 28;
-}
-
-use Test::Exception;
-use DateTime;
-
-use ok 'MooseX::Types::DateTimeX';
-
-=head1 NAME
-
-t/02_datetimex.t - Check that we can properly coerce a string.
-
-=head1 DESCRIPTION
-
-Run some tests to make sure the the Duration and DateTime types continue to
-work exactly as from the L<MooseX::Types::DateTime> class, as well as perform
-the correct string to object coercions.
-
-=head1 TESTS
-
-This module defines the following tests.
-
-=head2 Test Class
-
-Create a L<Moose> class that is using the L<MooseX::Types::DateTimeX> types.
-
-=cut
-
-{
- package MooseX::Types::DateTimeX::CoercionTest;
-
- use Moose;
- use MooseX::Types::DateTimeX qw(DateTime Duration);
-
- has 'date' => (is=>'rw', isa=>DateTime, coerce=>1);
- has 'duration' => (is=>'rw', isa=>Duration, coerce=>1);
-}
-
-ok my $class = MooseX::Types::DateTimeX::CoercionTest->new
-=> 'Created a good class';
-
-
-=head2 ParseDateTime Capabilities
-
-parse some dates and make sure the system can actually find something.
-
-=cut
-
-sub coerce_ok ($;$) {
- my ( $date, $canon ) = @_;
- local $Test::Builder::Level = $Test::Builder::Level + 1;
-
- SKIP: {
- skip "DateTimeX::Easy couldn't parse '$date'", $canon ? 2 : 1 unless DateTimeX::Easy->new($date);
- ok( $class->date($date), "coerced a DateTime from '$date'" );
- is( $class->date, $canon, 'got correct date' ) if $canon;
- }
-}
-
-## Skip this test until I can figure out better timezone handling
-#coerce_ok ('2/13/1969 noon', '1969-02-13T11:00:00' );
-
-
-coerce_ok( '2/13/1969', '1969-02-13T00:00:00' );
-
-coerce_ok( '2/13/1969 America/New_York', '1969-02-13T00:00:00' );
-
-SKIP: {
- skip "couldn't parse", 1 unless $class->date;
- isa_ok $class->date->time_zone => 'DateTime::TimeZone::America::New_York'
- => 'Got Correct America/New_York TimeZone';
-}
-
-coerce_ok( 'jan 1 2006', '2006-01-01T00:00:00' );
-
-=head2 relative dates
-
-Stuff like "yesterday". We can make sure they returned something but we have
-no way to make sure the values are really correct. Manual testing suggests
-they work well enough, given the inherent ambiguity we are dealing with.
-
-=cut
-
-coerce_ok("now");
-
-coerce_ok("yesterday");
-
-coerce_ok("tomorrow");
-
-coerce_ok("last week");
-
-=head2 check inherited constraints
-
-Just a few tests to make sure the object, hash, etc coercions and type checks
-still work.
-
-=cut
-
-ok my $datetime = DateTime->now()
-=> 'Create a datetime object for testing';
-
-ok my $anyobject = bless({}, 'Bogus::Does::Not::Exist')
-=> 'Created a random object for proving the object constraint';
-
-ok $class->date($datetime)
-=> 'Passed Object type constraint test.';
-
- isa_ok $class->date => 'DateTime'
- => 'Got a good DateTime Object';
-
-dies_ok { $class->date($anyobject) } 'Does not allow the bad object';
-
-ok $class->date(1000)
-=> 'Passed Num coercion test.';
-
- isa_ok $class->date => 'DateTime'
- => 'Got a good DateTime Object';
-
- is $class->date => '1970-01-01T00:16:40'
- => 'Got correct DateTime';
-
-ok $class->date({year=>2000,month=>1,day=>10})
-=> 'Passed HashRef coercion test.';
-
- isa_ok $class->date => 'DateTime'
- => 'Got a good DateTime Object';
-
- is $class->date => '2000-01-10T00:00:00'
- => 'Got correct DateTime';
-
-=head2 check duration
-
-make sure the Duration type constraint works as expected
-
-=cut
-
-ok $class->duration(100)
-=> 'got duration from integer';
-
- is $class->duration->seconds, 100
- => 'got correct duration from integer';
-
-
-ok $class->duration('1 minute')
-=> 'got duration from string';
-
- is $class->duration->seconds, 60
- => 'got correct duration string';
-
-
-=head1 AUTHOR
-
-John Napiorkowski E<lt>jjn1056 at yahoo.comE<gt>
-
-=head1 COPYRIGHT
-
- Copyright (c) 2008 John Napiorkowski. All rights reserved
- This program is free software; you can redistribute
- it and/or modify it under the same terms as Perl itself.
-
-=cut
-
-1;
-
--
1.5.6.3