Make the favicon be in the sharedir
Tomas Doran [Wed, 27 May 2009 20:07:17 +0000 (20:07 +0000)]
Makefile.PL
lib/Catalyst/Helper.pm
share/root/favicon.ico [new file with mode: 0644]

index 6387947..c387253 100644 (file)
@@ -17,6 +17,8 @@ requires 'parent'; # as of 1.04
 requires 'Path::Class' => '0.09';
 requires 'Template'    => '2.14';
 
+install_share 'share';
+
 if ( $^O eq 'MSWin32' ) {
     # Proc::Background needs this on Win32 but doesn't actually
     # require it, if it's missing it just dies in the Makefile.PL.
index c10b438..f048a85 100644 (file)
@@ -13,6 +13,8 @@ use Template;
 use Catalyst::Devel;
 use Catalyst::Utils;
 use Catalyst::Exception;
+use Path::Class qw/dir file/;
+use File::ShareDir qw/dist_dir/;
 
 my %cache;
 
@@ -26,6 +28,14 @@ Catalyst::Helper - Bootstrap a Catalyst application
 
 =cut
 
+sub get_sharedir_file {
+    my ($self, @filename) = @_;
+    my $file = file( dist_dir('Catalyst-Devel'), @filename);
+    warn $file;
+    my $contents = $file->slurp;
+    return $contents;
+}
+
 sub get_file {
     my ( $self, $class, $file ) = @_;
     unless ( $cache{$class} ) {
@@ -430,9 +440,9 @@ sub _mk_images {
 sub _mk_favicon {
     my $self    = shift;
     my $root    = $self->{root};
-    my $hex     = $self->get_file( ( caller(0) )[0], 'favicon' );
-    my $favicon = pack "H*", $hex;
-    $self->mk_file( File::Spec->catfile( $root, "favicon.ico" ), $favicon );
+    my $favicon = $self->get_sharedir_file( 'root', 'favicon.ico' );
+    my $dest = File::Spec->catfile( $root, "favicon.ico" );
+    $self->mk_file( $dest, $favicon );
 
 }
 
diff --git a/share/root/favicon.ico b/share/root/favicon.ico
new file mode 100644 (file)
index 0000000..5ad723d
Binary files /dev/null and b/share/root/favicon.ico differ