App-SimplenoteSync
view release on metacpan or search on metacpan
"Ioan Rogers <ioanr\@cpan.org>",
"Fletcher T. Penney <owner\@fletcherpenney.net>"
],
"dist_name" => "App-SimplenoteSync",
"dist_version" => "0.2.1",
"license" => "gpl",
"module_name" => "App::SimplenoteSync",
"recursive_test_files" => 1,
"requires" => {
"Config::INI::Reader" => 0,
"DateTime" => 0,
"File::BaseDir" => 0,
"File::Basename" => 0,
"File::ExtAttr" => 0,
"Getopt::Long" => 0,
"Log::Any" => 0,
"Log::Any::Adapter" => 0,
"Log::Any::Adapter::Dispatch" => 0,
"Log::Dispatch" => 0,
"Log::Dispatch::File" => 0,
"Log::Dispatch::Screen::Color" => 0,
}
},
"configure" : {
"requires" : {
"Module::Build" : "0.28"
}
},
"runtime" : {
"requires" : {
"Config::INI::Reader" : "0",
"DateTime" : "0",
"File::BaseDir" : "0",
"File::Basename" : "0",
"File::ExtAttr" : "0",
"Getopt::Long" : "0",
"Log::Any" : "0",
"Log::Any::Adapter" : "0",
"Log::Any::Adapter::Dispatch" : "0",
"Log::Dispatch" : "0",
"Log::Dispatch::File" : "0",
"Log::Dispatch::Screen::Color" : "0",
"web" : "https://github.com/ioanrogers/App-SimplenoteSync"
}
},
"version" : "0.2.1",
"x_BuiltWith" : {
"failures" : {
"Log::Dispatch::Screen::Color" : "module was not found in INC"
},
"modules" : {
"Config::INI::Reader" : "0.025",
"DateTime" : "1.52",
"File::BaseDir" : "0.08",
"File::Basename" : "2.85",
"File::ExtAttr" : "1.09",
"Getopt::Long" : "2.51",
"JSON" : "4.03",
"Log::Any" : "1.708",
"Log::Any::Adapter" : "1.708",
"Log::Any::Adapter::Dispatch" : "0.08",
"Log::Dispatch" : "2.70",
"Log::Dispatch::File" : "2.70",
bin/simplenotesync view on Meta::CPAN
require Log::Dispatch::Screen::Color;
$logger->add(
Log::Dispatch::Screen::Color->new(
min_level => 'info',
newline => 1,
));
}
if ($opt->{debug}) {
require Log::Dispatch::File;
require DateTime;
my $sub = sub {
my %p = @_;
my $dt = DateTime->now;
my $str = sprintf '%s::%s::%s', $dt->iso8601, uc $p{level},
$p{message};
return $str;
};
$logger->add(
Log::Dispatch::File->new(
name => 'debug_file',
min_level => 'debug',
filename => $PROGNAME . '_debug.log',
lib/App/SimplenoteSync.pm view on Meta::CPAN
package App::SimplenoteSync;
$App::SimplenoteSync::VERSION = '0.2.1';
# ABSTRACT: Synchronise text notes with simplenoteapp.com
use v5.10;
use open qw(:std :utf8);
use Moose;
use MooseX::Types::Path::Class;
use Log::Any qw//;
use DateTime;
use Try::Tiny;
use File::ExtAttr ':all';
use Proc::InvokeEditor;
use App::SimplenoteSync::Note;
use WebService::Simplenote;
use Method::Signatures;
use namespace::autoclean;
has ['email', 'password'] => (
is => 'ro',
lib/App/SimplenoteSync.pm view on Meta::CPAN
# which is newer?
# utime doesn't use nanoseconds
$remote_note->modifydate->set_nanosecond(0);
$self->logger->debugf(
'Comparing dates: remote [%s] // local [%s]',
$remote_note->modifydate->iso8601,
$local_note->modifydate->iso8601
);
given (
DateTime->compare_ignore_floating(
$remote_note->modifydate, $local_note->modifydate
))
{
when (0) {
$self->logger->debug("[$key] not modified");
}
when (1) {
$self->logger->debug("[$key] remote note is newer");
$self->_get_note($key);
$self->stats->{update_remote}++;
lib/App/SimplenoteSync.pm view on Meta::CPAN
}
}
return 1;
}
# TODO: check ctime
# XXX: this isn't called anywhere?!?
method _update_dates(App::SimplenoteSync::Note $note, Path::Class::File $file)
{
my $mod_time = DateTime->from_epoch(epoch => $file->stat->mtime);
given (DateTime->compare($mod_time, $note->modifydate)) {
when (0) {
# no change
return;
}
when (1) {
# file has changed
$note->modifydate($mod_time);
}
t/01-note.t view on Meta::CPAN
#!/usr/bin/env perl -w
use Test::More tests => 6;
use App::SimplenoteSync::Note;
use DateTime;
use Path::Class;
use JSON;
my $date = DateTime->new(
year => 2012,
month => 1,
day => 1,
);
my $notes_dir = Path::Class::Dir->new('.');
my $note = App::SimplenoteSync::Note->new(
createdate => $date->epoch,
modifydate => $date->epoch,
( run in 0.308 second using v1.01-cache-2.11-cpan-05444aca049 )