root/lang/perl/Acme-CPANAuthors-CodeRepos/trunk/bin/update.pl @ 12167

Revision 12167, 3.7 kB (checked in by charsbar, 5 years ago)

Acme-CPANAuthors-CodeRepos?: updated list

  • Property svn:eol-style set to native
Line 
1#!perl
2
3use strict;
4use warnings;
5use FindBin;
6use lib "$FindBin::Bin/../lib";
7use Web::Scraper;
8use URI;
9use YAML;
10use CPAN::Config;
11use Parse::CPAN::Authors;
12use Template;
13use Time::Piece;
14use Acme::CPANAuthors::CodeRepos;
15
16my %mapping = (
17  # people whose coderepos id is not the same as their pause id
18  AMACHANG    => 'ITWARRIOR',
19  AUTARCH     => 'DROLSKY',
20  CASTAWAY    => 'JROBINSON',
21  CHARSBAR    => 'ISHIGAKI',
22  CLOUDER     => 'KURIHARA',
23  DAISUKE     => 'DMAKI',
24  FBIS        => 'MIYAZAKI',
25  HANEKOMU    => 'MARCEL',
26  HIDEK       => 'HIDE',
27  HIROSE31    => 'HIROSE',
28  KAN         => 'MIKIHOSHI',
29  MARCUS      => 'MRAMBERG',
30  MATTHEWT    => 'MSTROUT',
31  MOSELEY     => 'HANK',
32  NIPOTAN     => 'TANIGUCHI',
33  NOTHINGMUCH => 'NUFFIN',
34  TAKEMARU    => 'TAKERU',
35  VKGTARO     => 'TARO',
36
37  # people whose coderepos id matches other person's pause id
38  BULB        => '- other person -',
39  DANN        => '- other person -',
40  OMEGA       => '- other person -',
41);
42
43my $command = shift; # from @ARGV
44
45my $committers;
46if ( $command && $command =~ /scraper/ ) {
47  my $scraper = scraper {
48    process "ul>li>a",
49      "committers[]" => sub {
50        my $e = shift;
51        return unless $e->attr('href') =~ m{/wiki/Committers/(\w+)$};
52        return uc $1;
53      };
54  };
55
56  $committers = $scraper->scrape(
57    URI->new('http://coderepos.org/share')
58  )->{committers};
59
60  YAML::DumpFile("$FindBin::Bin/coderepos_users.yml", $committers);
61}
62
63$committers ||= YAML::LoadFile("$FindBin::Bin/coderepos_users.yml");
64
65my $authors_file;
66foreach my $path (
67  File::Spec->catdir($CPAN::Config->{keep_source_where}, 'authors'),
68  $CPAN::Config->{keep_source_where},
69  ""
70) {
71  $authors_file = File::Spec->catfile( $path, '01mailrc.txt.gz' );
72  last if -f $authors_file;
73}
74
75my $cpan = Parse::CPAN::Authors->new( $authors_file );
76
77my %cpan_authors = Acme::CPANAuthors::CodeRepos->authors;
78foreach my $committer ( @{ $committers || [] } ) {
79  my $pause_id = $mapping{$committer} || $committer;
80
81  if ( my $author = $cpan->author($pause_id) ) {
82    $cpan_authors{ $pause_id } ||= $author->name;
83  }
84}
85
86my $target   = "$FindBin::Bin/../lib/Acme/CPANAuthors/CodeRepos.pm";
87my $engine   = Template->new;
88my $template = get_template();
89
90my $version = localtime(time)->strftime('0.%y%m%d');
91
92$engine->process(
93  \$template,
94  {
95    authors => \%cpan_authors,
96    version => $version,
97    mapping => \%mapping
98  },
99  $target,
100) or die $engine->error;
101
102sub get_template { return <<"TEMPLATE";
103package Acme::CPANAuthors::CodeRepos;
104
105use strict;
106use warnings;
107
108our \$VERSION = '[% version %]';
109
110# this is auto-generated by bin/update.pl
111
112use Acme::CPANAuthors::Register (
113[% FOREACH author IN authors -%]
114    [% author.key %] => '[% author.value %]',
115[% END -%]
116);
117
118# people whose coderepos id doesn't match their pause id
119sub _mapping {(
120[% FOREACH committer IN mapping -%]
121    [% committer.key %] => '[% committer.value %]',
122[% END -%]
123)}
124
1251;
126
127\__END__
128
129\=head1 NAME
130
131Acme::CPANAuthors::CodeRepos - We are CPAN authors using CodeRepos
132
133\=head1 DESCRIPTION
134
135This class provides a hash of Pause ID/name of CPAN authors who use CodeRepos, our open source repository.
136
137\=head1 MAINTENANCE
138
139If you are a CodeRepos user and are not listed here, add your own id/name, or preferably update bin/update.pl in the repository (probably modify %mapping would suffice).
140
141\=head1 SVN REPOSITORY
142
143http://svn.coderepos.org/share/lang/perl/Acme-CPANAuthors-CodeRepos/
144
145\=head1 AUTHOR
146
147Kenichi Ishigaki, E<lt>ishigaki\@cpan.orgE<gt>, and others in the CodeRepos repository.
148
149\=head1 COPYRIGHT AND LICENSE
150
151Copyright (C) 2008 by Kenichi Ishigaki.
152
153This program is free software; you can redistribute it and/or
154modify it under the same terms as Perl itself.
155
156\=cut
157TEMPLATE
158}
Note: See TracBrowser for help on using the browser.