Skip to content

Commit

Permalink
Merge pull request #12 from CPAN-API/fixes
Browse files Browse the repository at this point in the history
A handful of fixes for consistency
  • Loading branch information
oalders committed Oct 21, 2015
2 parents 2dc30d2 + 57015d2 commit 0c2e01a
Show file tree
Hide file tree
Showing 8 changed files with 88 additions and 146 deletions.
19 changes: 19 additions & 0 deletions README.mkdn
@@ -0,0 +1,19 @@
# Github Meets CPAN

[github-meets-cpan](http://gh.metacpan.org/)

This project connects Github Users to MetaCPAN Users. It uses the
APIs of both sites: First it fetches all users from [MetaCPAN][metacpan] who
have set their Github account. After that it fetches all public
information about these users from Github.

It uses [MongoDB][mongo] for storing the data.
The software is written in Perl using the [Mojolicious][mojo] framework.
The app was originally deployed to dotCloud, but is now hosted on metacpan servers.

It's some sort of an index of CPAN authors and their Github
accounts.

[mojo]: http://mojolicious.org/
[metacpan]: https://metacpan.org/
[mongo]: http://www.mongodb.org/
40 changes: 0 additions & 40 deletions README.pod

This file was deleted.

7 changes: 3 additions & 4 deletions cpanfile
@@ -1,12 +1,11 @@
requires 'Plack::Handler::Starman';
requires 'File::Slurp';
requires 'Data::Printer';
requires 'JSON::Any';
requires 'JSON::XS';
requires 'JSON::MaybeXS';
requires 'LWP::ConsoleLogger';
requires 'Mojolicious';
requires 'Mojolicious::Plugin::Mongodb';
requires 'Pithub';
requires 'Path::Tiny';
requires 'Pithub', '0.01030';
requires 'Plack';
requires 'Plack::Middleware::DebugLogging';
requires 'WWW::Mechanize';
148 changes: 56 additions & 92 deletions cpanfile.snapshot
Expand Up @@ -224,6 +224,14 @@ DISTRIBUTIONS
base 0
strict 0
warnings 0
Cpanel-JSON-XS-3.0115
pathname: R/RU/RURBAN/Cpanel-JSON-XS-3.0115.tar.gz
provides:
Cpanel::JSON::XS 3.0115
requirements:
ExtUtils::MakeMaker 0
Pod::Text 2.08
Pod::Usage 1.33
Crypt-URandom-0.34
pathname: D/DD/DDICK/Crypt-URandom-0.34.tar.gz
provides:
Expand Down Expand Up @@ -1502,17 +1510,6 @@ DISTRIBUTIONS
ExtUtils::MakeMaker 6.11
File::Spec 0
IO::Dir 0
File-Slurp-9999.19
pathname: U/UR/URI/File-Slurp-9999.19.tar.gz
provides:
File::Slurp 9999.19
FileSlurp_12 9999.13
requirements:
Carp 0
Exporter 0
ExtUtils::MakeMaker 0
Fcntl 0
POSIX 0
File-Which-1.09
pathname: A/AD/ADAMK/File-Which-1.09.tar.gz
provides:
Expand Down Expand Up @@ -1817,38 +1814,20 @@ DISTRIBUTIONS
requirements:
ExtUtils::MakeMaker 0
Test::More 0
JSON-Any-1.38
pathname: E/ET/ETHER/JSON-Any-1.38.tar.gz
provides:
JSON::Any 1.38
requirements:
Carp 0
ExtUtils::MakeMaker 0
constant 0
namespace::clean 0
strict 0
warnings 0
JSON-MaybeXS-1.003003
pathname: E/ET/ETHER/JSON-MaybeXS-1.003003.tar.gz
provides:
JSON::MaybeXS 1.003003
requirements:
Carp 0
Cpanel::JSON::XS 2.3310
ExtUtils::CBuilder 0.27
ExtUtils::MakeMaker 0
File::Spec 0
File::Temp 0
JSON::PP 2.27202
Scalar::Util 0
perl 5.006
JSON-XS-3.01
pathname: M/ML/MLEHMANN/JSON-XS-3.01.tar.gz
provides:
JSON::XS 3.01
requirements:
ExtUtils::MakeMaker 0
Types::Serialiser 0
common::sense 0
LWP-ConsoleLogger-0.000013
pathname: O/OA/OALDERS/LWP-ConsoleLogger-0.000013.tar.gz
provides:
Expand Down Expand Up @@ -3014,53 +2993,54 @@ DISTRIBUTIONS
perl 5.008001
strict 0
warnings 0
Pithub-0.01028
pathname: M/MS/MSCHWERN/Pithub-0.01028.tar.gz
provides:
Pithub 0.01028
Pithub::Base 0.01028
Pithub::Events 0.01028
Pithub::Gists 0.01028
Pithub::Gists::Comments 0.01028
Pithub::GitData 0.01028
Pithub::GitData::Blobs 0.01028
Pithub::GitData::Commits 0.01028
Pithub::GitData::References 0.01028
Pithub::GitData::Tags 0.01028
Pithub::GitData::Trees 0.01028
Pithub::Issues 0.01028
Pithub::Issues::Assignees 0.01028
Pithub::Issues::Comments 0.01028
Pithub::Issues::Events 0.01028
Pithub::Issues::Labels 0.01028
Pithub::Issues::Milestones 0.01028
Pithub::Orgs 0.01028
Pithub::Orgs::Members 0.01028
Pithub::Orgs::Teams 0.01028
Pithub::PullRequests 0.01028
Pithub::PullRequests::Comments 0.01028
Pithub::Repos 0.01028
Pithub::Repos::Collaborators 0.01028
Pithub::Repos::Commits 0.01028
Pithub::Repos::Contents 0.01028
Pithub::Repos::Downloads 0.01028
Pithub::Repos::Forks 0.01028
Pithub::Repos::Hooks 0.01028
Pithub::Repos::Keys 0.01028
Pithub::Repos::Releases 0.01028
Pithub::Repos::Releases::Assets 0.01028
Pithub::Repos::Starring 0.01028
Pithub::Repos::Stats 0.01028
Pithub::Repos::Statuses 0.01028
Pithub::Repos::Watching 0.01028
Pithub::Result 0.01028
Pithub::Result::SharedCache 0.01028
Pithub::Search 0.01028
Pithub-0.01030
pathname: O/OA/OALDERS/Pithub-0.01030.tar.gz
provides:
Pithub 0.01030
Pithub::Base 0.01030
Pithub::Events 0.01030
Pithub::Gists 0.01030
Pithub::Gists::Comments 0.01030
Pithub::GitData 0.01030
Pithub::GitData::Blobs 0.01030
Pithub::GitData::Commits 0.01030
Pithub::GitData::References 0.01030
Pithub::GitData::Tags 0.01030
Pithub::GitData::Trees 0.01030
Pithub::Issues 0.01030
Pithub::Issues::Assignees 0.01030
Pithub::Issues::Comments 0.01030
Pithub::Issues::Events 0.01030
Pithub::Issues::Labels 0.01030
Pithub::Issues::Milestones 0.01030
Pithub::Orgs 0.01030
Pithub::Orgs::Members 0.01030
Pithub::Orgs::Teams 0.01030
Pithub::PullRequests 0.01030
Pithub::PullRequests::Comments 0.01030
Pithub::Repos 0.01030
Pithub::Repos::Collaborators 0.01030
Pithub::Repos::Commits 0.01030
Pithub::Repos::Contents 0.01030
Pithub::Repos::Downloads 0.01030
Pithub::Repos::Forks 0.01030
Pithub::Repos::Hooks 0.01030
Pithub::Repos::Keys 0.01030
Pithub::Repos::Releases 0.01030
Pithub::Repos::Releases::Assets 0.01030
Pithub::Repos::Starring 0.01030
Pithub::Repos::Stats 0.01030
Pithub::Repos::Statuses 0.01030
Pithub::Repos::Watching 0.01030
Pithub::Result 0.01030
Pithub::Result::SharedCache 0.01030
Pithub::Search 0.01030
Pithub::SearchV3 0.01030
Pithub::Test undef
Pithub::Users 0.01028
Pithub::Users::Emails 0.01028
Pithub::Users::Followers 0.01028
Pithub::Users::Keys 0.01028
Pithub::Users 0.01030
Pithub::Users::Emails 0.01030
Pithub::Users::Followers 0.01030
Pithub::Users::Keys 0.01030
requirements:
Array::Iterator 0
Cache::LRU 0.04
Expand Down Expand Up @@ -3690,16 +3670,6 @@ DISTRIBUTIONS
Exporter::Tiny 0.026
ExtUtils::MakeMaker 6.17
perl 5.006001
Types-Serialiser-1.0
pathname: M/ML/MLEHMANN/Types-Serialiser-1.0.tar.gz
provides:
JSON::PP::Boolean 1.0
Types::Serialiser 1.0
Types::Serialiser::BooleanBase 1.0
Types::Serialiser::Error 1.0
requirements:
ExtUtils::MakeMaker 0
common::sense 0
URI-1.67
pathname: E/ET/ETHER/URI-1.67.tar.gz
provides:
Expand Down Expand Up @@ -3919,12 +3889,6 @@ DISTRIBUTIONS
requirements:
ExtUtils::MakeMaker 0
perl 5.008001
common-sense-3.73
pathname: M/ML/MLEHMANN/common-sense-3.73.tar.gz
provides:
common::sense 3.73
requirements:
ExtUtils::MakeMaker 0
libwww-perl-6.13
pathname: E/ET/ETHER/libwww-perl-6.13.tar.gz
provides:
Expand Down
6 changes: 3 additions & 3 deletions lib/GMC/Cron/Update.pm
Expand Up @@ -5,12 +5,12 @@ use warnings;
use DateTime;
use File::Copy qw(move);
use GMC::Util qw(github_config mongodb_config);
use JSON::Any;
use JSON::MaybeXS;
use LWP::UserAgent;
use Mojo::Base -base;
use Mojo::Log;
use MongoDB;
use Pithub;
use Pithub 0.01030; # encoding fix
use WWW::Mechanize;

__PACKAGE__->attr( [qw(db home json log lwp mcpan pithub)] );
Expand All @@ -28,7 +28,7 @@ sub new {
return bless {
db => $mongo->get_database('db'),
home => $args{home},
json => JSON::Any->new,
json => JSON->new->utf8,
log => Mojo::Log->new( path => "$args{home}/log/update.log" ),
lwp => LWP::UserAgent->new,
mcpan =>
Expand Down
8 changes: 4 additions & 4 deletions lib/GMC/Util.pm
@@ -1,8 +1,8 @@
package GMC::Util;

use Mojo::Base 'Exporter';
use JSON::XS;
use File::Slurp qw(read_file);
use JSON::MaybeXS;
use Path::Tiny;

our @EXPORT_OK = qw/environment github_config mongodb_config/;
my $ENVIRONMENT;
Expand Down Expand Up @@ -41,8 +41,8 @@ sub environment {
my $file = "$ENV{HOME}/github-meets-cpan/environment.json";

if ( -f $file ) {
my $env = read_file($file);
$ENVIRONMENT = JSON::XS->new->decode($env);
my $env = path($file)->slurp_raw;
$ENVIRONMENT = decode_json($env);
return $ENVIRONMENT;
}

Expand Down
2 changes: 1 addition & 1 deletion templates/parts/repo.html.ep
Expand Up @@ -2,7 +2,7 @@
<div class="item">
<ul>
<% if ($repo->{homepage} && $repo->{homepage} =~ qr{^http}) { %><li><a href="<%= $repo->{homepage} %>"><%= $repo->{homepage} %></a></li><% } %>
<% if ($repo->{description}) { %><li>Description: <%= Encode::decode('UTF-8', $repo->{description}) %></li><% } %>
<% if ($repo->{description}) { %><li>Description: <%= $repo->{description} %></li><% } %>
<li><a href="https://github.com/<%= $user->{github_user} %>/<%= $repo->{name} %>/watchers">Watchers</a>: <%= $repo->{watchers} %></li>
<li><a href="https://github.com/<%= $user->{github_user} %>/<%= $repo->{name} %>/network">Forks</a>: <%= $repo->{forks} %></li>
<% if ($repo->{open_issues}) { %><li><a href="https://github.com/<%= $user->{github_user} %>/<%= $repo->{name} %>/issues">Open Issues</a>: <%= $repo->{open_issues} %></li><% } %>
Expand Down
4 changes: 2 additions & 2 deletions templates/parts/user.html.ep
Expand Up @@ -18,8 +18,8 @@
</ul>
</li>
% }
<% if ($user->{github_data}{location}) { %><li>Location: <%= Encode::decode('UTF-8', $user->{github_data}{location}) %></li><% } %>
<% if ($user->{github_data}{company}) { %><li>Company: <%= Encode::decode('UTF-8', $user->{github_data}{company}) %></li><% } %>
<% if ($user->{github_data}{location}) { %><li>Location: <%= $user->{github_data}{location} %></li><% } %>
<% if ($user->{github_data}{company}) { %><li>Company: <%= $user->{github_data}{company} %></li><% } %>
<% if ( $user->{coderwall_data} && scalar @{ $user->{coderwall_data}{badges} || [] } ) { %><li><a href="http://coderwall.com/<%= $user->{github_user} %>">Coderwall</a> Badges: <%= scalar @{ $user->{coderwall_data}{badges} || [] } %></li><% } %>
<% if ( $user->{github_data}{hireable} ) { %><li>Hireable: yes</li><% } %>
</ul>
Expand Down

0 comments on commit 0c2e01a

Please sign in to comment.