diff --git a/Makefile.PL b/Makefile.PL index 3619f4b..fd2664e 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -4,6 +4,9 @@ use strict; use warnings; use ExtUtils::MakeMaker; +use File::ShareDir::Install; + +install_share dist => 'share'; WriteMakefile( NAME => 'Contenticious', @@ -33,6 +36,7 @@ WriteMakefile( # non-trivial dependencies 'File::Copy::Recursive' => '0.38', + 'File::Share' => '0.25', 'Mojolicious' => '7.0', 'Mojolicious::Plugin::AssetPack' => '1.45', 'Mojolicious::Plugin::RelativeUrlFor' => '0.052', @@ -42,3 +46,6 @@ WriteMakefile( EXE_FILES => ['contenticious'], test => {TESTS => 't/*.t'} ); + +package MY; +use File::ShareDir::Install 'postamble'; diff --git a/lib/Contenticious/Generator.pm b/lib/Contenticious/Generator.pm index 7cd5a59..fb3cb4d 100644 --- a/lib/Contenticious/Generator.pm +++ b/lib/Contenticious/Generator.pm @@ -3,11 +3,12 @@ use Mojo::Base -base; use File::Basename; use File::Spec::Functions; # catdir, catfiles +use File::Share 'dist_dir'; use FindBin; use File::Path 'make_path'; use File::Copy; -has share_directory => catdir dirname(__FILE__), '..', '..', 'share'; +has share_directory => dist_dir 'Contenticious'; has working_directory => $FindBin::Bin; has files => sub{[