cpan-testers / cpantesters-web

A new CPAN Testers web application. The primary interface for CPAN Testers data
Other
7 stars 5 forks source link

how to enable File::Share on cpantesters-web-legacy #4

Closed glasswalk3r closed 7 years ago

glasswalk3r commented 7 years ago

I tried to use File::Share dist_dir to configure the paths where Mojolicious should look for templates and static files for cpantesters-web-legacy, but that's not working:

CPAN-Testers-Web-0.001$ morbo bin/cpantesters-web-legacy 
Server available at http://127.0.0.1:3000
Can't load application from file "/home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/cpantesters-web-legacy": Failed to find share dir for dist 'CPAN-Testers-web' at /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/File/Share.pm line 37.
Compilation failed in require at (eval 91) line 1.

Is there anything else I need to do (besides installing)? Currently I'm using "hard coded" values for development.

Same thing happens with cpantesters-web:

CPAN-Testers-Web-0.001$ morbo bin/cpantesters-web
Server available at http://127.0.0.1:3000
Can't load application from file "/home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/cpantesters-web": Base class package "Import::Base" is empty.
    (Perhaps you need to 'use' the module which defines that package first,
    or make that module available in @INC (@INC contains: /home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/../lib /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/x86_64-linux /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1 /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.1/x86_64-linux /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.1 /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0 /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl .).
 at /home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/../lib/CPAN/Testers/Web/Base.pm line 37.
BEGIN failed--compilation aborted at /home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/../lib/CPAN/Testers/Web/Base.pm line 37.
Compilation failed in require at /home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/../lib/CPAN/Testers/Web.pm line 26.
BEGIN failed--compilation aborted at /home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/../lib/CPAN/Testers/Web.pm line 26.
Compilation failed in require at (eval 92) line 1.
Compilation failed in require at (eval 91) line 1.
preaction commented 7 years ago

It seem like you asked for CPAN-Testers-web, but the distribution is named CPAN-Testers-Web. I wouldn't think capitalization matters, but that'd be my first guess. Otherwise, I don't see a call to dist_dir in the cpantesters-web-legacy, so I don't know what you might be doing.

A different thing is happening with cpantesters-web: the prereqs aren't installed (the error is "Import::Base" is empty).

glasswalk3r commented 7 years ago

It seem like you asked for CPAN-Testers-web, but the distribution is named CPAN-Testers-Web. I wouldn't think capitalization matters, but that'd be my first guess. Otherwise, I don't see a call to dist_dir in the cpantesters-web-legacy, so I don't know what you might be doing.

I didn't push those changes into the repository yet, but here is what I have done:

:~/Projetos/cpantesters-web/CPAN-Testers-Web-0.001$ ack dist_dir
lib/CPAN/Testers/Web.pm
27:use File::Share qw( dist_dir dist_file );
57:        catdir( dist_dir( 'CPAN-Testers-Web' ), 'templates' );
59:        catdir( dist_dir( 'CPAN-Testers-Web' ), 'public' );
73:        catdir( dist_dir( 'CPAN-Testers-Web' ), 'node_modules' ),
95:        catdir( dist_dir( 'CPAN-Testers-Web' ), 'node_modules', 'font-awesome' );

bin/cpantesters-web-legacy
113:use File::Share 'dist_dir';
114:unshift @{ app->renderer->paths }, catdir( dist_dir('CPAN-Testers-Web'), 'templates' );
116:unshift @{ app->static->paths },   catdir( dist_dir('CPAN-Testers-Web'), 'public' );

~/Projetos/cpantesters-web/CPAN-Testers-Web-0.001$ morbo bin/cpantesters-web-legacy
Server available at http://127.0.0.1:3000
Can't load application from file "/home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/cpantesters-web-legacy": Failed to find share dir for dist 'CPAN-Testers-Web' at /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/File/Share.pm line 37.
Compilation failed in require at (eval 91) line 1.
^C~/Projetos/cpantesters-web/CPAN-Testers-Web-0.001$ which morbo
/home/alceu/perl5/perlbrew/perls/perl-5.24.0/bin/morbo
~/Projetos/cpantesters-web/CPAN-Testers-Web-0.001$ perl -Ilib /home/alceu/perl5/perlbrew/perls/perl-5.24.0/bin/morbo bin/cpantesters-web-legacy
Server available at http://127.0.0.1:3000
Can't load application from file "/home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/cpantesters-web-legacy": Failed to find share dir for dist 'CPAN-Testers-Web' at /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/File/Share.pm line 37.
Compilation failed in require at (eval 91) line 1.

A different thing is happening with cpantesters-web: the prereqs aren't installed (the error is "Import::Base" is empty).

Interesting, because it is declared in the dist.ini file, but I got no complaints about it:

~/Projetos/cpantesters-web$ dzil build
[DZ] beginning to build CPAN-Testers-Web
[DZ] guessing dist's main_module is lib/CPAN/Testers/Web.pm
[PodWeaver] [Name] couldn't find abstract in bin/cpantesters-web
[PodWeaver] [Name] couldn't find abstract in bin/cpantesters-web-legacy
[RewriteVersion] Skipping: no "our $VERSION = '...'" found in "bin/cpantesters-web-legacy"
[DZ] writing CPAN-Testers-Web in CPAN-Testers-Web-0.001
[ReadmeAnyFromPod] overriding README.mkdn in root
[CopyFilesFromBuild] Copied CPAN-Testers-Web-0.001/cpanfile to cpanfile
[CopyFilesFromBuild] Copied CPAN-Testers-Web-0.001/META.json to META.json
[CopyFilesFromBuild] Copied CPAN-Testers-Web-0.001/LICENSE to LICENSE
[CopyFilesFromBuild] Copied CPAN-Testers-Web-0.001/Makefile.PL to Makefile.PL
[CopyFilesFromBuild] Copied CPAN-Testers-Web-0.001/CHANGES to CHANGES
[Run::AfterBuild] executing: perl -pi -e 's{(# SYNOPSIS)}{# STATUS\n\n<a href="https://travis-ci.org/cpan-testers/cpantesters-web"><img src="https://travis-ci.org/cpan-testers/cpantesters-web.svg?branch=master"></a><a href="https://coveralls.io/r/cpan-testers/cpantesters-web"><img src="https://coveralls.io/repos/cpan-testers/cpantesters-web/badge.png" alt="Coverage Status" /></a>\n\n$1}' README.mkdn
[DZ] building archive with Archive::Tar::Wrapper
[DZ] writing archive to CPAN-Testers-Web-0.001.tar.gz
[DZ] built in CPAN-Testers-Web-0.001
alceu@yggdrasil:~/Projetos/cpantesters-web$ ls
bin      CONTRIBUTING.md  CPAN-Testers-Web-0.001         dist.ini  lib      Makefile.PL  README.mkdn  share  weaver.ini
CHANGES  cpanfile         CPAN-Testers-Web-0.001.tar.gz  etc       LICENSE  META.json    Rexfile      t
~/Projetos/cpantesters-web$ cd CPAN-Testers-Web-0.001/
~/Projetos/cpantesters-web/CPAN-Testers-Web-0.001$ ls
bin  CHANGES  CONTRIBUTING.md  cpanfile  dist.ini  etc  lib  LICENSE  Makefile.PL  MANIFEST  META.json  META.yml  README  Rexfile  share  t  weaver.ini
~/Projetos/cpantesters-web/CPAN-Testers-Web-0.001$ morbo bin/cpantesters-web
Server available at http://127.0.0.1:3000
Can't load application from file "/home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/cpantesters-web": Base class package "Import::Base" is empty.
    (Perhaps you need to 'use' the module which defines that package first,
    or make that module available in @INC (@INC contains: /home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/../lib /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/x86_64-linux /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1 /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.1/x86_64-linux /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.1 /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0 /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl .).
 at /home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/../lib/CPAN/Testers/Web/Base.pm line 37.
BEGIN failed--compilation aborted at /home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/../lib/CPAN/Testers/Web/Base.pm line 37.
Compilation failed in require at /home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/../lib/CPAN/Testers/Web.pm line 26.
BEGIN failed--compilation aborted at /home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/../lib/CPAN/Testers/Web.pm line 26.
Compilation failed in require at (eval 92) line 1.
Compilation failed in require at (eval 91) line 1.
~/Projetos/cpantesters-web$ ack 'Import::Base'
dist.ini
135:Import::Base = 0.012 ; Fixed using subs in imports
141:;Import::Base = 0.012 ; Fixed using subs in imports

lib/CPAN/Testers/Web/Base.pm
29:=item L<Import::Base>
37:use base 'Import::Base';

META.json
37:            "Import::Base" : "0.012",

share/templates/report.html.ep
164:#     Import::Base          0.012    1.002
292:    Import::Base            0.012    1.002   

share/templates/user/inbox/1.html.ep
185:#     Import::Base          0.012    1.002
313:    Import::Base            0.012    1.002   

Makefile.PL
33:    "Import::Base" => "0.012",
62:  "Import::Base" => "0.012",

cpanfile
3:requires "Import::Base" => "0.012";

After installing Import::Base:

~/Projetos/cpantesters-web/CPAN-Testers-Web-0.001$ morbo bin/cpantesters-web
Server available at http://127.0.0.1:3000
Can't load application from file "/home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/cpantesters-web": Can't locate Log/Any/Adapter/MojoLog.pm in @INC (you may need to install the Log::Any::Adapter::MojoLog module) (@INC contains: /home/alceu/Projetos/cpantesters-web/CPAN-Testers-Web-0.001/bin/../lib /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1/x86_64-linux /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.1 /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.1/x86_64-linux /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/5.24.1 /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0/x86_64-linux /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl/5.24.0 /home/alceu/perl5/perlbrew/perls/perl-5.24.0/lib/site_perl .) at (eval 100) line 1.
Compilation failed in require at (eval 91) line 1.
glasswalk3r commented 7 years ago

Got the problem. The solution will require some thinking about how the distribution is organized. dist_dir requires that CPAN/Testers/Web.pm is included in %INC, but cpantesters-web-legacy is using Mojolicious::Lite instead, so it is not importing CPAN::Testers::Web as cpantesters-web does. Or cpantesters-web-legacy is changed to use Mojolicious (which seems overkill to me at this moment) or we create another package to contain the templates and static files (like CPAN::Testers::Web::Legacy), which would contain only Pod.

preaction commented 7 years ago

dzil build does not install prereqs, dzil listdeps --missing | cpanm installs prereqs.