| 1 | package Dist::Zilla::Plugin::JSAN::InstallInstructions; | ||
| 2 | BEGIN { | ||
| 3 | $Dist::Zilla::Plugin::JSAN::InstallInstructions::VERSION = '0.06'; | ||
| 4 | } | ||
| 5 | |||
| 6 | # ABSTRACT: build an INSTALL file | ||
| 7 | |||
| 8 | use Moose; | ||
| 9 | |||
| 10 | use Dist::Zilla::File::InMemory; | ||
| 11 | |||
| 12 | use Data::Section 0.004 -setup; | ||
| 13 | |||
| 14 | with 'Dist::Zilla::Role::FileGatherer'; | ||
| 15 | with 'Dist::Zilla::Role::TextTemplate'; | ||
| 16 | |||
| 17 | |||
| 18 | has 'filename' => ( | ||
| 19 | is => 'rw', | ||
| 20 | isa => 'Str', | ||
| 21 | |||
| 22 | default => 'INSTALL' | ||
| 23 | ); | ||
| 24 | |||
| 25 | |||
| 26 | sub gather_files { | ||
| 27 | my ($self) = @_; | ||
| 28 | |||
| 29 | my $zilla = $self->zilla; | ||
| 30 | |||
| 31 | $self->add_file(Dist::Zilla::File::InMemory->new({ | ||
| 32 | name => $self->filename, | ||
| 33 | |||
| 34 | content => $self->fill_in_string(${$self->section_data('INSTALL')}, { | ||
| 35 | zilla => \$zilla, | ||
| 36 | dist => \$zilla, | ||
| 37 | plugin => \$self | ||
| 38 | }) | ||
| 39 | })); | ||
| 40 | } | ||
| 41 | |||
| 42 | |||
| 43 | sub dist_name { | ||
| 44 | my ($self) = @_; | ||
| 45 | |||
| 46 | my $name = $self->zilla->name; | ||
| 47 | |||
| 48 | $name =~ s/-/\./g; | ||
| 49 | |||
| 50 | return $name; | ||
| 51 | } | ||
| 52 | |||
| 53 | |||
| 54 | __PACKAGE__->meta->make_immutable; | ||
| 55 | no Moose; | ||
| 56 | |||
| 57 | |||
| 58 | 1; | ||
| 59 | |||
| 60 | |||
| 61 | |||
| 62 | |||
| 63 | |||
| 64 | =pod | ||
| 65 | |||
| 66 | =head1 NAME | ||
| 67 | |||
| 68 | Dist::Zilla::Plugin::JSAN::InstallInstructions - build an INSTALL file | ||
| 69 | |||
| 70 | =head1 VERSION | ||
| 71 | |||
| 72 | version 0.06 | ||
| 73 | |||
| 74 | =head1 SYNOPSIS | ||
| 75 | |||
| 76 | In your F<dist.ini>: | ||
| 77 | |||
| 78 | [JSAN::InstallInstructions] | ||
| 79 | filename = INSTALL; this is a default | ||
| 80 | |||
| 81 | =head1 DESCRIPTION | ||
| 82 | |||
| 83 | This plugin adds an F<INSTALL> file to the distribution, which describes the installation | ||
| 84 | process with `npm` | ||
| 85 | |||
| 86 | =head1 AUTHOR | ||
| 87 | |||
| 88 | Nickolay Platonov <nplatonov@cpan.org> | ||
| 89 | |||
| 90 | =head1 COPYRIGHT AND LICENSE | ||
| 91 | |||
| 92 | This software is copyright (c) 2011 by Nickolay Platonov. | ||
| 93 | |||
| 94 | This is free software; you can redistribute it and/or modify it under | ||
| 95 | the same terms as the Perl 5 programming language system itself. | ||
| 96 | |||
| 97 | =cut | ||
| 98 | |||
| 99 | |||
| 100 | __DATA__ |