use 5.14.0;
use strict;
use warnings;
package Dist::Iller::Config::Author::CSSON;
# ABSTRACT: Dist::Iller config
our $AUTHORITY = 'cpan:CSSON'; # AUTHORITY
our $VERSION = '0.0328';
use Moose;
use namespace::autoclean;
use Path::Tiny;
use Types::Path::Tiny qw/Path/;
use Types::Standard qw/Bool Str Int/;
use MooseX::AttributeDocumented;
has filepath => (
is => 'ro',
isa => Path,
default => 'author-csson.yaml',
coerce => 1,
documentation => q{Path to the plugin configuration file, relative to the installed share dir location.},
);
has is_task => (
is => 'ro',
isa => Bool,
default => 0,
documentation => q{If set to a true value it will include [TaskWeaver] instead of [PodWeaver].},
);
has installer => (
is => 'rw',
isa => Str,
lazy => 1,
default => 'MakeMaker',
documentation => q{The installer plugin to be used.},
);
has is_private => (
is => 'rw',
isa => Int,
lazy => 1,
default => 0,
documentation_alts => {
0 => q{Include [UploadToCPAN] and [GithubMeta].},
1 => q{Include [UploadToStratopan].},
}
);
has homepage => (
is => 'rw',
isa => Str,
lazy => 1,
default => sub {
my $self = shift;
my $distribution_name = $self->global && $self->global->has_distribution_name ? $self->global->distribution_name
: $self->has_distribution_name ? $self->distribution_name
: undef
;
return $distribution_name ? sprintf 'https://metacpan.org/release/%s', $distribution_name : undef;
},
documentation_default => q{https://metacpan.org/release/[distribution_name]},
documentation => q{URL to the distribution's homepage.},
);
has splint => (
is => 'rw',
isa => Int,
default => 0,
documentation_alts => {
0 => q{Exclude Pod::Elemental::Transformer::Splint from weaver.ini},
1 => q{Include Pod::Elemental::Transformer::Splint in weaver.ini},
}
);
has badges => (
is => 'ro',
isa => Bool,
default => 1,
documentation => 'Include Badge::Depot badges or not.',
);
has travis => (
is => 'rw',
isa => Int,
default => 0,
documentation_order => 100,
documentation_alts => {
0 => q{Exclude [TravisYML].},
1 => q{Include [TravisYML].},
},
);
has travis_perl_min => (
is => 'ro',
isa => Int,
lazy => 1,
default => '14',
documentation_order => 101,
documentation => q{Minimum Perl version to test on Travis. All production releases up to (and including) 'travis_perl_max' are automatically included. Only give the minor version number (eg '14' for Perl 5.14).},
);
has travis_perl_max => (
is => 'ro',
isa => Int,
lazy => 1,
default => '24',
documentation_order => 102,
documentation => q{Maximum Perl version to test on Travis. See 'travis_perl_min'.}
);
with 'Dist::Iller::Config';
sub build_file {
my $self = shift;
return $self->installer =~ m/MakeMaker/ ? 'Makefile.PL' : 'Build.PL';
}
sub is_private_release {
my $self = shift;
return !$ENV{'FAKE_RELEASE'} && $self->is_private ? 1 : 0;
}
sub is_cpan_release {
my $self = shift;
return $ENV{'FAKE_RELEASE'} || $self->is_private ? 0 : 1;
}
sub add_default_github {
my $self = shift;
# check git config
my $add_default_github = 0;
my $git_config = path('.git/config');
if($git_config->exists) {
my $git_config_contents = $git_config->slurp_utf8;
if($git_config_contents =~ m{github\.com:([^/]+)/(.+)\.git}) {
$add_default_github = 1;
}
else {
say ('[DI/@Author::CSSON] No github url found');
}
}
return $add_default_github;
}
sub travis_perl {
my $self = shift;
return join ' ' => map { "5.$_" } grep { $_ >= $self->travis_perl_min && $_ <= $self->travis_perl_max } qw/6 8 10 12 14 16 18 20 22 24/;
}
__PACKAGE__->meta->make_immutable;
1;
__END__
=pod
=encoding UTF-8
=head1 NAME
Dist::Iller::Config::Author::CSSON - Dist::Iller config
=begin html
=end html
=head1 VERSION
Version 0.0328, released 2020-12-28.
=head1 SYNOPSIS
# in iller.yaml
+config: Author::CSSON
splint: 1
=head1 DESCRIPTION
Dist::Iller::Config::Author::Csson is a L configuration. The plugin list is in C.
=head1 ATTRIBUTES
=head2 travis
=begin HTML
Int |
optional, default: 0 |
read/write |
0 : |
Exclude [TravisYML]. |
|
|
|
1 : |
Include [TravisYML]. |
=end HTML
=begin markdown
Int |
optional, default: 0 |
read/write |
1 : |
Include [TravisYML]. |
=end markdown
=head2 travis_perl_min
=begin HTML
Int |
optional, default: 14 |
read-only |
Minimum Perl version to test on Travis. All production releases up to (and including) 'travis_perl_max' are automatically included. Only give the minor version number (eg '14' for Perl 5.14).
=end HTML
=begin markdown
Int |
optional, default: 14 |
read-only |
Minimum Perl version to test on Travis. All production releases up to (and including) 'travis_perl_max' are automatically included. Only give the minor version number (eg '14' for Perl 5.14).
=end markdown
=head2 travis_perl_max
=begin HTML
Int |
optional, default: 24 |
read-only |
Maximum Perl version to test on Travis. See 'travis_perl_min'.
=end HTML
=begin markdown
Int |
optional, default: 24 |
read-only |
Maximum Perl version to test on Travis. See 'travis_perl_min'.
=end markdown
=head2 badges
=begin HTML
Bool |
optional, default: 1 |
read-only |
Include Badge::Depot badges or not.
=end HTML
=begin markdown
Bool |
optional, default: 1 |
read-only |
Include Badge::Depot badges or not.
=end markdown
=head2 filepath
=begin HTML
Path |
optional, default: author-csson.yaml |
read-only |
Path to the plugin configuration file, relative to the installed share dir location.
=end HTML
=begin markdown
Path |
optional, default: author-csson.yaml |
read-only |
Path to the plugin configuration file, relative to the installed share dir location.
=end markdown
=head2 homepage
=begin HTML
Str |
optional, default: https://metacpan.org/release/[distribution_name] |
read/write |
URL to the distribution's homepage.
=end HTML
=begin markdown
Str |
optional, default: https://metacpan.org/release/[distribution_name] |
read/write |
URL to the distribution's homepage.
=end markdown
=head2 installer
=begin HTML
Str |
optional, default: MakeMaker |
read/write |
The installer plugin to be used.
=end HTML
=begin markdown
Str |
optional, default: MakeMaker |
read/write |
The installer plugin to be used.
=end markdown
=head2 is_private
=begin HTML
Int |
optional, default: 0 |
read/write |
0 : |
Include [UploadToCPAN] and [GithubMeta]. |
|
|
|
1 : |
Include [UploadToStratopan]. |
=end HTML
=begin markdown
Int |
optional, default: 0 |
read/write |
1 : |
Include [UploadToStratopan]. |
=end markdown
=head2 is_task
=begin HTML
Bool |
optional, default: 0 |
read-only |
If set to a true value it will include [TaskWeaver] instead of [PodWeaver].
=end HTML
=begin markdown
Bool |
optional, default: 0 |
read-only |
If set to a true value it will include [TaskWeaver] instead of [PodWeaver].
=end markdown
=head2 main_module
=begin HTML
Str |
optional, default: The package name |
read-only |
Override this attribute when there's more than one config in a distribution. It uses the main_module's sharedir location for the config files.
=end HTML
=begin markdown
Str |
optional, default: The package name |
read-only |
Override this attribute when there's more than one config in a distribution. It uses the main_module's sharedir location for the config files.
=end markdown
=head2 splint
=begin HTML
Int |
optional, default: 0 |
read/write |
0 : |
Exclude Pod::Elemental::Transformer::Splint from weaver.ini |
|
|
|
1 : |
Include Pod::Elemental::Transformer::Splint in weaver.ini |
=end HTML
=begin markdown
Int |
optional, default: 0 |
read/write |
1 : |
Include Pod::Elemental::Transformer::Splint in weaver.ini |
=end markdown
=head2 global
=begin HTML
Maybe[InstanceOf['Dist::Iller::DocType::Global']] |
optional |
read-only |
=end HTML
=begin markdown
Maybe[InstanceOf['Dist::Iller::DocType::Global']] |
optional |
read-only |
=end markdown
=head1 ENVIRONMENT VARIABLES
=head2 FAKE_RELEASE
If set to a true value this will include [FakeRelease] and remove either [UploadToCPAN] or [UploadToStratopan].
=head1 SOURCE
L
=head1 HOMEPAGE
L
=head1 AUTHOR
Erik Carlsson
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Erik Carlsson.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut