r55292 - in /branches/upstream/libgravatar-url-perl/current: Build.PL Changes MANIFEST MANIFEST.SKIP META.yml SIGNATURE lib/Gravatar/URL.pm lib/Unicornify/ lib/Unicornify/URL.pm t/deprecated.t t/unicornify.t t/url.t

ansgar-guest at users.alioth.debian.org ansgar-guest at users.alioth.debian.org
Fri Apr 2 13:16:31 UTC 2010


Author: ansgar-guest
Date: Fri Apr  2 13:16:10 2010
New Revision: 55292

URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=55292
Log:
[svn-upgrade] Integrating new upstream version, libgravatar-url-perl (1.02)

Added:
    branches/upstream/libgravatar-url-perl/current/MANIFEST.SKIP
    branches/upstream/libgravatar-url-perl/current/lib/Unicornify/
    branches/upstream/libgravatar-url-perl/current/lib/Unicornify/URL.pm
    branches/upstream/libgravatar-url-perl/current/t/unicornify.t
Modified:
    branches/upstream/libgravatar-url-perl/current/Build.PL
    branches/upstream/libgravatar-url-perl/current/Changes
    branches/upstream/libgravatar-url-perl/current/MANIFEST
    branches/upstream/libgravatar-url-perl/current/META.yml
    branches/upstream/libgravatar-url-perl/current/SIGNATURE
    branches/upstream/libgravatar-url-perl/current/lib/Gravatar/URL.pm
    branches/upstream/libgravatar-url-perl/current/t/deprecated.t
    branches/upstream/libgravatar-url-perl/current/t/url.t

Modified: branches/upstream/libgravatar-url-perl/current/Build.PL
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgravatar-url-perl/current/Build.PL?rev=55292&op=diff
==============================================================================
--- branches/upstream/libgravatar-url-perl/current/Build.PL (original)
+++ branches/upstream/libgravatar-url-perl/current/Build.PL Fri Apr  2 13:16:10 2010
@@ -34,6 +34,7 @@
         'Digest::MD5'       => 0,
         'Carp'              => 0,
         perl                => '5.6.0',
+        'parent'            => 0,
     },
 );
 

Modified: branches/upstream/libgravatar-url-perl/current/Changes
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgravatar-url-perl/current/Changes?rev=55292&op=diff
==============================================================================
--- branches/upstream/libgravatar-url-perl/current/Changes (original)
+++ branches/upstream/libgravatar-url-perl/current/Changes Fri Apr  2 13:16:10 2010
@@ -1,3 +1,15 @@
+1.02  Thu Apr  1 15:36:52 PDT 2010
+    New Features
+    * Added Unicornify::URL for generated unicorn avatars, OMG!!!
+      http://unicornify.appspot.com/whats-this
+
+    Incompatible Changes
+    * short_keys is now the default, as per Gravatar protocol documentation
+
+    Protocol Updates
+    * Document that Gravatar has a new default option, 404.
+
+
 1.01  Thu Apr  9 13:11:32 PDT 2009
     Protocol Updates
     (The Gravatar protocol changed, so we're changing with it)

Modified: branches/upstream/libgravatar-url-perl/current/MANIFEST
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgravatar-url-perl/current/MANIFEST?rev=55292&op=diff
==============================================================================
--- branches/upstream/libgravatar-url-perl/current/MANIFEST (original)
+++ branches/upstream/libgravatar-url-perl/current/MANIFEST Fri Apr  2 13:16:10 2010
@@ -1,10 +1,13 @@
 Build.PL
 Changes
 lib/Gravatar/URL.pm
+lib/Unicornify/URL.pm
 MANIFEST
+MANIFEST.SKIP
 META.yml
 t/deprecated.t
 t/error.t
 t/id.t
+t/unicornify.t
 t/url.t
 SIGNATURE    Added here by Module::Build

Added: branches/upstream/libgravatar-url-perl/current/MANIFEST.SKIP
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgravatar-url-perl/current/MANIFEST.SKIP?rev=55292&op=file
==============================================================================
--- branches/upstream/libgravatar-url-perl/current/MANIFEST.SKIP (added)
+++ branches/upstream/libgravatar-url-perl/current/MANIFEST.SKIP Fri Apr  2 13:16:10 2010
@@ -1,0 +1,58 @@
+#!start included /usr/local/lib/perl5/5.10.1/ExtUtils/MANIFEST.SKIP
+# Avoid version control files.
+\bRCS\b
+\bCVS\b
+\bSCCS\b
+,v$
+\B\.svn\b
+\B\.git\b
+\B\.gitignore\b
+\b_darcs\b
+\B\.cvsignore$
+
+# Avoid VMS specific MakeMaker generated files
+\bDescrip.MMS$
+\bDESCRIP.MMS$
+\bdescrip.mms$
+
+# Avoid Makemaker generated and utility files.
+\bMANIFEST\.bak
+\bMakefile$
+\bblib/
+\bMakeMaker-\d
+\bpm_to_blib\.ts$
+\bpm_to_blib$
+\bblibdirs\.ts$         # 6.18 through 6.25 generated this
+
+# Avoid Module::Build generated and utility files.
+\bBuild$
+\b_build/
+\bBuild.bat$
+\bBuild.COM$
+\bBUILD.COM$
+\bbuild.com$
+
+# Avoid temp and backup files.
+~$
+\.old$
+\#$
+\b\.#
+\.bak$
+\.tmp$
+\.#
+\.rej$
+
+# Avoid OS-specific files/dirs
+# Mac OSX metadata
+\B\.DS_Store
+# Mac OSX SMB mount metadata files
+\B\._
+
+# Avoid Devel::Cover and Devel::CoverX::Covered files.
+\bcover_db\b
+\bcovered\b
+ 
+# Avoid MYMETA files
+^MYMETA\.
+#!end included /usr/local/lib/perl5/5.10.1/ExtUtils/MANIFEST.SKIP
+

Modified: branches/upstream/libgravatar-url-perl/current/META.yml
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgravatar-url-perl/current/META.yml?rev=55292&op=diff
==============================================================================
--- branches/upstream/libgravatar-url-perl/current/META.yml (original)
+++ branches/upstream/libgravatar-url-perl/current/META.yml Fri Apr  2 13:16:10 2010
@@ -1,30 +1,34 @@
 ---
+abstract: 'Make URLs for Gravatars from an email address'
+author: []
+build_requires:
+  Test::More: 0.4
+  Test::Warn: 0.11
+configure_requires:
+  Module::Build: 0.2808
+generated_by: 'Module::Build version 0.3603'
+keywords:
+  - Gravatar
+license: perl
+meta-spec:
+  url: http://module-build.sourceforge.net/META-spec-v1.4.html
+  version: 1.4
 name: Gravatar-URL
-version: 1.01
-author: []
-abstract: Make URLs for Gravatars from an email address
-license: perl
+provides:
+  Gravatar::URL:
+    file: lib/Gravatar/URL.pm
+    version: 1.02
+  Unicornify::URL:
+    file: lib/Unicornify/URL.pm
+    version: 1.02
+requires:
+  Carp: 0
+  Digest::MD5: 0
+  URI::Escape: 0
+  parent: 0
+  perl: v5.6.0
 resources:
   bugtracker: http://rt.cpan.org/Public/Dist/Display.html?Name=Gravatar-URL
   license: http://dev.perl.org/licenses/
   repository: http://github.com/schwern/gravatar-url/tree/master
-requires:
-  Carp: 0
-  Digest::MD5: 0
-  URI::Escape: 0
-  perl: 5.6.0
-build_requires:
-  Test::More: 0.4
-  Test::Warn: 0.11
-provides:
-  Gravatar::URL:
-    file: lib/Gravatar/URL.pm
-    version: 1.01
-generated_by: Module::Build version 0.32
-meta-spec:
-  url: http://module-build.sourceforge.net/META-spec-v1.2.html
-  version: 1.2
-keywords:
-  - Gravatar
-configure_requires:
-  Module::Build: 0.2808
+version: 1.02

Modified: branches/upstream/libgravatar-url-perl/current/SIGNATURE
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgravatar-url-perl/current/SIGNATURE?rev=55292&op=diff
==============================================================================
--- branches/upstream/libgravatar-url-perl/current/SIGNATURE (original)
+++ branches/upstream/libgravatar-url-perl/current/SIGNATURE Fri Apr  2 13:16:10 2010
@@ -1,5 +1,5 @@
 This file contains message digests of all files listed in MANIFEST,
-signed via the Module::Signature module, version 0.55.
+signed via the Module::Signature module, version 0.61.
 
 To verify the content in this distribution, first make sure you have
 Module::Signature installed, then type:
@@ -14,19 +14,22 @@
 -----BEGIN PGP SIGNED MESSAGE-----
 Hash: SHA1
 
-SHA1 da6f215441f5f4c2ef0f1ac5347aad253ff6c50f Build.PL
-SHA1 b3682d5f2e0318d0d3d23aac866f997c8ed37410 Changes
-SHA1 7758b0be320c022c1ce8ca12ac464354d371b1d3 MANIFEST
-SHA1 4299310ce303d6be6ffc9ab65ed04728f744e3ec META.yml
-SHA1 15653f61d2fa90771833e0c8b6a24dd45863c588 lib/Gravatar/URL.pm
-SHA1 218d731c6d9ccf14c33a3b3db3faff3f4c6a24b4 t/deprecated.t
+SHA1 57fcac9d7b6888138ff4dc8774afb60a7ccf1dd1 Build.PL
+SHA1 76ff0820d7e50e966cbaf111221c75fb0ce88e0a Changes
+SHA1 5e4f8a6316dceb7d6bc6c5b3c49ad6941a5ea6f4 MANIFEST
+SHA1 8e76a4d7da7ca9b32f67f3675bbd42d34a25cd37 MANIFEST.SKIP
+SHA1 26e8d176f1b88898994d4325f713f4e4675af21a META.yml
+SHA1 2588ede38e5ddd7060bcafae1086ed3ca134fab5 lib/Gravatar/URL.pm
+SHA1 19711694d10060b613ca024cd37dc5e45a8f4e15 lib/Unicornify/URL.pm
+SHA1 02f21c26f52380259046ea05ae9d560b8a5c5072 t/deprecated.t
 SHA1 0250d25f32bcfe6dafab0b3892f4575959ef6890 t/error.t
 SHA1 3b4f3259bb95a336b73ecd2c06bf96dd30637a0a t/id.t
-SHA1 a1daffcb9416394c540b324b21a022b2b61c8a3d t/url.t
+SHA1 7bdb7b0b2b440eaade3bb2a968c4919c7c2d4666 t/unicornify.t
+SHA1 b027b15e0b5c1257a59bc63ecb8b7c3336119c8f t/url.t
 -----BEGIN PGP SIGNATURE-----
-Version: GnuPG v1.4.9 (Darwin)
+Version: GnuPG v2.0.13 (Darwin)
 
-iEYEARECAAYFAkneV5QACgkQWMohlhD1QydtfQCfcze4m56PfxlfLG+oTJQIZDXO
-pGIAnjb1uA8ETnr/EWGXnUWGanXjOOC/
-=9cBO
+iEYEARECAAYFAku1IKYACgkQWMohlhD1QyeB0wCgmpW3M4lZElbrcEbqQMMigm3u
+/ukAoMUYiK2LdlG3TaJZxhzBh1fuOp8C
+=WBcp
 -----END PGP SIGNATURE-----

Modified: branches/upstream/libgravatar-url-perl/current/lib/Gravatar/URL.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgravatar-url-perl/current/lib/Gravatar/URL.pm?rev=55292&op=diff
==============================================================================
--- branches/upstream/libgravatar-url-perl/current/lib/Gravatar/URL.pm (original)
+++ branches/upstream/libgravatar-url-perl/current/lib/Gravatar/URL.pm Fri Apr  2 13:16:10 2010
@@ -7,9 +7,9 @@
 use Digest::MD5 qw(md5_hex);
 use Carp;
 
-our $VERSION = '1.01';
-
-use base 'Exporter';
+our $VERSION = '1.02';
+
+use parent 'Exporter';
 our @EXPORT = qw(
     gravatar_id
     gravatar_url
@@ -80,14 +80,15 @@
 
 The url to use if the user has no gravatar or has none that fits your rating requirements.
 
-    default => "http://upload.wikimedia.org/wikipedia/en/8/89/Alfred.jpg"
+    default => "https://secure.wikimedia.org/wikipedia/en/wiki/File:Mad30.jpg"
 
 Relative URLs will be relative to the base (ie. gravatar.com), not your web site.
 
 Gravatar defines special values that you may use as a default to
 produce dynamic default images. These are "identicon", "monsterid" and
-"wavatar".  See L<http://en.gravatar.com/site/implement/url> for more
-info.
+"wavatar".  "404" will cause the URL to return an HTTP 404 "Not Found"
+error instead.  See L<http://en.gravatar.com/site/implement/url> for
+more info.
 
 If omitted, Gravatar will serve up their default image, the blue G.
 
@@ -113,9 +114,14 @@
 If true, use short key names when constructing the URL.  "s" instead
 of "size", "r" instead of "ratings" and so on.
 
-short_keys defaults to false, but may default to true in the future.
+short_keys defaults to true.
 
 =cut
+
+my %defaults = (
+    short_keys  => 1,
+    base        => $Gravatar_Base
+);
 
 sub gravatar_url {
     my %args = @_;
@@ -126,7 +132,7 @@
     exists $args{id} xor exists $args{email} or
         croak "Both an id and an email were given.  gravatar_url() only takes one";
 
-    my $base = $args{base} || $Gravatar_Base;
+    _apply_defaults(\%args, \%defaults);
 
     if ( exists $args{size} ) {
         $args{size} >= 1 and $args{size} <= 512
@@ -150,6 +156,7 @@
     $args{default} = uri_escape($args{default})
         if $args{default};
 
+    # Use a fixed order to make testing easier
     my @pairs;
     for my $arg ( qw( rating size default border ) ) {
         next unless exists $args{$arg};
@@ -159,7 +166,7 @@
         push @pairs, join("=", $key, $args{$arg});
     }
 
-    my $uri = $base;
+    my $uri = $args{base};
     $uri   .= "/" unless $uri =~ m{/$};
     $uri   .= $args{gravatar_id};
     $uri   .= "?".join("&", at pairs) if @pairs;
@@ -167,6 +174,17 @@
     return $uri;
 }
 
+
+sub _apply_defaults {
+    my($hash, $defaults) = @_;
+
+    for my $key (keys %$defaults) {
+        next if exists $hash->{$key};
+        $hash->{$key} = $defaults->{$key};
+    }
+
+    return;
+}
 
 =head3 B<gravatar_id>
 

Added: branches/upstream/libgravatar-url-perl/current/lib/Unicornify/URL.pm
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgravatar-url-perl/current/lib/Unicornify/URL.pm?rev=55292&op=file
==============================================================================
--- branches/upstream/libgravatar-url-perl/current/lib/Unicornify/URL.pm (added)
+++ branches/upstream/libgravatar-url-perl/current/lib/Unicornify/URL.pm Fri Apr  2 13:16:10 2010
@@ -1,0 +1,75 @@
+package Unicornify::URL;
+
+use strict;
+use warnings;
+
+our $VERSION = '1.02';
+
+use Gravatar::URL qw(gravatar_url);
+
+use parent 'Exporter';
+our @EXPORT = qw(
+    unicornify_url
+);
+
+my $Unicornify_Base = "http://unicornify.appspot.com/avatar/";
+
+
+=head1 NAME
+
+Unicornify::URL - OMG UNICORN AVATAR!
+
+=head1 SYNOPSIS
+
+    use Unicornify::URL;
+
+    my $url = unicornify_url( email => 'larry at wall.org' );
+
+=head1 DESCRIPTION
+
+Now you can have your very own generated Unicorn avatar! OMG! SQUEE!
+
+See L<http://unicornify.appspot.com/use-it> for more information. *heart*
+
+=head1 Functions
+
+=head3 B<unicornify_url>
+
+    my $url = unicornify_url( email => $email, %options );
+
+Constructs a URL to fetch the unicorn avatar for the given $email address.
+
+C<%options> are optional.  C<unicornify_url> will accept all the
+options of L<Gravatar::URL/gravatar_url> but as of this time only
+C<size> has any effect.
+
+=head4 size
+
+Specifies the desired width and height of the avatar (they are square)
+in pixels.
+
+As of this writing, valid values are from 32 to 128.  The default is
+32.
+
+=head1 SEE ALSO
+
+L<Gravatar::URL>
+
+L<Acme::Pony>
+
+"The Last Unicorn"
+
+=cut
+
+my %defaults = (
+    base       => $Unicornify_Base,
+    short_keys => 1,
+);
+sub unicornify_url {
+    my %args = @_;
+
+    Gravatar::URL::_apply_defaults(\%args, \%defaults);
+    return gravatar_url(%args);
+}
+
+"OMG! UNICORNS!";

Modified: branches/upstream/libgravatar-url-perl/current/t/deprecated.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgravatar-url-perl/current/t/deprecated.t?rev=55292&op=diff
==============================================================================
--- branches/upstream/libgravatar-url-perl/current/t/deprecated.t (original)
+++ branches/upstream/libgravatar-url-perl/current/t/deprecated.t Fri Apr  2 13:16:10 2010
@@ -17,5 +17,5 @@
         id   => '12345',
         base => 'http://www.example.com/gravatar',
         border => "FFF"
-    ), "http://www.example.com/gravatar/12345?border=FFF";
+    ), "http://www.example.com/gravatar/12345?b=FFF";
 } {carped => "The border key is deprecated"};

Added: branches/upstream/libgravatar-url-perl/current/t/unicornify.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgravatar-url-perl/current/t/unicornify.t?rev=55292&op=file
==============================================================================
--- branches/upstream/libgravatar-url-perl/current/t/unicornify.t (added)
+++ branches/upstream/libgravatar-url-perl/current/t/unicornify.t Fri Apr  2 13:16:10 2010
@@ -1,0 +1,13 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+
+use Test::More tests => 2;
+use Unicornify::URL;
+
+is unicornify_url( email => 'yarrow at hock.com' ),
+   'http://unicornify.appspot.com/avatar/c5cf0e825e9757a09c43f08650f46a5f';
+
+is unicornify_url( email => 'yarrow at hock.com', size => 128 ),
+   'http://unicornify.appspot.com/avatar/c5cf0e825e9757a09c43f08650f46a5f?s=128';

Modified: branches/upstream/libgravatar-url-perl/current/t/url.t
URL: http://svn.debian.org/wsvn/pkg-perl/branches/upstream/libgravatar-url-perl/current/t/url.t?rev=55292&op=diff
==============================================================================
--- branches/upstream/libgravatar-url-perl/current/t/url.t (original)
+++ branches/upstream/libgravatar-url-perl/current/t/url.t Fri Apr  2 13:16:10 2010
@@ -34,14 +34,14 @@
         [{ default => "/local.png",
            email   => $email
          },
-         "$base/$id?default=%2Flocal.png",
+         "$base/$id?d=%2Flocal.png",
         ],
         
         [{ default => "/local.png",
            rating  => 'X',
            email   => $email,
          },
-         "$base/$id?rating=x&default=%2Flocal.png",
+         "$base/$id?r=x&d=%2Flocal.png",
         ],
         
         [{ default  => "/local.png",
@@ -49,7 +49,7 @@
            rating   => 'R',
            size     => 80
          },
-         "$base/$id?rating=r&size=80&default=%2Flocal.png"
+         "$base/$id?r=r&s=80&d=%2Flocal.png"
         ],
 
         [{ default => "/local.png",
@@ -57,7 +57,7 @@
            size    => 45,
            email   => $email,
          },
-         "$base/$id?rating=pg&size=45&default=%2Flocal.png"
+         "$base/$id?r=pg&s=45&d=%2Flocal.png"
         ],
 
         [{ default => "/local.png",
@@ -65,7 +65,7 @@
            size    => 45,
            email   => $email,
          },
-         "$base/$id?rating=pg&size=45&default=%2Flocal.png"
+         "$base/$id?r=pg&s=45&d=%2Flocal.png"
         ],
 
         [{ default => "/local.png",
@@ -76,6 +76,14 @@
          },
          "$base/$id?r=pg&s=45&d=%2Flocal.png"
         ],
+        [{ default => "/local.png",
+           rating  => 'PG',
+           size    => 45,
+           email   => $email,
+           short_keys => 0,
+         },
+         "$base/$id?rating=pg&size=45&default=%2Flocal.png"
+        ],
     );
 
     # Add tests for the special defaults.
@@ -83,13 +91,13 @@
         my $test = [{ default => $special,
                       email   => $email,
                     },
-                    "$base/$id?default=$special",
+                    "$base/$id?d=$special",
                    ];
         push @tests, $test;
     }
 
     for my $test (@tests) {
-        my($args, $url ) = @$test;
+        my($args, $url) = @$test;
         is gravatar_url( %$args ), $url, join ", ", keys %$args;
     }
 }




More information about the Pkg-perl-cvs-commits mailing list