view release on metacpan or search on metacpan
- t
- xt
recommends:
Email::Address: 0
Net::GitHub: 0.18
Net::Google::Code: 0.14
Net::Jifty: 0
Net::Trac: 0
RT::Client::REST: 0
requires:
DateTime: 0
DateTime::Format::Natural: 0
HTML::Tree: 0
HTML::TreeBuilder: 0
Prophet: 0
Time::Progress: 0
URI::file: 0
version: 0.74
Makefile.PL view on Meta::CPAN
use inc::Module::Install;
name('App-SD');
author('Jesse Vincent and Chia-Liang Kao');
#copyright('2008-2009 Best Practical Solutions, LLC');
license('MIT');
version_from('lib/App/SD.pm');
requires 'Prophet'; # URI Params::Validate Class::Accessor Template::Declare::Tags Test::HTTP::Server::Simple JSON Test::WWW::Mechanize Any::Moose
requires('DateTime');
requires('Time::Progress');
# versions < 4.1 are buggy handling utf8
requires('HTML::TreeBuilder' => '4.1');
requires('DateTime::Format::Natural');
requires('HTML::Tree');
requires('URI::file');
requires('Try::Tiny' => '0.02');
build_requires('Test::Script::Run' => '0.02');
feature 'RT sync' => (
-default => 0,
'RT::Client::REST' => 0, # RT::Client::REST::Ticket
);
lib/App/SD/Model/Ticket.pm view on Meta::CPAN
sub canonicalize_prop_due {
my $self = shift;
my %args = @_;
my $props = $args{props};
# skip blank
return 1 unless $props->{due};
#skip well formed
return 1 if $props->{due} =~ /^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/;
require DateTime::Format::Natural;
my $parser = DateTime::Format::Natural->new;
my $dt = $parser->parse_datetime($props->{due});
if ($parser->success) {
# operate on $dt/@dt, for example:
$props->{due} = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $dt->year, $dt->month, $dt->day, $dt->hour, $dt->min, $dt->sec);
}
return 1;
}
=head2 _default_summary_format
lib/App/SD/Model/Ticket.pm view on Meta::CPAN
my $self = shift;
my $date = shift || $self->prop('due');
my $then = App::SD::Util::string_to_datetime($date);
if (!$then) {
warn "Unknown date format '$date'";
return 0;
}
if ($then < DateTime->now()){
return 1;
}
return 0;
}
__PACKAGE__->meta->make_immutable;
no Any::Moose;
1;
lib/App/SD/Replica/gcode/PullEncoder.pm view on Meta::CPAN
package App::SD::Replica::gcode::PullEncoder;
use Any::Moose;
extends 'App::SD::ForeignReplica::PullEncoder';
use Params::Validate qw(:all);
use Memoize;
use DateTime;
has sync_source => (
isa => 'App::SD::Replica::gcode',
is => 'rw',
);
my %PROP_MAP = %App::SD::Replica::gcode::PROP_MAP;
sub ticket_id {
my $self = shift;
lib/App/SD/Replica/gcode/PullEncoder.pm view on Meta::CPAN
if ( $query =~ /=/ ) {
%query = map { /(.+)=(.*)/; $1 => $2 }
split /&/, $query;
}
else {
$query{q} = $query;
}
}
my $last_changeset_seen_dt = $self->_only_pull_tickets_modified_after()
|| DateTime->from_epoch( epoch => 0 );
$self->sync_source->log("Searching for tickets. This can take a very long time on initial sync or if you haven't synced in a long time.");
require Net::Google::Code;
if ( $Net::Google::Code::VERSION lt '0.15' ) {
die
"query support is only for Net::Google::Code version not less than 0.15"
if $args{query};
require Net::Google::Code::Issue::Search;
my $search =
Net::Google::Code::Issue::Search->new(
lib/App/SD/Replica/github/PullEncoder.pm view on Meta::CPAN
package App::SD::Replica::github::PullEncoder;
use Any::Moose;
extends 'App::SD::ForeignReplica::PullEncoder';
use Params::Validate qw(:all);
use Memoize;
use DateTime;
use App::SD::Util;
has sync_source => (
isa => 'App::SD::Replica::github',
is => 'rw',
);
my %PROP_MAP = %App::SD::Replica::github::PROP_MAP;
lib/App/SD/Replica/github/PullEncoder.pm view on Meta::CPAN
=head2 find_matching_tickets QUERY
Returns a array of all tickets found matching your QUERY hash.
=cut
sub find_matching_tickets {
my $self = shift;
my %query = (@_);
my $last_changeset_seen_dt = $self->_only_pull_tickets_modified_after()
|| DateTime->from_epoch( epoch => 0 );
my $issue = $self->sync_source->github->issue;
my @updated = grep {
App::SD::Util::string_to_datetime($_->{updated_at}) > $last_changeset_seen_dt }
( @{ $issue->list('open') }, @{ $issue->list('closed') } );
return \@updated;
}
sub _only_pull_tickets_modified_after {
my $self = shift;
lib/App/SD/Replica/lighthouse/PullEncoder.pm view on Meta::CPAN
package App::SD::Replica::lighthouse::PullEncoder;
use Any::Moose;
extends 'App::SD::ForeignReplica::PullEncoder';
use Params::Validate qw(:all);
use Memoize;
use DateTime;
use Net::Lighthouse::User;
has sync_source => (
isa => 'App::SD::Replica::lighthouse',
is => 'rw',
);
my %PROP_MAP = %App::SD::Replica::lighthouse::PROP_MAP;
sub ticket_id {
lib/App/SD/Replica/lighthouse/PullEncoder.pm view on Meta::CPAN
=head2 find_matching_tickets QUERY
Returns a array of all tickets found matching your QUERY hash.
=cut
sub find_matching_tickets {
my $self = shift;
my %args = (@_);
my $last_changeset_seen_dt = $self->_only_pull_tickets_modified_after()
|| DateTime->from_epoch( epoch => 0 );
my @tickets =
$self->sync_source->lighthouse->tickets( query => $args{query} );
my @updated = map { $_->load( $_->number ); $_ }
grep { $_->{updated_at} ge $last_changeset_seen_dt } @tickets;
return \@updated;
}
sub _only_pull_tickets_modified_after {
my $self = shift;
lib/App/SD/Util.pm view on Meta::CPAN
package App::SD::Util;
use Any::Moose; # for warnings and strict at the least
use DateTime;
use Params::Validate qw/:all/;
my %MONTHS = ( jan => 1, feb => 2, mar => 3, apr => 4, may => 5, jun => 6, jul => 7, aug => 8, sep => 9, oct => 10, nov => 11, dec => 12);
sub string_to_datetime {
my ($date)= validate_pos(@_, { type => SCALAR | UNDEF} );
return unless defined($date);
if ($date =~ /^(\d{4})-(\d{2})-(\d{2})[T\s](\d{1,2}):(\d{2}):(\d{2})Z?$/ ){
my ($year,$month,$day, $hour,$min,$sec) = ($1,$2,$3,$4,$5,$6);
my $dt = DateTime->new( year => $year,
month => $month,
day => $day,
hour => $hour,
minute => $min,
second => $sec,
time_zone => 'GMT');
return $dt;
}
if ( $date =~ m!^(\d{4})/(\d{2})/(\d{2}) (\d{2}):(\d{2}):(\d{2}) ([-+]?\d{4})?! ) {
# e.g. 2009/03/21 10:03:05 -0700
my ( $year, $month, $day, $hour, $min, $sec, $tz ) =
( $1, $2, $3, $4, $5, $6, $7 );
my $dt = DateTime->new(
year => $year,
month => $month,
day => $day,
hour => $hour,
minute => $min,
second => $sec,
time_zone => $tz || 'GMT'
);
$dt->set_time_zone( 'GMT' );
return $dt;
}
#Thu Jun 11 05:21:26 -0700 2009 - as github was broken on 2009-08-25
if ($date =~ /^(\w{3}) (\w{3}) (\d+) (\d\d):(\d\d):(\d\d) ([+-]?\d{4}) (\d{4})$/) {
my ( $wday, $mon, $day, $hour, $min, $sec, $tz, $year) =
( $1, $2, $3, $4, $5, $6, $7, $8 );
my $dt = DateTime->new(
year => $year,
month => $MONTHS{lc($mon)},
day => $day,
hour => $hour,
minute => $min,
second => $sec,
time_zone => $tz || 'GMT'
);
$dt->set_time_zone( 'GMT' );
return $dt;
}
if ($date) {
require DateTime::Format::Natural;
# XXX DO we want floating or GMT?
my $parser = DateTime::Format::Natural->new(time_zone => 'floating');
my $dt = $parser->parse_datetime($date);
if ($parser->success) {
return $dt;
}
}
return undef;
}
=head2 datetime_to_string($datetime)
tools/shipwright-package view on Meta::CPAN
shipwright update cpan-Mouse --add-deps cpan-XSLoader
shipwright update prophet.git --add-deps cpan-Term-ReadLine-Perl,cpan-TermReadKey,cpan-DBD-SQLite,cpan-File-ShareDir,cpan-HTTP-Server-Simple,cpan-JSON-XS,cpan-Config::GitLike
shipwright update sd.git --add-deps prophet.git,cpan-Net-Bonjour,cpan-Email-Address,cpan-Net-Trac,cpan-RT-Client-REST,cpan-Net-Google-Code
shipwright maintain --update-order
cd /tmp
git clone file://${REPO} hack-$$
cd /tmp/hack-$$/sources/cpan-Lingua-EN-Inflect/vendor
git mv Build.pl Build.PL
cd /tmp/hack-$$/scripts/cpan-DateTime-Format-Natural
perl -pi -e 's/Build test/Build/g' build
git config push.default matching
git commit -m 'Made DTFN not run its tests which add a slew of deps' build
cd /tmp/hack-$$/scripts/cpan-Net-DNS
perl -pi -e 's/make:/make: COMMAND_MODE=unix2003/' build
git commit -m 'hack COMMAND_MODE to make Net-DNS happy on mac' build
git push
cd /tmp/
tools/shipwright-package-minimal view on Meta::CPAN
cpan:Digest::SHA::PurePerl \
cpan:App::SD
cd /tmp
shipwright maintain -r $GIT_PATH --update-order
cd /tmp
git clone file://${REPO} hack-$$
cd /tmp/hack-$$/sources/cpan-Lingua-EN-Inflect/vendor
git mv Build.pl Build.PL
cd /tmp/hack-$$/scripts/cpan-DateTime-Format-Natural
perl -pi -e 's/Build test/Build/g' build
cd /tmp/hack-$$/scripts/cpan-Net-DNS
perl -pi -e 's/make:/make: COMMAND_MODE=unix2003/' build
git commit -m 'hack COMMAND_MODE to make Net-DNS happy on mac' build
cd /tmp/hack-$$/scripts/cpan-Params-Util
perl -pi -e 's/Makefile.PL/Makefile.PL -pm/g' build
cd /tmp/hack-$$/scripts/cpan-Params-Validate
perl -pi -e 's/Build.PL/Build.PL --pp/g' build
cd /tmp/hack-$$/scripts/cpan-DateTime
perl -pi -e 's/Makefile.PL/Makefile.PL --pm/g' build
cd /tmp/hack-$$/scripts/cpan-List-MoreUtils
perl -pi -e 's/Makefile.PL/Makefile.PL -pm/g' build
git config push.default matching
git commit -m 'Made DTFN not run its tests which add a slew of deps' -a
git push
cd /tmp/
rm -rf hack-$$