App-TimeTracker-Command-Billing

 view release on metacpan or  search on metacpan

Build.PL  view on Meta::CPAN

  "dist_abstract" => "Add a billing point as a tag to tasks",
  "dist_author" => [
    "Thomas Klausner <domm\@plix.at>"
  ],
  "dist_name" => "App-TimeTracker-Command-Billing",
  "dist_version" => "1.001",
  "license" => "perl",
  "module_name" => "App::TimeTracker::Command::Billing",
  "recursive_test_files" => 1,
  "requires" => {
    "DateTime" => 0,
    "Moose::Role" => 0,
    "perl" => "5.010"
  },
  "test_requires" => {
    "File::Spec" => 0,
    "File::Temp" => 0,
    "IO::Handle" => 0,
    "IPC::Open3" => 0,
    "Test::More" => 0
  }

META.json  view on Meta::CPAN

            "Module::Build" : "0.28"
         }
      },
      "configure" : {
         "requires" : {
            "Module::Build" : "0.28"
         }
      },
      "runtime" : {
         "requires" : {
            "DateTime" : "0",
            "Moose::Role" : "0",
            "perl" : "5.010"
         }
      },
      "test" : {
         "requires" : {
            "File::Spec" : "0",
            "File::Temp" : "0",
            "IO::Handle" : "0",
            "IPC::Open3" : "0",

README.md  view on Meta::CPAN

### prefix

If set, add this prefix to the billing point when storing it as tag. Useful to discern regular tags from billing point pseudo tags.

### default

Set to the method to calculate the default billing point. Currently there is only one method implemented, `strftime`

### strftime

When using `default = strftime`, specify the [DateTime::strftime](https://metacpan.org/pod/DateTime%3A%3Astrftime) format. Some examples:

- `%Y/%m` -> 2019/12
- `%Y/Q%{quarter}` -> 2019/Q4

# NEW COMMANDS

no new commands

# CHANGES TO OTHER COMMANDS

cpanfile  view on Meta::CPAN

# This file is generated by Dist::Zilla::Plugin::CPANFile v6.017
# Do not edit this file directly. To change prereqs, edit the `dist.ini` file.

requires "DateTime" => "0";
requires "Moose::Role" => "0";
requires "perl" => "5.010";

on 'build' => sub {
  requires "Module::Build" => "0.28";
};

on 'test' => sub {
  requires "File::Spec" => "0";
  requires "File::Temp" => "0";

lib/App/TimeTracker/Command/Billing.pm  view on Meta::CPAN

package App::TimeTracker::Command::Billing;

# ABSTRACT: Add a billing point as a tag to tasks
our $VERSION = '1.001'; # VERSION

use strict;
use warnings;
use 5.010;

use Moose::Role;
use DateTime;

sub munge_billing_start_attribs {
    my ( $class, $meta, $config ) = @_;
    my $billing = $config->{billing};
    my %attr    = (
        isa           => 'Str',
        is            => 'ro',
        documentation => 'Billing',
    );
    $attr{required} = 1 if $billing->{required};

    if ( my $default = $billing->{default} ) {
        if ( $default eq 'strftime' ) {
            my $format = $billing->{strftime};
            $attr{default} = sub {
                return DateTime->now->strftime($format);
            }
        }
    }

    $meta->add_attribute( 'billing' => \%attr );
}

after '_load_attribs_start'    => \&munge_billing_start_attribs;
after '_load_attribs_append'   => \&munge_billing_start_attribs;
after '_load_attribs_continue' => \&munge_billing_start_attribs;

lib/App/TimeTracker/Command/Billing.pm  view on Meta::CPAN

=head3 prefix

If set, add this prefix to the billing point when storing it as tag. Useful to discern regular tags from billing point pseudo tags.

=head3 default

Set to the method to calculate the default billing point. Currently there is only one method implemented, C<strftime>

=head3 strftime

When using C<default = strftime>, specify the L<DateTime::strftime> format. Some examples:

=over

=item * C<%Y/%m> -> 2019/12

=item * C<%Y/Q%{quarter}> -> 2019/Q4

=back

=head1 NEW COMMANDS



( run in 0.338 second using v1.01-cache-2.11-cpan-05444aca049 )