« lib/Dist/Zilla/MintingProfile/CSJEWELL.pm
↑ Summary
lib/Dist/Zilla/Plugin/CSJEWELL/DotFileFix.pm »
| 1 | package Dist::Zilla::App::Command::configure_CSJEWELL; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 1 | ▶ | use 5.008003; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 1 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 1 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 1 | ▶ | use autodie; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Dist::Zilla::App -command; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Dist::Zilla::Util; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 1 | ▶ | use File::Spec; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | our $VERSION = '0.994'; | |||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||
| 14 | 0 | ▶ | sub abstract { ## no critic(ProhibitAmbiguousNames) | ||||||||||||||||||||||||||
|
Subroutine
abstract: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 15 | 0 | return q{configure the 'CSJEWELL' minting profile.}; | |||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub validate_args { | ||||||||||||||||||||||||||
|
Subroutine
validate_args: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||||||||||
| 19 | 0 | my ($self, undef, $args) = @_; | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 0 | ▶ | if (0 != @{$args}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 22 | 0 | $self->usage_error('Too many arguments'); | |||||||||||||||||||||||||||
| 23 | } | ||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | return; | |||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 0 | ▶ | sub execute { | ||||||||||||||||||||||||||
|
Subroutine
execute: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||
| 29 | 0 | my ($self, undef, undef) = @_; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | my $chrome = $self->app()->chrome(); | |||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | ## no critic(ProtectPrivateSubs) | ||||||||||||||||||||||||||||
| 34 | 0 | my $config_root = Dist::Zilla::Util->_global_config_root(); | |||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | ▶ | if ( not -d $config_root | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
-d $config_root and -f $config_root->child("config.ini")
MC/DC0%0/2
-d $config_root and -f $config_root->child("config.ini")
-d $config_root
-f $config_root->child("config.ini")
Truth table0%0/3
A and B
A= -d $config_rootB= -f $config_root->child("config.ini")
| |||||||||||||||||||||||||||||
| 37 | or not -f $config_root->child('config.ini')) | ||||||||||||||||||||||||||||
| 38 | { | ||||||||||||||||||||||||||||
| 39 | 0 | $chrome->logger()->log_fatal([ 'A per-user configuration file does not exist in %s', "$config_root", ]); | |||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 0 | return; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | my $homepage = $chrome->prompt_str( | ||||||||||||||||||||||||||||
| 45 | 'Where is your homepage?', | ||||||||||||||||||||||||||||
| 46 | 0 | ▶ | { check => sub { defined $_[0] and $_[0] =~ /\S/ms }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 47 | 0 | default => 'https://metacpan.org/author/USERNAME/', | |||||||||||||||||||||||||||
| 48 | }, | ||||||||||||||||||||||||||||
| 49 | ); | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | my $repo = $chrome->prompt_str( | ||||||||||||||||||||||||||||
| 52 | 'Where are your repositories?', | ||||||||||||||||||||||||||||
| 53 | 0 | ▶ | { check => sub { defined $_[0] and $_[0] =~ /\S/ms }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 0 | default => 'https://github.com/username/', | |||||||||||||||||||||||||||
| 55 | }, | ||||||||||||||||||||||||||||
| 56 | ); | ||||||||||||||||||||||||||||
| 57 | |||||||||||||||||||||||||||||
| 58 | 0 | open my $fh, '>>', $config_root->child('config.ini'); | |||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 0 | $fh->print("\n[%DefaultURLs]\n"); | |||||||||||||||||||||||||||
| 61 | 0 | $fh->print("homepage = $homepage\n"); | |||||||||||||||||||||||||||
| 62 | 0 | $fh->print("repository_location = $repo\n\n"); | |||||||||||||||||||||||||||
| 63 | |||||||||||||||||||||||||||||
| 64 | 0 | close $fh; | |||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 0 | $self->log('Added to config.ini file.'); | |||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||
| 68 | 0 | return; | |||||||||||||||||||||||||||
| 69 | } ## end sub execute | ||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||
| 71 | 1 | 1; | |||||||||||||||||||||||||||
| 72 | |||||||||||||||||||||||||||||
| 73 | __END__ | ||||||||||||||||||||||||||||