File mojolicious-deprecate-spurt.patch of Package perl-Mojolicious-Plugin-AssetPack
From 56b27ac3059f07fea0938cbd4bb59ba6e755a3c6 Mon Sep 17 00:00:00 2001
From: Oliver Kurz <okurz@suse.de>
Date: Tue, 19 Sep 2023 12:17:49 +0200
Subject: [PATCH] Adapt to deprecation of spurt in upstream Mojolicious
---
Makefile.PL | 2 +-
lib/Mojolicious/Plugin/AssetPack/Pipe/RollupJs.pm | 2 +-
lib/Mojolicious/Plugin/AssetPack/Store.pm | 4 ++--
t/Helper.pm | 6 +++---
t/recreate.t | 6 +++---
7 files changed, 14 insertions(+), 11 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index a7c078ec..b052d136 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -12,7 +12,7 @@ WriteMakefile(
ABSTRACT_FROM => 'lib/Mojolicious/Plugin/AssetPack.pm',
VERSION_FROM => 'lib/Mojolicious/Plugin/AssetPack.pm',
TEST_REQUIRES => {'Test::More' => '0.88'},
- PREREQ_PM => {'File::Which' => '1.21', 'IPC::Run3' => '0.048', 'Mojolicious' => '9.0'},
+ PREREQ_PM => {'File::Which' => '1.21', 'IPC::Run3' => '0.048', 'Mojolicious' => '9.34'},
META_MERGE => {
'dynamic_config' => 0,
'meta-spec' => {version => 2},
diff --git a/lib/Mojolicious/Plugin/AssetPack/Pipe/RollupJs.pm b/lib/Mojolicious/Plugin/AssetPack/Pipe/RollupJs.pm
index d4f72630..a8a62045 100644
--- a/lib/Mojolicious/Plugin/AssetPack/Pipe/RollupJs.pm
+++ b/lib/Mojolicious/Plugin/AssetPack/Pipe/RollupJs.pm
@@ -46,7 +46,7 @@ has _rollupjs => sub {
$self->{_rollupjs_src} = tempfile(SUFFIX => '.js');
}
- $self->{_rollupjs_src}->spurt($bin);
+ $self->{_rollupjs_src}->spew($bin);
return [$self->_find_app([qw(nodejs node)]), $self->{_rollupjs_src}->realpath];
};
diff --git a/lib/Mojolicious/Plugin/AssetPack/Store.pm b/lib/Mojolicious/Plugin/AssetPack/Store.pm
index f591589b..8095f78b 100644
--- a/lib/Mojolicious/Plugin/AssetPack/Store.pm
+++ b/lib/Mojolicious/Plugin/AssetPack/Store.pm
@@ -139,7 +139,7 @@ sub save {
return $self->asset_class->new(%$attrs, content => $$ref) unless -w $dir;
- $path->spurt($$ref);
+ $path->spew($$ref);
$self->_db_set(%$attrs);
return $self->asset_class->new(%$attrs, path => $path);
}
@@ -288,7 +288,7 @@ sub _download {
$path = path($self->paths->[0], $self->_url2path($attrs{url}, $attrs{format}));
$self->_log->info(qq(Caching "$url" to "$path".));
$path->dirname->make_path unless -d $path->dirname;
- $path->spurt($tx->res->body);
+ $path->spew($tx->res->body);
}
$attrs{url} = "$attrs{url}";
diff --git a/t/Helper.pm b/t/Helper.pm
index 55cdc151..ae3f0f84 100644
--- a/t/Helper.pm
+++ b/t/Helper.pm
@@ -17,11 +17,11 @@ END { cleanup() }
my %CREATED_FILES;
unless ($ENV{TEST_KEEP_FILES}) {
- my $spurt = \&Mojo::File::spurt;
+ my $spew = \&Mojo::File::spew;
Mojo::Util::monkey_patch(
- 'Mojo::File' => spurt => sub {
+ 'Mojo::File' => spew => sub {
$CREATED_FILES{$_[0]} = 1 unless -e $_[0];
- goto $spurt;
+ goto $spew;
}
);
}
diff --git a/t/recreate.t b/t/recreate.t
index 20a4e335..3e2415ee 100644
--- a/t/recreate.t
+++ b/t/recreate.t
@@ -14,7 +14,7 @@ my $t = t::Helper->t(pipes => [qw(Css Combine)]);
my @assets = qw(one.css recreate.css);
my $recreate = path(qw(t assets recreate.css));
-$recreate->spurt(".recreate { color: #aaa }\n");
+$recreate->spew(".recreate { color: #aaa }\n");
$t->app->asset->process('app.css' => @assets);
@@ -28,7 +28,7 @@ $t->get_ok('/')->status_is(200);
is $t->tx->res->dom->at('link')->{href}, $link, 'same link href';
# recreate
-$recreate->spurt(".recreate { color: #bbb }\n");
+$recreate->spew(".recreate { color: #bbb }\n");
my $tr = t::Helper->t(pipes => [qw(Css Combine)]);
$tr->app->asset->process('app.css' => @assets);
$tr->get_ok('/')->status_is(200);
@@ -36,7 +36,7 @@ isnt $tr->tx->res->dom->at('link')->{href}, $link, 'changed link href';
$tr->get_ok($tr->tx->res->dom->at('link')->{href})->status_is(200)->content_like(qr{color:\#bbb});
# reset asset
-$recreate->spurt(".recreate { color: #aaa }\n");
+$recreate->spew(".recreate { color: #aaa }\n");
done_testing;
__DATA__