Commit | Line | Data |
e74d6d9c |
1 | use strict; |
2 | use warnings; |
3 | package Dist::Zilla::Plugin::Oyster::Helper; |
4 | BEGIN { |
5 | our $VERSION = 0.01;# VERSION |
6 | } |
7 | use Moose; |
8 | use Dist::Zilla::File::InMemory; |
9 | |
10 | extends 'Catalyst::Helper'; |
11 | |
12 | has _zilla_gatherer => ( |
13 | is => 'ro', |
14 | required => 1, |
15 | handles => { |
16 | _zilla_add_file => 'add_file', |
17 | }, |
18 | ); |
19 | |
20 | # we don't want these to do anything |
21 | sub _mk_changes {}; |
22 | sub _mk_makefile {}; |
23 | sub _mk_readme {}; |
24 | sub _mk_apptest {}; |
25 | sub _mk_podtest {}; |
26 | sub _mk_podcoveragetest {}; |
27 | |
28 | sub mk_file { |
29 | my ( $self, $file_obj , $output ) = @_; |
30 | |
31 | # unfortunately the stringified $file_obj includes a prepended |
32 | # {dist_repo} name which dzil already creates if we don't regex it out we |
33 | # end up with {dist_repo}/{dist_repo}/{files} instead of just |
34 | # {dist_repo}/{files} |
35 | my $name = "$file_obj"; |
36 | $name =~ s{[\w-]+/}{}; |
37 | |
38 | my $file |
39 | = Dist::Zilla::File::InMemory->new({ |
40 | name => $name, |
41 | content => $output, |
42 | }); |
43 | |
44 | $file->mode( oct(755) ) if $file->name =~ /script/; |
45 | |
46 | $self->_zilla_add_file($file); |
47 | } |
48 | __PACKAGE__->meta->make_immutable; |
49 | no Moose; |
50 | 1; |
51 | # ABSTRACT: a subclass of Catalyst::Helper |
52 | |
53 | |
54 | __END__ |
55 | =pod |
56 | |
57 | =head1 NAME |
58 | |
59 | Dist::Zilla::Plugin::Oyster::Helper - a subclass of Catalyst::Helper |
60 | |
61 | =head1 VERSION |
62 | |
63 | version 0.07 |
64 | |
65 | =head1 DESCRIPTION |
66 | |
67 | this is used to override methods in L<Catalyst::Helper> so that it works |
68 | better with dzil. |
69 | |
70 | =head1 AUTHORS |
71 | |
72 | =over 4 |
73 | |
74 | =item * |
75 | |
76 | CONTRIBUTORS TODO (note, based on xenoterracide & t0m's work) |
77 | |
78 | =back |
79 | |
80 | =head1 COPYRIGHT AND LICENSE |
81 | |
82 | TODO |
83 | |
84 | This is free software, licensed under: |
85 | |
86 | The Artistic License 2.0 |
87 | |
88 | =cut |
89 | |