« blib/lib/Dist/Zilla/Plugin/Author/KENTNL/DistINI.pm
↑ Summary
blib/lib/auto/share/module/Dist-Zilla-MintingProfile-Author-KENTNL/moo-role/skel/maint/perlcritic.rc.gen.pl »
| 1 | #!/usr/bin/env perl | ||
| 2 | ## no critic (Modules::RequireVersionVar) | ||
| 3 | |||
| 4 | # ABSTRACT: Write an INI file from a bundle | ||
| 5 | |||
| 6 | use 5.008; # utf8 | ||
| 7 | use strict; | ||
| 8 | use warnings; | ||
| 9 | use utf8; | ||
| 10 | |||
| 11 | our $VERSION = 0.001; | ||
| 12 | |||
| 13 | use Carp qw( croak carp ); | ||
| 14 | use Perl::Critic::ProfileCompiler::Util qw( create_bundle ); | ||
| 15 | use Path::Tiny qw(path); | ||
| 16 | |||
| 17 | ## no critic (ErrorHandling::RequireUseOfExceptions) | ||
| 18 | my $bundle = create_bundle('Example::Author::KENTNL'); | ||
| 19 | $bundle->configure; | ||
| 20 | |||
| 21 | my @stopwords = (qw()); | ||
| 22 | for my $wordlist (@stopwords) { | ||
| 23 | $bundle->add_or_append_policy_field( 'Documentation::PodSpelling' => ( 'stop_words' => $wordlist ) ); | ||
| 24 | } | ||
| 25 | |||
| 26 | #$bundle->add_or_append_policy_field( | ||
| 27 | # 'Subroutines::ProhibitCallsToUndeclaredSubs' => ( 'exempt_subs' => 'String::Formatter::str_rf' ), ); | ||
| 28 | |||
| 29 | #$bundle->remove_policy('ErrorHandling::RequireUseOfExceptions'); | ||
| 30 | #$bundle->remove_policy('CodeLayout::RequireUseUTF8'); | ||
| 31 | #$bundle->remove_policy('ErrorHandling::RequireCarping'); | ||
| 32 | #$bundle->remove_policy('NamingConventions::Capitalization'); | ||
| 33 | |||
| 34 | my $inf = $bundle->actionlist->get_inflated; | ||
| 35 | |||
| 36 | my $config = $inf->apply_config; | ||
| 37 | |||
| 38 | { | ||
| 39 | my $rcfile = path('./perlcritic.rc')->openw_utf8; | ||
| 40 | $rcfile->print( $config->as_ini, "\n" ); | ||
| 41 | close $rcfile or croak 'Something fubared closing perlcritic.rc'; | ||
| 42 | } | ||
| 43 | my $deps = $inf->own_deps; | ||
| 44 | { | ||
| 45 | my $target = path('./misc'); | ||
| 46 | $target->mkpath if not $target->is_dir; | ||
| 47 | |||
| 48 | my $depsfile = $target->child('perlcritic.deps')->openw_utf8; | ||
| 49 | for my $key ( sort keys %{$deps} ) { | ||
| 50 | $depsfile->printf( "%s~%s\n", $key, $deps->{$key} ); | ||
| 51 | *STDERR->printf( "%s => %s\n", $key, $deps->{$key} ); | ||
| 52 | } | ||
| 53 | close $depsfile or carp 'Something fubared closing perlcritic.deps'; | ||
| 54 | } | ||
| 55 |