« blib/lib/Code/TidyAll/Plugin/JSBeautify.pm
↑ Summary
blib/lib/Code/TidyAll/Plugin/PHPCodeSniffer.pm »
| 1 | package Code::TidyAll::Plugin::MasonTidy; | ||
| 2 | |||
| 3 | use strict; | ||
| 4 | use warnings; | ||
| 5 | |||
| 6 | use Mason::Tidy::App; | ||
| 7 | use Text::ParseWords qw(shellwords); | ||
| 8 | |||
| 9 | use Moo; | ||
| 10 | |||
| 11 | extends 'Code::TidyAll::Plugin'; | ||
| 12 | |||
| 13 | our $VERSION = '0.83'; | ||
| 14 | |||
| 15 | sub _build_cmd {'masontidy'} | ||
| 16 | |||
| 17 | sub transform_source { | ||
| 18 | my ( $self, $source ) = @_; | ||
| 19 | |||
| 20 | local @ARGV = shellwords( $self->argv ); | ||
| 21 | local $ENV{MASONTIDY_OPT}; | ||
| 22 | my $dest = Mason::Tidy::App->run($source); | ||
| 23 | return $dest; | ||
| 24 | } | ||
| 25 | |||
| 26 | 1; | ||
| 27 | |||
| 28 | # ABSTRACT: Use masontidy with tidyall | ||
| 29 | |||
| 30 | __END__ | ||
| 31 | |||
| 32 | =pod | ||
| 33 | |||
| 34 | =encoding UTF-8 | ||
| 35 | |||
| 36 | =head1 NAME | ||
| 37 | |||
| 38 | Code::TidyAll::Plugin::MasonTidy - Use masontidy with tidyall | ||
| 39 | |||
| 40 | =head1 VERSION | ||
| 41 | |||
| 42 | version 0.83 | ||
| 43 | |||
| 44 | =head1 SYNOPSIS | ||
| 45 | |||
| 46 | In configuration: | ||
| 47 | |||
| 48 | [MasonTidy] | ||
| 49 | select = comps/**/*.{mc,mi} | ||
| 50 | argv = --indent-perl-block 0 --perltidy-argv "-noll -l=78" | ||
| 51 | |||
| 52 | =head1 DESCRIPTION | ||
| 53 | |||
| 54 | Runs L<masontidy>, a tidier for L<HTML::Mason> and L<Mason 2|Mason> components. | ||
| 55 | |||
| 56 | =head1 INSTALLATION | ||
| 57 | |||
| 58 | Install L<masontidy> from CPAN. | ||
| 59 | |||
| 60 | cpanm masontidy | ||
| 61 | |||
| 62 | =head1 CONFIGURATION | ||
| 63 | |||
| 64 | This plugin accepts the following configuration options: | ||
| 65 | |||
| 66 | =head2 argv | ||
| 67 | |||
| 68 | Arguments to pass to C<masontidy>. | ||
| 69 | |||
| 70 | =head1 SUPPORT | ||
| 71 | |||
| 72 | Bugs may be submitted at L<https://github.com/houseabsolute/perl-code-tidyall/issues>. | ||
| 73 | |||
| 74 | =head1 SOURCE | ||
| 75 | |||
| 76 | The source code repository for Code-TidyAll can be found at L<https://github.com/houseabsolute/perl-code-tidyall>. | ||
| 77 | |||
| 78 | =head1 AUTHORS | ||
| 79 | |||
| 80 | =over 4 | ||
| 81 | |||
| 82 | =item * | ||
| 83 | |||
| 84 | Jonathan Swartz <swartz@pobox.com> | ||
| 85 | |||
| 86 | =item * | ||
| 87 | |||
| 88 | Dave Rolsky <autarch@urth.org> | ||
| 89 | |||
| 90 | =back | ||
| 91 | |||
| 92 | =head1 COPYRIGHT AND LICENSE | ||
| 93 | |||
| 94 | This software is copyright (c) 2011 - 2022 by Jonathan Swartz. | ||
| 95 | |||
| 96 | This is free software; you can redistribute it and/or modify it under | ||
| 97 | the same terms as the Perl 5 programming language system itself. | ||
| 98 | |||
| 99 | The full text of the license can be found in the | ||
| 100 | F<LICENSE> file included with this distribution. | ||
| 101 | |||
| 102 | =cut |