acker::Data::Task;
use App::TimeTracker::Proto;
use DateTime;
use Path::Class;
use Try::Tiny;
use JSON::XS;
use Path::Class;
$|=1;
my $app = App::TimeTracker::Proto->new;
my @files = File::Find::Rule
>home );
foreach my $old (@files) {
print '.';
my $json_old = Path::Class::File->new($old)->slurp;
my $hash = decode_json($json_old);
if ($hash->{project} && ref($hash->{project}) eq
}
else {
push(@new_tags,$t);
}
}
$hash->{tags}=\@new_tags;
}
open(my $out,">",$old);
print $out encode_json($hash);
}
self, $cwd ) = @_;
$cwd ||= Path::Class::Dir->new->absolute;
if ( -e $cwd->file('.tracker.json') ) {
error_message(
"This directory is already set up.\nTry 'tracker show_co
->file('.tracker.json')->openw;
say $fh <<EOCONFIG;
{
"project":"$project"
}
EOCONFIG
my $projects_file = $self->home->file('projects.json');
my $coder = JSON::XS->new->utf8->
->file('.tracker.json')->absolute->stringify;
$projects_file->spew( $coder->encode($projects) );
}
say "Set up this directory for time-tracking via file .tracker.json";
}
sub cmd_plu
MooseX::Types::Path::Class;
use File::HomeDir ();
use Path::Class;
use Hash::Merge qw(merge);
use JSON::XS;
use Carp;
use Try::Tiny;
use App::TimeTracker::Data::Task;
use App::TimeTracker::Constants q
file_locations( {} );
my $fh = $self->global_config_file->openw;
print $fh $self->json_decoder->encode( {} );
close $fh;
}
return $home;
}
has 'global_config_file' =>
,
);
sub _build_global_config_file {
my $self = shift;
return $self->home->file('tracker.json');
}
has 'config_file_locations' => (
is => 'ro',
isa => 'HashRef',
l
ime::Format::Duration;
use User::pwent;
use MooseX::Storage;
with Storage(
format => [ JSONpm => { json_opts => { pretty => 1, canonical => 1 } } ],
io => "File",
);
MooseX::Storage::Eng
eConstraints;
use Path::Class qw();
use Path::Class::Iterator;
use MooseX::Storage::Format::JSONpm;
use JSON::XS;
our $HOUR_RE = qr/(?<hour>[012]?\d)/;
our $MINUTE_RE = qr/(?<minute>[0-5]?\d)/;
our
my $self = shift;
my $file = $self->home->file('projects.json');
return unless -e $file && -s $file;
my $decoder = JSON::XS->new->utf8->pretty->relaxed;
my $projects = $decoder->d