[Bps-public-commit] r14704 - in sd/trunk: . lib/App/SD lib/App/SD/Replica/RT
jesse at bestpractical.com
jesse at bestpractical.com
Thu Jul 31 23:40:24 EDT 2008
Author: jesse
Date: Thu Jul 31 23:40:24 2008
New Revision: 14704
Modified:
sd/trunk/Makefile.PL
sd/trunk/lib/App/SD/Model/Ticket.pm
sd/trunk/lib/App/SD/Record.pm
sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm
Log:
* Removed deps on DateTime and Clone
Modified: sd/trunk/Makefile.PL
==============================================================================
--- sd/trunk/Makefile.PL (original)
+++ sd/trunk/Makefile.PL Thu Jul 31 23:40:24 2008
@@ -6,15 +6,13 @@
version_from('lib/App/SD.pm');
requires 'Prophet'; # URI UNIVERSAL::require Params::Validate Path::Class Class::Accessor
-requires('Clone');
requires('Moose'); # Moose::Role
-requires('DateTime');
features(
'RT sync' => [
-default => 0,
'RT::Client::REST' => 0, # RT::Client::REST::Ticket
- 'DateTime::Format::HTTP' => 0,
+ 'HTTP::Date' => 0,
],
Modified: sd/trunk/lib/App/SD/Model/Ticket.pm
==============================================================================
--- sd/trunk/lib/App/SD/Model/Ticket.pm (original)
+++ sd/trunk/lib/App/SD/Model/Ticket.pm Thu Jul 31 23:40:24 2008
@@ -3,6 +3,7 @@
extends 'App::SD::Record';
use Term::ANSIColor;
+use HTTP::Date;
use constant collection_class => 'App::SD::Collection::Ticket';
use constant type => 'ticket';
@@ -74,20 +75,11 @@
return 0;
}
- my $dt = eval { DateTime->new(
- year => $1,
- month => $2,
- day => $3,
- hour => $4,
- minute => $5,
- second => $6,
- time_zone => 'UTC',
- ) };
- warn $@ if $@;
- return 0 if !$dt;
+ my $then = HTTP::Date::str2time($date, 'GMT');
+ return 0 if !$then;
- my $now = DateTime->now(time_zone => 'UTC');
- return $now > $dt;
+ my $now = time();
+ return $now > $then;
}
__PACKAGE__->register_reference( comments => 'App::SD::Collection::Comment', by => 'ticket');
Modified: sd/trunk/lib/App/SD/Record.pm
==============================================================================
--- sd/trunk/lib/App/SD/Record.pm (original)
+++ sd/trunk/lib/App/SD/Record.pm Thu Jul 31 23:40:24 2008
@@ -4,7 +4,6 @@
package App::SD::Record; # should probably be Prophet::App::Record
use Moose;
use Params::Validate;
-use DateTime;
sub declared_props { 'created', inner() }
@@ -25,8 +24,15 @@
|| $props->{date};
if (!$created ) {
- my $date = DateTime->now;
- $args{props}->{created} = $date->ymd." ".$date->hms;
+ my @now = gmtime();
+
+ $args{props}->{created} = sprintf(
+ "%04d-%02d-%02d %02d:%02d:%02d",
+ ( $now[5] + 1900 ),
+ ( $now[4] + 1 ),
+ $now[3], $now[2], $now[1], $now[0]
+ );
+
}
return 1;
}
Modified: sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm
==============================================================================
--- sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm (original)
+++ sd/trunk/lib/App/SD/Replica/RT/PullEncoder.pm Thu Jul 31 23:40:24 2008
@@ -428,30 +428,14 @@
return join( ", ", @old );
}
-our $MONNUM = {
- Jan => 1,
- Feb => 2,
- Mar => 3,
- Apr => 4,
- May => 5,
- Jun => 6,
- Jul => 7,
- Aug => 8,
- Sep => 9,
- Oct => 10,
- Nov => 11,
- Dec => 12
-};
-
-use DateTime::Format::HTTP;
+use HTTP::Date;
sub date_to_iso {
my $self = shift;
my $date = shift;
return undef if $date eq 'Not set';
- my $t = DateTime::Format::HTTP->parse_datetime($date);
- return $t->ymd . " " . $t->hms;
+ return HTTP::Date::time2iso($date);
}
our %PROP_MAP = (
More information about the Bps-public-commit
mailing list