Skip to content

Commit

Permalink
Initial commit, greetings from Salt Lake City
Browse files Browse the repository at this point in the history
  • Loading branch information
kyzn committed Jun 19, 2018
0 parents commit d1ca4ab
Show file tree
Hide file tree
Showing 6 changed files with 362 additions and 0 deletions.
69 changes: 69 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# Created by https://www.gitignore.io/api/vim,perl,linux

### Linux ###
*~

# temporary files which can be created if a process still has a handle open of a deleted file
.fuse_hidden*

# KDE directory preferences
.directory

# Linux trash folder which might appear on any partition or disk
.Trash-*

# .nfs files are created when an open file is removed but is still being accessed
.nfs*

### Perl ###
!Build/
.last_cover_stats
/META.yml
/META.json
/MYMETA.*
*.o
*.pm.tdy
*.bs

# Devel::Cover
cover_db/

# Devel::NYTProf
nytprof.out

# Dizt::Zilla
/.build/

# Module::Build
_build/
Build
Build.bat

# Module::Install
inc/

# ExtUitls::MakeMaker
/blib/
/_eumm/
/*.gz
/Makefile
/Makefile.old
/MANIFEST.bak
/pm_to_blib
/*.zip

### Vim ###
# swap
.sw[a-p]
.*.sw[a-p]
# session
Session.vim
# temporary
.netrwhist
# auto-generated tag files
tags

# End of https://www.gitignore.io/api/vim,perl,linux

# Also exclude build folder/archive
Dist-Zilla-Plugin-ContributorCovenant*
2 changes: 2 additions & 0 deletions Changes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0.01 2018-06-19
- Initial release at TPC in Salt Lake City.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# NAME

Dist::Zilla::Plugin::ContributorCovenant - Add Contributor Covenant as Code of Conduct

# DESCRIPTION

`Dist::Zilla::Plugin::ContributorCovenant` adds the Contributor
Covenant to your CPAN build as `CODE_OF_CONDUCT.md`. It pulls
email address of first author from `dist.ini`. If none found,
it will type "GitHub / RT" instead.

# SYNOPSIS

Add this one line to your dist.ini.

[ContributorCovenant]

# AUTHOR

Kivanc Yazan `<kyzn at cpan.org>`

# COPYRIGHT AND LICENSE

This software is copyright (c) 2018 by Kivanc Yazan.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.

# ATTRIBUTION

\- This module is based heavily on [Dist::Zilla::Plugin::Covenant](https://metacpan.org/pod/Dist::Zilla::Plugin::Covenant).

\- Covenant text is taken from https://www.contributor-covenant.org/version/1/4/code-of-conduct.md.

# SEE ALSO

\- Contributor Covenant, https://www.contributor-covenant.org/

\- VM Brasseur's "The Importance of Ecosystem" Keynote, https://archive.org/details/yatpc2018-ecosystem
25 changes: 25 additions & 0 deletions dist.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name = Dist-Zilla-Plugin-ContributorCovenant
author = Kivanc Yazan <kyzn@cpan.org>
license = Perl_5
version = 0.01
copyright_holder = Kivanc Yazan

[@Filter]
-bundle = @Basic
-remove = Readme

[GithubMeta]
issues=1

[ReadmeFromPod]
type = markdown
[CopyFilesFromBuild]
copy = README.md

[PkgVersion]
[AutoPrereqs]
[MinimumPerl]
[MetaProvides::Package]
[MetaJSON]

[ContributorCovenant]
178 changes: 178 additions & 0 deletions lib/Dist/Zilla/Plugin/ContributorCovenant.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,178 @@
package Dist::Zilla::Plugin::ContributorCovenant;

=head1 NAME
Dist::Zilla::Plugin::ContributorCovenant - Add Contributor Covenant as Code of Conduct
=head1 DESCRIPTION
C<Dist::Zilla::Plugin::ContributorCovenant> adds the Contributor
Covenant to your CPAN build as C<CODE_OF_CONDUCT.md>. It pulls
email address of first author from C<dist.ini>. If none found,
it will type "GitHub / RT" instead.
=head1 SYNOPSIS
Add this one line to your dist.ini.
[ContributorCovenant]
=cut

use warnings;
use strict;

use Moose;
use Dist::Zilla::File::InMemory;

with qw/
Dist::Zilla::Role::Plugin
Dist::Zilla::Role::FileGatherer
Dist::Zilla::Role::TextTemplate
Dist::Zilla::Role::MetaProvider
/;

sub metadata {
return { 'x_contributor_covenant' => { 'version' => 0.01 } };
}

has '+zilla' => (
handles => { authors => 'authors' },
);

has contributor_covenant => (
is => 'ro',
lazy => 1,
default => sub {
my $self = shift;
my ($author, $email);

$author = $self->authors->[0];
($email) = $author =~ /<(.*)>/ if $author;
my $contact = $email || 'GitHub / RT';

$self->fill_in_string(contributor_covenant_template(),{
contact => $contact,
});
},
);

sub gather_files {
my $self = shift;
$self->add_file(
Dist::Zilla::File::InMemory->new({
content => $self->contributor_covenant,
name => 'CODE_OF_CONDUCT.md',
})
);
}

sub contributor_covenant_template {
return <<'END_TEMPLATE';
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as
contributors and maintainers pledge to making participation in our project and
our community a harassment-free experience for everyone, regardless of age, body
size, disability, ethnicity, gender identity and expression, level of experience,
education, socio-economic status, nationality, personal appearance, race,
religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment
include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or
advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic
address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a
professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable
behavior and are expected to take appropriate and fair corrective action in
response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or
reject comments, commits, code, wiki edits, issues, and other contributions
that are not aligned to this Code of Conduct, or to ban temporarily or
permanently any contributor for other behaviors that they deem inappropriate,
threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces
when an individual is representing the project or its community. Examples of
representing a project or community include using an official project e-mail
address, posting via an official social media account, or acting as an appointed
representative at an online or offline event. Representation of a project may be
further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported by contacting the project team at {{ $contact }}. All
complaints will be reviewed and investigated and will result in a response that
is deemed necessary and appropriate to the circumstances. The project team is
obligated to maintain confidentiality with regard to the reporter of an incident.
Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good
faith may face temporary or permanent repercussions as determined by other
members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
[homepage]: https://www.contributor-covenant.org
END_TEMPLATE
}

__PACKAGE__->meta->make_immutable;

1;

__END__
=head1 AUTHOR
Kivanc Yazan C<< <kyzn at cpan.org> >>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2018 by Kivanc Yazan.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=head1 ATTRIBUTION
- This module is based heavily on L<Dist::Zilla::Plugin::Covenant>.
- Covenant text is taken from https://www.contributor-covenant.org/version/1/4/code-of-conduct.md.
=head1 SEE ALSO
- Contributor Covenant, https://www.contributor-covenant.org/
- VM Brasseur's "The Importance of Ecosystem" Keynote, https://archive.org/details/yatpc2018-ecosystem
=cut
49 changes: 49 additions & 0 deletions t/basic.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
use strict;
use warnings;

use Test::More;
use Test::DZil;

my $cases = [
{
author => 'E. Xavier Ample <example@example.org>',
contact => 'example@example.org',
},
{
author => 'E. Xavier Ample',
contact => 'GitHub / RT',
},
# add more here
];

foreach my $case (@$cases){
my $author = $case->{author};
my $contact = $case->{contact};

my $dist_ini = dist_ini({
name => 'DZT-Sample',
abstract => 'Sample DZ Dist',
author => $author,
license => 'Perl_5',
version => '1.0.0',
copyright_holder => 'E. Xavier Ample',
}, qw/
GatherDir
FakeRelease
/, qw/
ContributorCovenant
/
);

my $tzil = Builder->from_config(
{ dist_root => 'corpus' },
{ add_files => { 'source/dist.ini' => $dist_ini } },
);
$tzil->build;

like $tzil->slurp_file('build/CODE_OF_CONDUCT.md'),
qr/$contact/,
"$contact exists in code of conduct";
}

done_testing;

0 comments on commit d1ca4ab

Please sign in to comment.