Dist-Zilla-Plugin-EmailNotify-0.004/0000775000175000017500000000000012641776716016574 5ustar sawyersawyerDist-Zilla-Plugin-EmailNotify-0.004/Makefile.PL0000644000175000017500000000255212641776716020550 0ustar sawyersawyer# This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v5.039. use strict; use warnings; use 5.008; use ExtUtils::MakeMaker; my %WriteMakefileArgs = ( "ABSTRACT" => "send an email on dist release", "AUTHOR" => "Sawyer X ", "CONFIGURE_REQUIRES" => { "ExtUtils::MakeMaker" => 0 }, "DISTNAME" => "Dist-Zilla-Plugin-EmailNotify", "LICENSE" => "mit", "MIN_PERL_VERSION" => "5.008", "NAME" => "Dist::Zilla::Plugin::EmailNotify", "PREREQ_PM" => { "Dist::Zilla" => 0, "Email::Stuffer" => 0, "IO::File" => 0, "Moose" => 0, "namespace::autoclean" => 0 }, "TEST_REQUIRES" => { "File::Spec" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Test::More" => 0 }, "VERSION" => "0.004", "test" => { "TESTS" => "t/*.t" } ); my %FallbackPrereqs = ( "Dist::Zilla" => 0, "Email::Stuffer" => 0, "File::Spec" => 0, "IO::File" => 0, "IO::Handle" => 0, "IPC::Open3" => 0, "Moose" => 0, "Test::More" => 0, "namespace::autoclean" => 0 ); unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) { delete $WriteMakefileArgs{TEST_REQUIRES}; delete $WriteMakefileArgs{BUILD_REQUIRES}; $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs; } delete $WriteMakefileArgs{CONFIGURE_REQUIRES} unless eval { ExtUtils::MakeMaker->VERSION(6.52) }; WriteMakefile(%WriteMakefileArgs); Dist-Zilla-Plugin-EmailNotify-0.004/t/0000775000175000017500000000000012641776716017037 5ustar sawyersawyerDist-Zilla-Plugin-EmailNotify-0.004/t/release-pod-syntax.t0000644000175000017500000000045612641776716022753 0ustar sawyersawyer#!perl BEGIN { unless ($ENV{RELEASE_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for release candidate testing'); } } # This file was automatically generated by Dist::Zilla::Plugin::PodSyntaxTests. use Test::More; use Test::Pod 1.41; all_pod_files_ok(); Dist-Zilla-Plugin-EmailNotify-0.004/t/author-critic.t0000644000175000017500000000066612641776716022007 0ustar sawyersawyer#!perl BEGIN { unless ($ENV{AUTHOR_TESTING}) { require Test::More; Test::More::plan(skip_all => 'these tests are for testing by the author'); } } use strict; use warnings; use Test::More; use English qw(-no_match_vars); eval "use Test::Perl::Critic"; plan skip_all => 'Test::Perl::Critic required to criticise code' if $@; Test::Perl::Critic->import( -profile => "perlcritic.rc" ) if -e "perlcritic.rc"; all_critic_ok(); Dist-Zilla-Plugin-EmailNotify-0.004/t/00-compile.t0000644000175000017500000000235212641776716021071 0ustar sawyersawyeruse 5.006; use strict; use warnings; # this test was generated with Dist::Zilla::Plugin::Test::Compile 2.054 use Test::More; plan tests => 1 + ($ENV{AUTHOR_TESTING} ? 1 : 0); my @module_files = ( 'Dist/Zilla/Plugin/EmailNotify.pm' ); # no fake home requested my $inc_switch = -d 'blib' ? '-Mblib' : '-Ilib'; use File::Spec; use IPC::Open3; use IO::Handle; open my $stdin, '<', File::Spec->devnull or die "can't open devnull: $!"; my @warnings; for my $lib (@module_files) { # see L my $stderr = IO::Handle->new; my $pid = open3($stdin, '>&STDERR', $stderr, $^X, $inc_switch, '-e', "require q[$lib]"); binmode $stderr, ':crlf' if $^O eq 'MSWin32'; my @_warnings = <$stderr>; waitpid($pid, 0); is($?, 0, "$lib loaded ok"); shift @_warnings if @_warnings and $_warnings[0] =~ /^Using .*\bblib/ and not eval { require blib; blib->VERSION('1.01') }; if (@_warnings) { warn @_warnings; push @warnings, @_warnings; } } is(scalar(@warnings), 0, 'no warnings found') or diag 'got warnings: ', ( Test::More->can('explain') ? Test::More::explain(\@warnings) : join("\n", '', @warnings) ) if $ENV{AUTHOR_TESTING}; Dist-Zilla-Plugin-EmailNotify-0.004/LICENSE0000644000175000017500000000220312641776716017574 0ustar sawyersawyerThis software is Copyright (c) 2016 by Sawyer X. This is free software, licensed under: The MIT (X11) License The MIT License Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Dist-Zilla-Plugin-EmailNotify-0.004/META.json0000644000175000017500000000273312641776716020220 0ustar sawyersawyer{ "abstract" : "send an email on dist release", "author" : [ "Sawyer X " ], "dynamic_config" : 0, "generated_by" : "Dist::Zilla version 5.039, CPAN::Meta::Converter version 2.142690", "license" : [ "mit" ], "meta-spec" : { "url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec", "version" : "2" }, "name" : "Dist-Zilla-Plugin-EmailNotify", "prereqs" : { "configure" : { "requires" : { "ExtUtils::MakeMaker" : "0" } }, "develop" : { "requires" : { "Test::Pod" : "1.41" } }, "runtime" : { "requires" : { "Dist::Zilla" : "0", "Email::Stuffer" : "0", "IO::File" : "0", "Moose" : "0", "namespace::autoclean" : "0", "perl" : "5.008" } }, "test" : { "requires" : { "File::Spec" : "0", "IO::Handle" : "0", "IPC::Open3" : "0", "Test::More" : "0" } } }, "release_status" : "stable", "resources" : { "bugtracker" : { "web" : "https://github.com/xsawyerx/dist-zilla-plugin-emailnotify.git" }, "repository" : { "type" : "git", "url" : "git://github.com/xsawyerx/dist-zilla-plugin-emailnotify.git", "web" : "https://github.com/xsawyerx/dist-zilla-plugin-emailnotify" } }, "version" : "0.004" } Dist-Zilla-Plugin-EmailNotify-0.004/META.yml0000644000175000017500000000134412641776716020045 0ustar sawyersawyer--- abstract: 'send an email on dist release' author: - 'Sawyer X ' build_requires: File::Spec: 0 IO::Handle: 0 IPC::Open3: 0 Test::More: 0 configure_requires: ExtUtils::MakeMaker: 0 dynamic_config: 0 generated_by: 'Dist::Zilla version 5.039, CPAN::Meta::Converter version 2.142690' license: mit meta-spec: url: http://module-build.sourceforge.net/META-spec-v1.4.html version: 1.4 name: Dist-Zilla-Plugin-EmailNotify requires: Dist::Zilla: 0 Email::Stuffer: 0 IO::File: 0 Moose: 0 namespace::autoclean: 0 perl: 5.008 resources: bugtracker: https://github.com/xsawyerx/dist-zilla-plugin-emailnotify.git repository: git://github.com/xsawyerx/dist-zilla-plugin-emailnotify.git version: 0.004 Dist-Zilla-Plugin-EmailNotify-0.004/dist.ini0000644000175000017500000000132512641776716020237 0ustar sawyersawyername = Dist-Zilla-Plugin-EmailNotify author = Sawyer X license = MIT copyright_holder = Sawyer X copyright_year = 2016 version = 0.004 [@Basic] [PodSyntaxTests] [Test::Perl::Critic] [Test::Compile] [Prereqs] Dist::Zilla = 0 Moose = 0 Email::Stuffer = 0 IO::File = 0 namespace::autoclean = 0 [MinimumPerlFast] [PodWeaver] [ReadmeFromPod] [CheckChangeLog] [PkgVersion] [MetaJSON] [MetaResources] bugtracker.web = https://github.com/xsawyerx/dist-zilla-plugin-emailnotify.git repository.url = git://github.com/xsawyerx/dist-zilla-plugin-emailnotify.git repository.web = https://github.com/xsawyerx/dist-zilla-plugin-emailnotify repository.type = git Dist-Zilla-Plugin-EmailNotify-0.004/Changes0000644000175000017500000000117512641776716020071 0ustar sawyersawyer0.004 02.01.15 * Use the correct way of retrieving distribution metadata. (Thanks, Karen Etheridge!) * Declare appropriate bugtracker. (Thanks, Karen Etheridge!) * Improved grammar. (Thanks, Gregor Herrmann and Debian packagers!) * Remove Module::Build as an installer. (Thanks, Karen Etheridge!) * Move license to MIT. 0.003 07.02.15 * Provide more information (last log entry, authors, etc.) (Dominique Dumont - great job!) 0.002 13.07.11 * Some POD cleanups, no functional changes. 0.001 12.07.11 * It works! Dist-Zilla-Plugin-EmailNotify-0.004/lib/0000775000175000017500000000000012641776716017342 5ustar sawyersawyerDist-Zilla-Plugin-EmailNotify-0.004/lib/Dist/0000775000175000017500000000000012641776716020245 5ustar sawyersawyerDist-Zilla-Plugin-EmailNotify-0.004/lib/Dist/Zilla/0000775000175000017500000000000012641776716021320 5ustar sawyersawyerDist-Zilla-Plugin-EmailNotify-0.004/lib/Dist/Zilla/Plugin/0000775000175000017500000000000012641776716022556 5ustar sawyersawyerDist-Zilla-Plugin-EmailNotify-0.004/lib/Dist/Zilla/Plugin/EmailNotify.pm0000644000175000017500000001206712641776716025340 0ustar sawyersawyeruse strict; use warnings; package Dist::Zilla::Plugin::EmailNotify; # ABSTRACT: send an email on dist release $Dist::Zilla::Plugin::EmailNotify::VERSION = '0.004'; use Moose; with 'Dist::Zilla::Role::AfterRelease'; use Email::Stuffer; use IO::File; use namespace::autoclean; has to => ( is => 'ro', isa => 'Str', lazy_build => 1, ); has recipient => ( is => 'ro', isa => 'ArrayRef[Str]', predicate => 'has_recipient', ); has from => ( is => 'ro', isa => 'Str', required => 1, ); has cc => ( is => 'ro', isa => 'ArrayRef[Str]', default => sub { [] }, ); has bcc => ( is => 'ro', isa => 'ArrayRef[Str]', default => sub { [] }, ); has change_file => ( is => 'ro', isa => 'Str', default => 'Changes', ); sub mvp_multivalue_args { qw/recipient cc bcc/ } sub _build_to { my $self = shift; $self->has_recipient or die "Must provide 'recipient' or 'to'\n"; return join ', ', @{ $self->recipient }; } sub after_release { my $self = shift; my $archive = shift; my $name = $self->zilla->name; my $to = $self->to; my $from = $self->from; my $cc = join ', ', @{ $self->cc }; my $bcc = join ', ', @{ $self->bcc }; $name =~ s/\.tar\.gz$//; my $v = $self->zilla->version; # skip mail for developer's version if ($v =~ /_/) { $self->log("No e-mail sent for a developer release") ; return 1 ; } my @body ; push @body, "New version $v of $name is available with the following changes:"; push @body, '', $self->extract_last_release($self->change_file); my $res = $self->zilla->distmeta || die "internal error"; my $repo = $res->{repository} ; push @body,'', "Homepage: ".$res->{homepage} if $res->{homepage} ; push @body,"Repository: ".$repo->{web} if $repo->{web}; push @body,'', "Authors:", map { " - $_"} @{ $self->zilla->authors }; my $text_body = join("\n",@body); $self->log($text_body); my $email = Email::Stuffer->subject("$name $v released!") ->from($from) ->to($to) ->text_body($text_body); $cc and $email->cc($cc); $bcc and $email->bcc($bcc); $self->log("Sending release email to $to") ; return $email->send; } sub extract_last_release { my $self = shift; my $file = shift; my $fh = IO::File->new; $fh->open($file, 'r') ; my $preamble = ''; while (my $l = $fh->getline ) { last if $l =~ /^\w/ ; # first release line, preamble is done $preamble .= $l; } ; my @changes ; while (my $l = $fh->getline ) { chomp $l; if ($l =~ /^\s/ or $l =~ /^$/) { # not at a release line push @changes, $l; } elsif (join('',@changes) =~ /\w/ and $l =~ /^[\d\.]+\s+/) { # quit if I have change info and a release last; }; } ; $fh->close; # remove empty line from beginning and end of change lines shift @changes while not $changes[0] ; pop @changes while not $changes[-1]; return @changes; } __PACKAGE__->meta->make_immutable; no Moose; 1; __END__ =pod =encoding UTF-8 =head1 NAME Dist::Zilla::Plugin::EmailNotify - send an email on dist release =head1 VERSION version 0.004 =head1 DESCRIPTION This plugin allows one to send an email when releasing. =head1 FIELDS =head2 from Who is sending the email? [EmailNotify] from = xsawyerx@cpan.org =head2 recipient Multiple single recipients. These will compose the 'to' field. [EmailNotify] recipient = jack@myemail.com recipient = jill@myemail.com =head2 to Direct recipients string. This should be comma separated. [EmailNotify] to = jack@myemail.com, jill@myemail.com =head2 cc Any CC you may want. This should be comma separated. [EmailNotify] cc = myboss@myemail.com, jacksboss@myemail.com =head2 bcc Any BCC you may want. This should be comma separated. [EmailNotify] bcc = topgun@myemail.com =head1 ATTRIBUTES =head2 to(Str) The 'to' email field. =head2 recipient(ArrayRef[Str]) This array reference of strings will be used to compose the 'to' email field. It is used in case you want to comfortably write down the recipients instead of one long string. This is not provided for other fields. =head2 from(Str) The 'from' email field. =head2 cc(Str) The 'cc' email field. =head2 bcc(Str) The 'bcc' email field. =head1 METHODS/SUBROUTINES =head2 after_release Method to actually send the email right after the 'release' process. Takes all the arguments, creates a body message text using last change log entry and sends the email using L. =head2 _build_to Builder to take all the recipient attribute values and create a single string. =head2 mvp_multivalue_args Internal, L related. Creates a multivalue argument. =head1 AUTHOR Sawyer X =head1 COPYRIGHT AND LICENSE This software is Copyright (c) 2016 by Sawyer X. This is free software, licensed under: The MIT (X11) License =cut Dist-Zilla-Plugin-EmailNotify-0.004/MANIFEST0000644000175000017500000000036612641776716017730 0ustar sawyersawyer# This file was automatically generated by Dist::Zilla::Plugin::Manifest v5.039. Changes LICENSE MANIFEST META.json META.yml Makefile.PL README dist.ini lib/Dist/Zilla/Plugin/EmailNotify.pm t/00-compile.t t/author-critic.t t/release-pod-syntax.t Dist-Zilla-Plugin-EmailNotify-0.004/README0000644000175000017500000000311012641776716017445 0ustar sawyersawyerDESCRIPTION This plugin allows one to send an email when releasing. FIELDS from Who is sending the email? [EmailNotify] from = xsawyerx@cpan.org recipient Multiple single recipients. These will compose the 'to' field. [EmailNotify] recipient = jack@myemail.com recipient = jill@myemail.com to Direct recipients string. This should be comma separated. [EmailNotify] to = jack@myemail.com, jill@myemail.com cc Any CC you may want. This should be comma separated. [EmailNotify] cc = myboss@myemail.com, jacksboss@myemail.com bcc Any BCC you may want. This should be comma separated. [EmailNotify] bcc = topgun@myemail.com ATTRIBUTES to(Str) The 'to' email field. recipient(ArrayRef[Str]) This array reference of strings will be used to compose the 'to' email field. It is used in case you want to comfortably write down the recipients instead of one long string. This is not provided for other fields. from(Str) The 'from' email field. cc(Str) The 'cc' email field. bcc(Str) The 'bcc' email field. METHODS/SUBROUTINES after_release Method to actually send the email right after the 'release' process. Takes all the arguments, creates a body message text using last change log entry and sends the email using Email::Stuff. _build_to Builder to take all the recipient attribute values and create a single string. mvp_multivalue_args Internal, Config::MVP related. Creates a multivalue argument.