diff --git a/.github/workflows/update-cpanfile-snapshot.yml b/.github/workflows/update-cpanfile-snapshot.yml new file mode 100644 index 0000000..7b9d87d --- /dev/null +++ b/.github/workflows/update-cpanfile-snapshot.yml @@ -0,0 +1,41 @@ +name: Update cpanfile.snapshot + +on: + pull_request: + paths: + - cpanfile + - cpanfile.target + workflow_dispatch: + +jobs: + update-cpanfile-snapshot: + runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: + contents: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ github.head_ref }} + + - name: Check cpanfile.target + id: check-cpanfile-target + continue-on-error: true + run: sha256sum -c cpanfile.target + + - name: Update cpanfile.snapshot and cpanfile.target + if: steps.check-cpanfile-target.outcome == 'failure' + run: | + docker build . -t perl-app-image --target base + docker run --rm -v $(pwd):/usr/src/app perl-app-image bash -c 'carton install' + sha256sum cpanfile > cpanfile.target + + - uses: stefanzweifel/git-auto-commit-action@v5.0.0 + with: + commit_user_name: GitHub Actions + commit_user_email: noreply@github.com + commit_message: Update cpanfile.snapshot and cpanfile.target + file_pattern: cpanfile.snapshot cpanfile.target cpanfile + diff --git a/Dockerfile b/Dockerfile index d3da349..80cd163 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,27 +6,25 @@ RUN apt-get update && \ apt-get -y upgrade && \ apt-get install -y wget gcc g++ make sqlite3 +RUN cpm install -g Carton + WORKDIR /usr/src/app -COPY cpanfile ./ -RUN cpm install -COPY . . - -RUN sqlite3 perldocjp.master.db < sql/sqlite.sql -RUN cp perldocjp.master.db perldocjp.slave.db +COPY cpanfile cpanfile.snapshot . ENV PLACK_ENV=docker ENV PERL5LIB=/usr/src/app/local/lib/perl5 ENV PATH=/usr/src/app/local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin -# 翻訳データの更新 -RUN perl script/update.pl +FROM base as app -# テスト用のステージ -FROM base as test -RUN cpm install --with-test --with-develop --show-build-log-on-failure +RUN carton install --deployment +COPY . . + +RUN sqlite3 perldocjp.master.db < sql/sqlite.sql +RUN cp perldocjp.master.db perldocjp.slave.db + +# 翻訳データの更新 +RUN perl script/update.pl -# サーバーを起動したい時のステージ -FROM base as web -CMD ["./local/bin/plackup", "-p", "5000", "-Ilib", "app.psgi"] diff --git a/Makefile b/Makefile index 6130b99..157a4ed 100644 --- a/Makefile +++ b/Makefile @@ -1,18 +1,17 @@ .PHONY: build build: - docker-compose -f docker-compose.yml build web + docker compose build .PHONY: up up: - make build - docker-compose -f docker-compose.yml up -d web + docker compose up .PHONY: down down: - docker-compose -f docker-compose.yml down + docker compose down .PHONY: test +test: TEST_TARGET = t test: - docker-compose -f docker-compose.yml build test - docker-compose -f docker-compose.yml run test prove -Ilib -r -v t + docker compose run --rm app prove -lrv $(TEST_TARGET) diff --git a/cpanfile b/cpanfile index 7751aaf..361ceb4 100644 --- a/cpanfile +++ b/cpanfile @@ -18,7 +18,9 @@ requires 'DBIx::TransactionManager'; requires 'Regexp::Common'; requires 'Regexp::Assemble'; requires 'Text::Diff::FormattedHTML'; -requires 'Text::Markdown'; +requires 'YAML::Tiny'; # for Markdown::Perl +requires 'Unicode::CaseFold'; # for Markdown::Perl +requires 'Markdown::Perl' => '1.03'; requires 'SQL::Interp'; requires 'Carp::Clan'; requires 'JSON'; diff --git a/cpanfile.snapshot b/cpanfile.snapshot index ccbfbb0..b8b5237 100644 --- a/cpanfile.snapshot +++ b/cpanfile.snapshot @@ -19,6 +19,7 @@ DISTRIBUTIONS Amon2::Plugin::Web::NoCache undef Amon2::Plugin::Web::PlackSession undef Amon2::Plugin::Web::Streaming undef + Amon2::Plugin::Web::Streaming::Writer undef Amon2::Plugin::Web::WebSocket undef Amon2::Setup::Asset::Blueprint undef Amon2::Setup::Asset::Bootstrap undef @@ -125,46 +126,6 @@ DISTRIBUTIONS requirements: ExtUtils::MakeMaker 0 Test::More 0 - CPAN-Meta-2.150010 - pathname: D/DA/DAGOLDEN/CPAN-Meta-2.150010.tar.gz - provides: - CPAN::Meta 2.150010 - CPAN::Meta::Converter 2.150010 - CPAN::Meta::Feature 2.150010 - CPAN::Meta::History 2.150010 - CPAN::Meta::Merge 2.150010 - CPAN::Meta::Prereqs 2.150010 - CPAN::Meta::Spec 2.150010 - CPAN::Meta::Validator 2.150010 - Parse::CPAN::Meta 2.150010 - requirements: - CPAN::Meta::Requirements 2.121 - CPAN::Meta::YAML 0.011 - Carp 0 - Encode 0 - Exporter 0 - ExtUtils::MakeMaker 6.17 - File::Spec 0.80 - JSON::PP 2.27300 - Scalar::Util 0 - perl 5.008001 - strict 0 - version 0.88 - warnings 0 - CPAN-Meta-YAML-0.018 - pathname: D/DA/DAGOLDEN/CPAN-Meta-YAML-0.018.tar.gz - provides: - CPAN::Meta::YAML 0.018 - requirements: - B 0 - Carp 0 - Exporter 0 - ExtUtils::MakeMaker 6.17 - Fcntl 0 - Scalar::Util 0 - perl 5.008001 - strict 0 - warnings 0 Cache-Cache-1.08 pathname: R/RJ/RJBS/Cache-Cache-1.08.tar.gz provides: @@ -200,21 +161,17 @@ DISTRIBUTIONS Canary::Stability 2013 requirements: ExtUtils::MakeMaker 0 - Capture-Tiny-0.48 - pathname: D/DA/DAGOLDEN/Capture-Tiny-0.48.tar.gz + Carp-Assert-More-2.4.0 + pathname: P/PE/PETDANCE/Carp-Assert-More-2.4.0.tar.gz provides: - Capture::Tiny 0.48 + Carp::Assert::More 2.004000 requirements: Carp 0 - Exporter 0 - ExtUtils::MakeMaker 6.17 - File::Spec 0 - File::Temp 0 - IO::Handle 0 + ExtUtils::MakeMaker 0 Scalar::Util 0 - perl 5.006 - strict 0 - warnings 0 + Test::Exception 0 + Test::More 0.18 + perl 5.010001 Carp-Clan-6.08 pathname: E/ET/ETHER/Carp-Clan-6.08.tar.gz provides: @@ -601,6 +558,8 @@ DISTRIBUTIONS DateTime::Duration 1.55 DateTime::Helpers 1.55 DateTime::Infinite 1.55 + DateTime::Infinite::Future 1.55 + DateTime::Infinite::Past 1.55 DateTime::LeapSecond 1.55 DateTime::PP 1.55 DateTime::PPExtra 1.55 @@ -1077,13 +1036,6 @@ DISTRIBUTIONS Test::More 0.98 parent 0 perl 5.008001 - Devel-PPPort-3.63 - pathname: A/AT/ATOOMIC/Devel-PPPort-3.63.tar.gz - provides: - Devel::PPPort 3.63 - requirements: - ExtUtils::MakeMaker 0 - FindBin 0 Devel-StackTrace-2.04 pathname: D/DR/DROLSKY/Devel-StackTrace-2.04.tar.gz provides: @@ -1129,6 +1081,7 @@ DISTRIBUTIONS Digest::SHA3 1.04 requirements: ExtUtils::MakeMaker 0 + perl 5.003 Dist-CheckConflicts-0.11 pathname: D/DO/DOY/Dist-CheckConflicts-0.11.tar.gz provides: @@ -1141,42 +1094,6 @@ DISTRIBUTIONS base 0 strict 0 warnings 0 - Encode-3.16 - pathname: D/DA/DANKOGAI/Encode-3.16.tar.gz - provides: - Encode 3.16 - Encode::Alias 2.24 - Encode::Byte 2.04 - Encode::CJKConstants 2.02 - Encode::CN 2.03 - Encode::CN::HZ 2.10 - Encode::Config 2.05 - Encode::EBCDIC 2.02 - Encode::Encoder 2.03 - Encode::Encoding 2.08 - Encode::GSM0338 2.10 - Encode::Guess 2.08 - Encode::JP 2.05 - Encode::JP::H2Z 2.02 - Encode::JP::JIS7 2.08 - Encode::KR 2.03 - Encode::KR::2022_KR 2.04 - Encode::MIME::Header 2.28 - Encode::MIME::Header::ISO_2022_JP 1.09 - Encode::MIME::Name 1.03 - Encode::Symbol 2.02 - Encode::TW 2.03 - Encode::UTF_EBCDIC 3.16 - Encode::Unicode 2.19 - Encode::Unicode::UTF7 2.10 - Encode::XS 3.16 - Encode::utf8 3.16 - encoding 3.00 - requirements: - Exporter 5.57 - ExtUtils::MakeMaker 0 - Storable 0 - parent 0.221 Encode-Locale-1.05 pathname: G/GA/GAAS/Encode-Locale-1.05.tar.gz provides: @@ -1191,6 +1108,8 @@ DISTRIBUTIONS provides: Error 0.17029 Error::Simple 0.17029 + Error::WarnDie 0.17029 + Error::subs 0.17029 requirements: Carp 0 Exporter 0 @@ -1288,78 +1207,18 @@ DISTRIBUTIONS perl 5.006 strict 0 warnings 0 - ExtUtils-MakeMaker-7.64 - pathname: B/BI/BINGOS/ExtUtils-MakeMaker-7.64.tar.gz - provides: - DynaLoader 7.64 - ExtUtils::Command 7.64 - ExtUtils::Command::MM 7.64 - ExtUtils::Liblist 7.64 - ExtUtils::Liblist::Kid 7.64 - ExtUtils::MM 7.64 - ExtUtils::MM_AIX 7.64 - ExtUtils::MM_Any 7.64 - ExtUtils::MM_BeOS 7.64 - ExtUtils::MM_Cygwin 7.64 - ExtUtils::MM_DOS 7.64 - ExtUtils::MM_Darwin 7.64 - ExtUtils::MM_MacOS 7.64 - ExtUtils::MM_NW5 7.64 - ExtUtils::MM_OS2 7.64 - ExtUtils::MM_OS390 7.64 - ExtUtils::MM_QNX 7.64 - ExtUtils::MM_UWIN 7.64 - ExtUtils::MM_Unix 7.64 - ExtUtils::MM_VMS 7.64 - ExtUtils::MM_VOS 7.64 - ExtUtils::MM_Win32 7.64 - ExtUtils::MM_Win95 7.64 - ExtUtils::MY 7.64 - ExtUtils::MakeMaker 7.64 - ExtUtils::MakeMaker::Config 7.64 - ExtUtils::MakeMaker::Locale 7.64 - ExtUtils::MakeMaker::_version 7.64 - ExtUtils::MakeMaker::charstar 7.64 - ExtUtils::MakeMaker::version 7.64 - ExtUtils::MakeMaker::version::regex 7.64 - ExtUtils::MakeMaker::version::vpp 7.64 - ExtUtils::Mkbootstrap 7.64 - ExtUtils::Mksymlists 7.64 - ExtUtils::testlib 7.64 - MM 7.64 - MY 7.64 - in 7.64 - requirements: - Data::Dumper 0 - Encode 0 - File::Basename 0 - File::Spec 0.8 - Pod::Man 0 - perl 5.006 - ExtUtils-ParseXS-3.35 - pathname: S/SM/SMUELLER/ExtUtils-ParseXS-3.35.tar.gz - provides: - ExtUtils::ParseXS 3.35 - ExtUtils::ParseXS::Constants 3.35 - ExtUtils::ParseXS::CountLines 3.35 - ExtUtils::ParseXS::Eval 3.35 - ExtUtils::ParseXS::Utilities 3.35 - ExtUtils::Typemaps 3.35 - ExtUtils::Typemaps::Cmd 3.35 - ExtUtils::Typemaps::InputMap 3.35 - ExtUtils::Typemaps::OutputMap 3.35 - ExtUtils::Typemaps::Type 3.35 + ExtUtils-MakeMaker-CPANfile-0.09 + pathname: I/IS/ISHIGAKI/ExtUtils-MakeMaker-CPANfile-0.09.tar.gz + provides: + ExtUtils::MakeMaker::CPANfile 0.09 requirements: - Carp 0 + CPAN::Meta::Converter 2.141170 Cwd 0 - DynaLoader 0 - Exporter 5.57 - ExtUtils::CBuilder 0 - ExtUtils::MakeMaker 6.46 - File::Basename 0 - File::Spec 0 - Symbol 0 - Test::More 0.47 + ExtUtils::MakeMaker 6.17 + File::Path 0 + Module::CPANfile 0 + Test::More 0.88 + version 0.76 File-Copy-Recursive-0.45 pathname: D/DM/DMUEY/File-Copy-Recursive-0.45.tar.gz provides: @@ -1490,6 +1349,30 @@ DISTRIBUTIONS ExtUtils::MakeMaker 6.59 Module::Build::Tiny 0.035 perl 5.008001 + HTML-Form-6.11 + pathname: S/SI/SIMBABQUE/HTML-Form-6.11.tar.gz + provides: + HTML::Form 6.11 + HTML::Form::FileInput 6.11 + HTML::Form::IgnoreInput 6.11 + HTML::Form::ImageInput 6.11 + HTML::Form::Input 6.11 + HTML::Form::KeygenInput 6.11 + HTML::Form::ListInput 6.11 + HTML::Form::SubmitInput 6.11 + HTML::Form::TextInput 6.11 + requirements: + Carp 0 + Encode 2 + ExtUtils::MakeMaker 0 + HTML::TokeParser 0 + HTTP::Request 6 + HTTP::Request::Common 6.03 + Test::More 0.96 + URI 1.10 + parent 0 + perl 5.008001 + strict 0 HTML-Parser-3.76 pathname: O/OA/OALDERS/HTML-Parser-3.76.tar.gz provides: @@ -1697,22 +1580,6 @@ DISTRIBUTIONS Time::HiRes 0 parent 0 perl 5.008005 - HTTP-Tiny-0.080 - pathname: D/DA/DAGOLDEN/HTTP-Tiny-0.080.tar.gz - provides: - HTTP::Tiny 0.080 - requirements: - Carp 0 - ExtUtils::MakeMaker 6.17 - Fcntl 0 - IO::Socket 0 - MIME::Base64 0 - Socket 0 - Time::Local 0 - bytes 0 - perl 5.006 - strict 0 - warnings 0 Hash-MultiValue-0.16 pathname: A/AR/ARISTOTLE/Hash-MultiValue-0.16.tar.gz provides: @@ -1730,14 +1597,6 @@ DISTRIBUTIONS Exporter 5.57 ExtUtils::MakeMaker 0 perl 5.008 - IO-Socket-IP-0.41 - pathname: P/PE/PEVANS/IO-Socket-IP-0.41.tar.gz - provides: - IO::Socket::IP 0.41 - requirements: - IO::Socket 0 - Module::Build 0.4004 - Socket 1.97 IPC-Signal-1.00 pathname: R/RO/ROSCH/IPC-Signal-1.00.tar.gz provides: @@ -1755,7 +1614,6 @@ DISTRIBUTIONS JSON-MaybeXS-1.004003 pathname: E/ET/ETHER/JSON-MaybeXS-1.004003.tar.gz provides: - ExtUtils::HasCompiler 0.021 JSON::MaybeXS 1.004003 requirements: Carp 0 @@ -1764,16 +1622,6 @@ DISTRIBUTIONS JSON::PP 2.27300 Scalar::Util 0 perl 5.006 - JSON-PP-4.07 - pathname: I/IS/ISHIGAKI/JSON-PP-4.07.tar.gz - provides: - JSON::PP 4.07 - JSON::PP::Boolean 4.07 - JSON::PP::IncrParser 4.07 - requirements: - ExtUtils::MakeMaker 0 - Scalar::Util 1.08 - Test::More 0 JSON-XS-4.03 pathname: M/ML/MLEHMANN/JSON-XS-4.03.tar.gz provides: @@ -1846,6 +1694,19 @@ DISTRIBUTIONS requirements: ExtUtils::MakeMaker 0 perl 5.006 + Markdown-Perl-1.03 + pathname: M/MA/MATHIAS/Dist-Setup/Markdown-Perl-1.03.tar.gz + provides: + App::pmarkdown 1.03 + Markdown::Perl 1.03 + Markdown::Perl::BlockParser 0.01 + Markdown::Perl::HTML 0.01 + Markdown::Perl::InlineNode 0.01 + Markdown::Perl::InlineTree 0.01 + Markdown::Perl::Inlines 0.01 + Markdown::Perl::Options 0.01 + Markdown::Perl::Util 0.01 + requirements: Module-Build-0.4231 pathname: L/LE/LEONT/Module-Build-0.4231.tar.gz provides: @@ -2006,7 +1867,7 @@ DISTRIBUTIONS Mouse-v2.5.10 pathname: S/SK/SKAJI/Mouse-v2.5.10.tar.gz provides: - Mouse 2.005010 + Mouse v2.5.10 Mouse::Exporter undef Mouse::Meta::Attribute undef Mouse::Meta::Class undef @@ -2018,15 +1879,16 @@ DISTRIBUTIONS Mouse::Meta::Module undef Mouse::Meta::Role undef Mouse::Meta::Role::Application undef + Mouse::Meta::Role::Application::RoleSummation undef Mouse::Meta::Role::Composite undef Mouse::Meta::Role::Method undef Mouse::Meta::TypeConstraint undef Mouse::Object undef Mouse::PurePerl undef - Mouse::Role 2.005010 - Mouse::Spec 2.005010 + Mouse::Role v2.5.10 + Mouse::Spec v2.5.10 Mouse::TypeRegistry undef - Mouse::Util 2.005010 + Mouse::Util v2.5.10 Mouse::Util::MetaRole undef Mouse::Util::TypeConstraints undef Squirrel undef @@ -2290,46 +2152,22 @@ DISTRIBUTIONS Digest::SHA 0 Module::Build::Tiny 0.034 Plack 0.9910 - Pod-Perldoc-3.28 - pathname: M/MA/MALLEN/Pod-Perldoc-3.28.tar.gz - provides: - Pod::Perldoc 3.28 - Pod::Perldoc::BaseTo 3.28 - Pod::Perldoc::GetOptsOO 3.28 - Pod::Perldoc::ToANSI 3.28 - Pod::Perldoc::ToChecker 3.28 - Pod::Perldoc::ToMan 3.28 - Pod::Perldoc::ToNroff 3.28 - Pod::Perldoc::ToPod 3.28 - Pod::Perldoc::ToRtf 3.28 - Pod::Perldoc::ToTerm 3.28 - Pod::Perldoc::ToText 3.28 - Pod::Perldoc::ToTk 3.28 - Pod::Perldoc::ToXml 3.28 - requirements: - Config 0 - Encode 0 - ExtUtils::MakeMaker 0 - Fcntl 0 - File::Spec::Functions 0 - File::Temp 0.22 - IO::Select 0 - Pod::Man 2.18 - Pod::Simple::RTF 3.16 - Pod::Simple::XMLOutStream 3.16 - Pod::Text 0 - Symbol 0 - Test::More 0 - Text::ParseWords 0 - parent 0 - strict 0 - warnings 0 Proc-Wait3-0.05 pathname: C/CT/CTILMES/Proc-Wait3-0.05.tar.gz provides: Proc::Wait3 0.05 requirements: ExtUtils::MakeMaker 0 + Readonly-2.05 + pathname: S/SA/SANKO/Readonly-2.05.tar.gz + provides: + Readonly 2.05 + Readonly::Array undef + Readonly::Hash undef + Readonly::Scalar undef + requirements: + Module::Build::Tiny 0.035 + perl 5.005 Regexp-Assemble-0.38 pathname: R/RS/RSAVAGE/Regexp-Assemble-0.38.tgz provides: @@ -2430,7 +2268,11 @@ DISTRIBUTIONS pathname: Y/YO/YORHEL/SQL-Interp-1.27.tar.gz provides: DBIx::Interp 1.27 + DBIx::Interp::STX undef + DBIx::Interp::db undef SQL::Interp 1.27 + SQL::Interp::SQL undef + SQL::Interp::Variable undef requirements: DBI 1 Module::Build 0.38 @@ -2468,16 +2310,6 @@ DISTRIBUTIONS Test::Requires 0 Tie::IxHash 0 perl 5.008001 - Scalar-List-Utils-1.60 - pathname: P/PE/PEVANS/Scalar-List-Utils-1.60.tar.gz - provides: - List::Util 1.60 - List::Util::XS 1.60 - Scalar::Util 1.60 - Sub::Util 1.60 - requirements: - ExtUtils::MakeMaker 0 - perl 5.006 Scope-Guard-0.21 pathname: C/CH/CHOCOLATE/Scope-Guard-0.21.tar.gz provides: @@ -2619,8 +2451,6 @@ DISTRIBUTIONS Sub-Exporter-Progressive-0.001013 pathname: F/FR/FREW/Sub-Exporter-Progressive-0.001013.tar.gz provides: - A::Junk undef - A::JunkAll undef Sub::Exporter::Progressive 0.001013 requirements: ExtUtils::MakeMaker 0 @@ -2651,6 +2481,22 @@ DISTRIBUTIONS perl 5.006 strict 0 warnings 0 + Term-Table-0.018 + pathname: E/EX/EXODIST/Term-Table-0.018.tar.gz + provides: + Term::Table 0.018 + Term::Table::Cell 0.018 + Term::Table::CellStack 0.018 + Term::Table::HashBase 0.018 + Term::Table::LineBreak 0.018 + Term::Table::Spacer 0.018 + Term::Table::Util 0.018 + requirements: + Carp 0 + ExtUtils::MakeMaker 0 + List::Util 0 + Scalar::Util 0 + perl 5.008001 Test-Base-0.89 pathname: I/IN/INGY/Test-Base-0.89.tar.gz provides: @@ -2724,16 +2570,6 @@ DISTRIBUTIONS List::Util 1.09 Scalar::Util 1.09 Test::Builder 0 - Test-Differences-0.68 - pathname: D/DC/DCANTRELL/Test-Differences-0.68.tar.gz - provides: - Test::Differences 0.68 - requirements: - Capture::Tiny 0.24 - Data::Dumper 2.126 - ExtUtils::MakeMaker 0 - Test::More 0.88 - Text::Diff 1.43 Test-Exception-0.43 pathname: E/EX/EXODIST/Test-Exception-0.43.tar.gz provides: @@ -2762,60 +2598,14 @@ DISTRIBUTIONS Try::Tiny 0.07 strict 0 warnings 0 - Test-Harness-3.42 - pathname: L/LE/LEONT/Test-Harness-3.42.tar.gz - provides: - App::Prove 3.42 - App::Prove::State 3.42 - App::Prove::State::Result 3.42 - App::Prove::State::Result::Test 3.42 - Harness::Hook undef - TAP::Base 3.42 - TAP::Formatter::Base 3.42 - TAP::Formatter::Color 3.42 - TAP::Formatter::Console 3.42 - TAP::Formatter::Console::ParallelSession 3.42 - TAP::Formatter::Console::Session 3.42 - TAP::Formatter::File 3.42 - TAP::Formatter::File::Session 3.42 - TAP::Formatter::Session 3.42 - TAP::Harness 3.42 - TAP::Harness::Env 3.42 - TAP::Object 3.42 - TAP::Parser 3.42 - TAP::Parser::Aggregator 3.42 - TAP::Parser::Grammar 3.42 - TAP::Parser::Iterator 3.42 - TAP::Parser::Iterator::Array 3.42 - TAP::Parser::Iterator::Process 3.42 - TAP::Parser::Iterator::Stream 3.42 - TAP::Parser::IteratorFactory 3.42 - TAP::Parser::Multiplexer 3.42 - TAP::Parser::Result 3.42 - TAP::Parser::Result::Bailout 3.42 - TAP::Parser::Result::Comment 3.42 - TAP::Parser::Result::Plan 3.42 - TAP::Parser::Result::Pragma 3.42 - TAP::Parser::Result::Test 3.42 - TAP::Parser::Result::Unknown 3.42 - TAP::Parser::Result::Version 3.42 - TAP::Parser::Result::YAML 3.42 - TAP::Parser::ResultFactory 3.42 - TAP::Parser::Scheduler 3.42 - TAP::Parser::Scheduler::Job 3.42 - TAP::Parser::Scheduler::Spinner 3.42 - TAP::Parser::Source 3.42 - TAP::Parser::SourceHandler 3.42 - TAP::Parser::SourceHandler::Executable 3.42 - TAP::Parser::SourceHandler::File 3.42 - TAP::Parser::SourceHandler::Handle 3.42 - TAP::Parser::SourceHandler::Perl 3.42 - TAP::Parser::SourceHandler::RawTAP 3.42 - TAP::Parser::YAMLish::Reader 3.42 - TAP::Parser::YAMLish::Writer 3.42 - Test::Harness 3.42 + Test-LongString-0.17 + pathname: R/RG/RGARCIA/Test-LongString-0.17.tar.gz + provides: + Test::LongString 0.17 requirements: ExtUtils::MakeMaker 0 + Test::Builder 0.12 + Test::Builder::Tester 1.04 Test-Requires-0.11 pathname: T/TO/TOKUHIROM/Test-Requires-0.11.tar.gz provides: @@ -2853,18 +2643,173 @@ DISTRIBUTIONS Test::SharedFork 0.29 Time::HiRes 0 perl 5.008001 - Text-Diff-1.45 - pathname: N/NE/NEILB/Text-Diff-1.45.tar.gz + Test-WWW-Mechanize-1.60 + pathname: P/PE/PETDANCE/Test-WWW-Mechanize-1.60.tar.gz provides: - Text::Diff 1.45 - Text::Diff::Base 1.45 - Text::Diff::Config 1.44 - Text::Diff::Table 1.44 + Test::WWW::Mechanize 1.60 requirements: - Algorithm::Diff 1.19 - Exporter 0 + Carp 0 + Carp::Assert::More 1.16 + ExtUtils::MakeMaker 0 + HTML::Form 0 + HTML::TokeParser 0 + HTTP::Message 6.29 + LWP 6.02 + Test::Builder 0 + Test::LongString 0.15 + WWW::Mechanize 1.68 + parent 0 + perl 5.010 + Test-WWW-Mechanize-PSGI-0.39 + pathname: O/OA/OALDERS/Test-WWW-Mechanize-PSGI-0.39.tar.gz + provides: + Test::WWW::Mechanize::PSGI 0.39 + requirements: + Carp 0 ExtUtils::MakeMaker 0 + HTTP::Message::PSGI 0 + Test::WWW::Mechanize 0 + Try::Tiny 0 + base 0 perl 5.006 + strict 0 + warnings 0 + Test2-Suite-0.000159 + pathname: E/EX/EXODIST/Test2-Suite-0.000159.tar.gz + provides: + Test2::AsyncSubtest 0.000159 + Test2::AsyncSubtest::Event::Attach 0.000159 + Test2::AsyncSubtest::Event::Detach 0.000159 + Test2::AsyncSubtest::Formatter 0.000159 + Test2::AsyncSubtest::Hub 0.000159 + Test2::Bundle 0.000159 + Test2::Bundle::Extended 0.000159 + Test2::Bundle::More 0.000159 + Test2::Bundle::Simple 0.000159 + Test2::Compare 0.000159 + Test2::Compare::Array 0.000159 + Test2::Compare::Bag 0.000159 + Test2::Compare::Base 0.000159 + Test2::Compare::Bool 0.000159 + Test2::Compare::Custom 0.000159 + Test2::Compare::DeepRef 0.000159 + Test2::Compare::Delta 0.000159 + Test2::Compare::Event 0.000159 + Test2::Compare::EventMeta 0.000159 + Test2::Compare::Float 0.000159 + Test2::Compare::Hash 0.000159 + Test2::Compare::Isa 0.000159 + Test2::Compare::Meta 0.000159 + Test2::Compare::Negatable 0.000159 + Test2::Compare::Number 0.000159 + Test2::Compare::Object 0.000159 + Test2::Compare::OrderedSubset 0.000159 + Test2::Compare::Pattern 0.000159 + Test2::Compare::Ref 0.000159 + Test2::Compare::Regex 0.000159 + Test2::Compare::Scalar 0.000159 + Test2::Compare::Set 0.000159 + Test2::Compare::String 0.000159 + Test2::Compare::Undef 0.000159 + Test2::Compare::Wildcard 0.000159 + Test2::Manual 0.000159 + Test2::Manual::Anatomy 0.000159 + Test2::Manual::Anatomy::API 0.000159 + Test2::Manual::Anatomy::Context 0.000159 + Test2::Manual::Anatomy::EndToEnd 0.000159 + Test2::Manual::Anatomy::Event 0.000159 + Test2::Manual::Anatomy::Hubs 0.000159 + Test2::Manual::Anatomy::IPC 0.000159 + Test2::Manual::Anatomy::Utilities 0.000159 + Test2::Manual::Concurrency 0.000159 + Test2::Manual::Contributing 0.000159 + Test2::Manual::Testing 0.000159 + Test2::Manual::Testing::Introduction 0.000159 + Test2::Manual::Testing::Migrating 0.000159 + Test2::Manual::Testing::Planning 0.000159 + Test2::Manual::Testing::Todo 0.000159 + Test2::Manual::Tooling 0.000159 + Test2::Manual::Tooling::FirstTool 0.000159 + Test2::Manual::Tooling::Formatter 0.000159 + Test2::Manual::Tooling::Nesting 0.000159 + Test2::Manual::Tooling::Plugin::TestExit 0.000159 + Test2::Manual::Tooling::Plugin::TestingDone 0.000159 + Test2::Manual::Tooling::Plugin::ToolCompletes 0.000159 + Test2::Manual::Tooling::Plugin::ToolStarts 0.000159 + Test2::Manual::Tooling::Subtest 0.000159 + Test2::Manual::Tooling::TestBuilder 0.000159 + Test2::Manual::Tooling::Testing 0.000159 + Test2::Mock 0.000159 + Test2::Plugin 0.000159 + Test2::Plugin::BailOnFail 0.000159 + Test2::Plugin::DieOnFail 0.000159 + Test2::Plugin::ExitSummary 0.000159 + Test2::Plugin::SRand 0.000159 + Test2::Plugin::Times 0.000159 + Test2::Plugin::UTF8 0.000159 + Test2::Require 0.000159 + Test2::Require::AuthorTesting 0.000159 + Test2::Require::EnvVar 0.000159 + Test2::Require::Fork 0.000159 + Test2::Require::Module 0.000159 + Test2::Require::Perl 0.000159 + Test2::Require::RealFork 0.000159 + Test2::Require::Threads 0.000159 + Test2::Suite 0.000159 + Test2::Todo 0.000159 + Test2::Tools 0.000159 + Test2::Tools::AsyncSubtest 0.000159 + Test2::Tools::Basic 0.000159 + Test2::Tools::Class 0.000159 + Test2::Tools::ClassicCompare 0.000159 + Test2::Tools::Compare 0.000159 + Test2::Tools::Defer 0.000159 + Test2::Tools::Encoding 0.000159 + Test2::Tools::Event 0.000159 + Test2::Tools::Exception 0.000159 + Test2::Tools::Exports 0.000159 + Test2::Tools::GenTemp 0.000159 + Test2::Tools::Grab 0.000159 + Test2::Tools::Mock 0.000159 + Test2::Tools::Ref 0.000159 + Test2::Tools::Refcount 0.000159 + Test2::Tools::Spec 0.000159 + Test2::Tools::Subtest 0.000159 + Test2::Tools::Target 0.000159 + Test2::Tools::Tester 0.000159 + Test2::Tools::Warnings 0.000159 + Test2::Util::Grabber 0.000159 + Test2::Util::Guard 0.000159 + Test2::Util::Importer 0.000159 + Test2::Util::Ref 0.000159 + Test2::Util::Stash 0.000159 + Test2::Util::Sub 0.000159 + Test2::Util::Table 0.000159 + Test2::Util::Table::Cell 0.000159 + Test2::Util::Table::LineBreak 0.000159 + Test2::Util::Term 0.000159 + Test2::Util::Times 0.000159 + Test2::V0 0.000159 + Test2::Workflow 0.000159 + Test2::Workflow::BlockBase 0.000159 + Test2::Workflow::Build 0.000159 + Test2::Workflow::Runner 0.000159 + Test2::Workflow::Task 0.000159 + Test2::Workflow::Task::Action 0.000159 + Test2::Workflow::Task::Group 0.000159 + requirements: + B 0 + Carp 0 + Data::Dumper 0 + Exporter 0 + ExtUtils::MakeMaker 0 + Scalar::Util 0 + Term::Table 0.013 + Test2::API 1.302176 + Time::HiRes 0 + overload 0 + perl 5.008001 + utf8 0 Text-Diff-FormattedHTML-0.08 pathname: A/AM/AMBS/Text-Diff-FormattedHTML-0.08.tar.gz provides: @@ -2884,20 +2829,6 @@ DISTRIBUTIONS ExtUtils::MakeMaker 0 constant 0 perl 5.005030 - Text-Markdown-1.000031 - pathname: B/BO/BOBTFISH/Text-Markdown-1.000031.tar.gz - provides: - Text::Markdown 1.000031 - requirements: - Digest::MD5 0 - Encode 0 - ExtUtils::MakeMaker 6.42 - FindBin 0 - List::MoreUtils 0 - Test::Differences 0 - Test::Exception 0 - Test::More 0.42 - Text::Balanced 0 Text-Xslate-Bridge-TT2Like-0.00010 pathname: D/DM/DMAKI/Text-Xslate-Bridge-TT2Like-0.00010.tar.gz provides: @@ -2910,14 +2841,15 @@ DISTRIBUTIONS Text-Xslate-v3.5.9 pathname: S/SK/SKAJI/Text-Xslate-v3.5.9.tar.gz provides: - Text::Xslate 3.005009 + Text::Xslate v3.5.9 Text::Xslate::Bridge undef Text::Xslate::Bridge::Star undef Text::Xslate::Compiler undef + Text::Xslate::Engine v3.5.9 Text::Xslate::HashWithDefault undef - Text::Xslate::PP 3.005009 + Text::Xslate::PP v3.5.9 Text::Xslate::PP::Method undef - Text::Xslate::PP::Opcode 3.005009 + Text::Xslate::PP::Opcode v3.5.9 Text::Xslate::PP::State undef Text::Xslate::PP::Type::Macro undef Text::Xslate::PP::Type::Pair undef @@ -2948,17 +2880,6 @@ DISTRIBUTIONS requirements: Test::More 0 perl 5.005 - Time-Local-1.30 - pathname: D/DR/DROLSKY/Time-Local-1.30.tar.gz - provides: - Time::Local 1.30 - requirements: - Carp 0 - Exporter 0 - ExtUtils::MakeMaker 0 - constant 0 - parent 0 - strict 0 TimeDate-2.33 pathname: A/AT/ATOOMIC/TimeDate-2.33.tar.gz provides: @@ -3034,6 +2955,9 @@ DISTRIBUTIONS Type::Library 1.012004 Type::Params 1.012004 Type::Parser 1.012004 + Type::Parser::AstBuilder undef + Type::Parser::Token undef + Type::Parser::TokenStream undef Type::Registry 1.012004 Type::Tiny 1.012004 Type::Tiny::Class 1.012004 @@ -3074,7 +2998,6 @@ DISTRIBUTIONS UNIVERSAL-require-0.19 pathname: N/NE/NEILB/UNIVERSAL-require-0.19.tar.gz provides: - UNIVERSAL 0.19 UNIVERSAL::require 0.19 requirements: Carp 0 @@ -3148,6 +3071,19 @@ DISTRIBUTIONS strict 0 utf8 0 warnings 0 + Unicode-CaseFold-1.01 + pathname: A/AR/ARODLAND/Unicode-CaseFold-1.01.tar.gz + provides: + Unicode::CaseFold 1.01 + requirements: + Exporter 0 + ExtUtils::CBuilder 0 + Module::Build 0.28 + Scalar::Util 1.11 + Unicode::UCD 0 + perl 5.008001 + strict 0 + warnings 0 Variable-Magic-0.62 pathname: V/VP/VPIT/Variable-Magic-0.62.tar.gz provides: @@ -3176,6 +3112,33 @@ DISTRIBUTIONS Exporter 0 Module::Build 0.4005 perl 5.008001 + WWW-Mechanize-2.18 + pathname: O/OA/OALDERS/WWW-Mechanize-2.18.tar.gz + provides: + WWW::Mechanize 2.18 + WWW::Mechanize::Image 2.18 + WWW::Mechanize::Link 2.18 + requirements: + Carp 0 + ExtUtils::MakeMaker 0 + Getopt::Long 0 + HTML::Form 6.08 + HTML::HeadParser 0 + HTML::TokeParser 0 + HTML::TreeBuilder 5 + HTTP::Cookies 0 + HTTP::Request 1.30 + HTTP::Request::Common 0 + LWP::UserAgent 0 + Pod::Usage 0 + Scalar::Util 1.14 + Tie::RefHash 0 + URI::URL 0 + URI::file 0 + base 0 + perl 5.008 + strict 0 + warnings 0 WWW-RobotRules-6.02 pathname: G/GA/GAAS/WWW-RobotRules-6.02.tar.gz provides: @@ -3266,13 +3229,6 @@ DISTRIBUTIONS requirements: ExtUtils::MakeMaker 0 Test::More 0 - XSLoader-0.24 - pathname: S/SA/SAPER/XSLoader-0.24.tar.gz - provides: - XSLoader undef - requirements: - ExtUtils::MakeMaker 0 - Test::More 0.47 XString-0.005 pathname: A/AT/ATOOMIC/XString-0.005.tar.gz provides: @@ -3308,6 +3264,20 @@ DISTRIBUTIONS requirements: ExtUtils::MakeMaker 0 perl 5.008001 + YAML-Tiny-1.74 + pathname: E/ET/ETHER/YAML-Tiny-1.74.tar.gz + provides: + YAML::Tiny 1.74 + requirements: + B 0 + Carp 0 + Exporter 0 + ExtUtils::MakeMaker 0 + Fcntl 0 + Scalar::Util 0 + perl 5.008001 + strict 0 + warnings 0 bareword-filehandles-0.007 pathname: I/IL/ILMARI/bareword-filehandles-0.007.tar.gz provides: @@ -3390,7 +3360,7 @@ DISTRIBUTIONS HTTP::Request 6 HTTP::Request::Common 6 HTTP::Response 6 - HTTP::Status 6.18 + HTTP::Status 6.07 IO::Select 0 IO::Socket 0 LWP::MediaTypes 6 @@ -3454,14 +3424,3 @@ DISTRIBUTIONS indirect 0 multidimensional 0 perl 5.006 - version-0.9929 - pathname: L/LE/LEONT/version-0.9929.tar.gz - provides: - charstar 0.9929 - version 0.9929 - version::regex 0.9929 - version::vpp 0.9929 - version::vxs 0.9929 - requirements: - ExtUtils::MakeMaker 0 - perl 5.006002 diff --git a/cpanfile.target b/cpanfile.target new file mode 100644 index 0000000..fe8451d --- /dev/null +++ b/cpanfile.target @@ -0,0 +1 @@ +332cda1c4fe6b66ec104651d3ecd68e190696d64b87940f77294d6497b7b4899 cpanfile diff --git a/docker-compose.yml b/docker-compose.yml index a28b8de..7364271 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,14 +1,12 @@ version: '3' services: - web: + app: build: context: . - target: web + target: app ports: - - "8080:5000" - - test: - build: - context: . - target: test + - "8080:8080" + command: ./local/bin/plackup -p 8080 -r -Ilib app.psgi + volumes: + - ./lib:/usr/src/app/lib diff --git a/lib/PJP.pm b/lib/PJP.pm index a067074..a4dba75 100644 --- a/lib/PJP.pm +++ b/lib/PJP.pm @@ -1,10 +1,12 @@ package PJP; use strict; use warnings; +use feature qw(state); use parent qw/Amon2/; our $VERSION='0.01'; use 5.01000; +use Markdown::Perl; use Amon2::Config::Simple; sub load_config { Amon2::Config::Simple->load(shift) } @@ -58,10 +60,13 @@ sub abstract_title_description_from_md { ($abstract) = $1; } if ($abstract) { - $abstract = Text::Markdown->new->markdown($abstract); + state $md = Markdown::Perl->new(mode => 'github'); + $abstract = $md->convert($abstract); ($abstract) = $abstract =~ m{^

(.+?)

}; } - $abstract =~ s{<.*?>}{}g; + if ($abstract) { + $abstract =~ s{<.*?>}{}g; + } return ($title, $abstract); } diff --git a/lib/PJP/M/PodFile.pm b/lib/PJP/M/PodFile.pm index 59f9c72..9479dd0 100644 --- a/lib/PJP/M/PodFile.pm +++ b/lib/PJP/M/PodFile.pm @@ -1,6 +1,7 @@ use strict; use warnings; use utf8; +use feature qw(state); package PJP::M::PodFile; use Amon2::Declare; @@ -12,7 +13,7 @@ use File::Basename; use version; use PJP::M::Index::Article; use PJP::M::BuiltinFunction; -use Text::Markdown; +use Markdown::Perl; sub slurp { my ($class, $path) = @_; @@ -277,8 +278,8 @@ sub generate_one_file_md { $package or die "cannot get package name: $relpath"; - my $md = Text::Markdown->new; - my $html = $md->markdown($md_src); + state $md = Markdown::Perl->new(mode => 'github'); + my $html = $md->convert($md_src); $distvname =~ s!/.+!!; +{ diff --git a/lib/PJP/Web/Dispatcher.pm b/lib/PJP/Web/Dispatcher.pm index 8d0e969..dcb623a 100644 --- a/lib/PJP/Web/Dispatcher.pm +++ b/lib/PJP/Web/Dispatcher.pm @@ -2,6 +2,7 @@ package PJP::Web::Dispatcher; use strict; use warnings; use utf8; +use feature qw(state); use Amon2::Web::Dispatcher::Lite; @@ -17,7 +18,8 @@ use PJP::M::Pod; use PJP::M::PodFile; use Regexp::Common qw/URI/; use URI::Escape qw/uri_escape/; -use Text::Markdown; +use Markdown::Perl; +use Encode qw(decode_utf8); get '/' => sub { my $c = shift; @@ -373,16 +375,12 @@ get '/docs/{path:articles/.+\.md}' => sub { my $src = PJP::M::PodFile->slurp($p->{path}) // return $c->res_404(); my ($title, $abstract) = $c->abstract_title_description_from_md($src); - my $md = Text::Markdown->new; - my $html = $md->markdown($src); + state $md = Markdown::Perl->new(mode => 'github'); + my $html = $md->convert($src); $html =~ s{^.*<(?:body)[^>]*>}{}si; $html =~ s{.*$}{}si; - $html =~ s{\n\n}{
$1
}sg; - $html =~ s{~~~(?:\s*(sh|perl)\s+)?(.+?)\s*~~~} - {'
$2
}}seg; - $html =~ s{

```

\s*
\s*

(?:\s*(sh|perl)\s+)?(.+?)```

\s*
} - {'
$2
}}seg; + $html =~ s{}{
$1
}sg; return $c->render('pod.tt', {