forked from pool/perl-Mojolicious-Plugin-Webpack
148 lines
5.7 KiB
Diff
148 lines
5.7 KiB
Diff
![]() |
From 399fb9eaffd42972837ab0c1359171578199fc30 Mon Sep 17 00:00:00 2001
|
||
|
From: Oliver Kurz <okurz@suse.de>
|
||
|
Date: Thu, 3 Jul 2025 20:46:40 +0200
|
||
|
Subject: [PATCH] Replace deprecated 'Mojo::File::spew' with 'spurt'
|
||
|
|
||
|
This fixes issues like observed in
|
||
|
https://github.com/openSUSE/qem-dashboard/actions/runs/16056912984/job/45313482646?pr=2666#step:11:13
|
||
|
|
||
|
```
|
||
|
Error: Mojo::File::spurt is deprecated in favor of Mojo::File::spew at /opt/hostedtoolcache/perl/5.40.2/x64/lib/site_perl/5.40.2/Mojo/Alien/webpack.pm line 187.
|
||
|
```
|
||
|
|
||
|
same as local test errors using a current Mojolicious distribution like
|
||
|
|
||
|
```
|
||
|
t/plugin-built.t ............. Mojo::File::spurt is deprecated in favor of Mojo::File::spew at t/plugin-built.t line 24.
|
||
|
Mojo::File::spurt is deprecated in favor of Mojo::File::spew at t/plugin-built.t line 32.
|
||
|
```
|
||
|
---
|
||
|
lib/Mojo/Alien/webpack.pm | 2 +-
|
||
|
t/alien-rollup-api.t | 2 +-
|
||
|
t/alien-rollup-files.t | 2 +-
|
||
|
t/alien-webpack-css.t | 4 ++--
|
||
|
t/alien-webpack-files.t | 2 +-
|
||
|
t/alien-webpack-js.t | 2 +-
|
||
|
t/plugin-build.t | 2 +-
|
||
|
t/plugin-built.t | 4 ++--
|
||
|
8 files changed, 10 insertions(+), 10 deletions(-)
|
||
|
|
||
|
diff --git a/lib/Mojo/Alien/webpack.pm b/lib/Mojo/Alien/webpack.pm
|
||
|
index a1d156b..82ad7eb 100644
|
||
|
--- a/lib/Mojo/Alien/webpack.pm
|
||
|
+++ b/lib/Mojo/Alien/webpack.pm
|
||
|
@@ -184,7 +184,7 @@ sub _render_file {
|
||
|
$self->_d('Render %s to %s', $name, $file) if DEBUG;
|
||
|
$file->dirname->make_path unless -d $file->dirname;
|
||
|
$content //= $self->_resources->{$name};
|
||
|
- $file->spurt(sprintf "// Autogenerated by %s %s\n%s", ref($self), $VERSION, $content);
|
||
|
+ $file->spew(sprintf "// Autogenerated by %s %s\n%s", ref($self), $VERSION, $content);
|
||
|
return $self;
|
||
|
}
|
||
|
|
||
|
diff --git a/t/alien-rollup-api.t b/t/alien-rollup-api.t
|
||
|
index 6243d5b..52d5271 100644
|
||
|
--- a/t/alien-rollup-api.t
|
||
|
+++ b/t/alien-rollup-api.t
|
||
|
@@ -24,7 +24,7 @@ subtest 'basic' => sub {
|
||
|
subtest 'build' => sub {
|
||
|
my $rollup = Mojo::Alien::rollup->new;
|
||
|
|
||
|
- $rollup->config->dirname->child(qw(assets))->make_path->child('index.js')->spurt("console.log(42);\n");
|
||
|
+ $rollup->config->dirname->child(qw(assets))->make_path->child('index.js')->spew("console.log(42);\n");
|
||
|
is $rollup->build, $rollup, 'build';
|
||
|
|
||
|
local $rollup->{binary} = '/no/such/bin/rollup';
|
||
|
diff --git a/t/alien-rollup-files.t b/t/alien-rollup-files.t
|
||
|
index 44a2ef5..e4ae09f 100644
|
||
|
--- a/t/alien-rollup-files.t
|
||
|
+++ b/t/alien-rollup-files.t
|
||
|
@@ -47,7 +47,7 @@ sub make_project_files {
|
||
|
for my $name (keys %$data) {
|
||
|
my $file = $rollup->assets_dir->child(split '/', $name);
|
||
|
$file->dirname->make_path;
|
||
|
- $file->spurt($data->{$name});
|
||
|
+ $file->spew($data->{$name});
|
||
|
}
|
||
|
|
||
|
return $data;
|
||
|
diff --git a/t/alien-webpack-css.t b/t/alien-webpack-css.t
|
||
|
index 0182954..bf0bb0e 100644
|
||
|
--- a/t/alien-webpack-css.t
|
||
|
+++ b/t/alien-webpack-css.t
|
||
|
@@ -9,8 +9,8 @@ note sprintf 'work_dir=%s', Mojo::Alien::npm->_setup_working_directory;
|
||
|
my $webpack = Mojo::Alien::webpack->new->include(['css']);
|
||
|
$webpack->assets_dir->make_path;
|
||
|
|
||
|
-my $index_css = $webpack->assets_dir->child('index.css')->spurt(qq[body { background: #fefefe; }\n]);
|
||
|
-my $index_js = $webpack->assets_dir->child('index.js')->spurt(qq[require('./index.css');]);
|
||
|
+my $index_css = $webpack->assets_dir->child('index.css')->spew(qq[body { background: #fefefe; }\n]);
|
||
|
+my $index_js = $webpack->assets_dir->child('index.js')->spew(qq[require('./index.css');]);
|
||
|
my $dist_file = $webpack->config->dirname->child('dist', 'alien-webpack-css-t.development.css');
|
||
|
|
||
|
is $webpack->build, $webpack, 'build css';
|
||
|
diff --git a/t/alien-webpack-files.t b/t/alien-webpack-files.t
|
||
|
index 6df86db..501db98 100644
|
||
|
--- a/t/alien-webpack-files.t
|
||
|
+++ b/t/alien-webpack-files.t
|
||
|
@@ -46,7 +46,7 @@ sub make_project_files {
|
||
|
for my $name (keys %$data) {
|
||
|
my $file = $webpack->assets_dir->child(split '/', $name);
|
||
|
$file->dirname->make_path;
|
||
|
- $file->spurt($data->{$name});
|
||
|
+ $file->spew($data->{$name});
|
||
|
}
|
||
|
|
||
|
return $data;
|
||
|
diff --git a/t/alien-webpack-js.t b/t/alien-webpack-js.t
|
||
|
index 3846d2b..3bf6145 100644
|
||
|
--- a/t/alien-webpack-js.t
|
||
|
+++ b/t/alien-webpack-js.t
|
||
|
@@ -7,7 +7,7 @@ plan skip_all => 'TEST_JS=1' unless $ENV{TEST_JS} or $ENV{TEST_ALL};
|
||
|
note sprintf 'work_dir=%s', Mojo::Alien::npm->_setup_working_directory;
|
||
|
|
||
|
my $webpack = Mojo::Alien::webpack->new->include(['js']);
|
||
|
-my $index_js = $webpack->assets_dir->make_path->child('index.js')->spurt(qq[console.log('built $^T');]);
|
||
|
+my $index_js = $webpack->assets_dir->make_path->child('index.js')->spew(qq[console.log('built $^T');]);
|
||
|
my $dist_file = $webpack->config->dirname->child('dist', 'alien-webpack-js-t.development.js');
|
||
|
|
||
|
is $webpack->build, $webpack, 'build js';
|
||
|
diff --git a/t/plugin-build.t b/t/plugin-build.t
|
||
|
index 3df0220..716f197 100644
|
||
|
--- a/t/plugin-build.t
|
||
|
+++ b/t/plugin-build.t
|
||
|
@@ -28,7 +28,7 @@ $t->get_ok('/asset/plugin-build-t.development.js')->status_is(200)->header_is('C
|
||
|
done_testing;
|
||
|
|
||
|
sub make_project_files {
|
||
|
- app->home->rel_file('assets')->make_path->child('index.js')->spurt('console.log(42);');
|
||
|
+ app->home->rel_file('assets')->make_path->child('index.js')->spew('console.log(42);');
|
||
|
}
|
||
|
|
||
|
__DATA__
|
||
|
diff --git a/t/plugin-built.t b/t/plugin-built.t
|
||
|
index 384c508..a74c6d3 100644
|
||
|
--- a/t/plugin-built.t
|
||
|
+++ b/t/plugin-built.t
|
||
|
@@ -21,7 +21,7 @@ done_testing;
|
||
|
|
||
|
sub make_project_files {
|
||
|
my $assets = app->home->rel_file('assets');
|
||
|
- $assets->child('webpack.config.d')->make_path->child('custom.js')->spurt(<<'HERE');
|
||
|
+ $assets->child('webpack.config.d')->make_path->child('custom.js')->spew(<<'HERE');
|
||
|
module.exports = function(config) {
|
||
|
config.entry = {
|
||
|
'cool': './assets/cool-beans.js',
|
||
|
@@ -29,7 +29,7 @@ module.exports = function(config) {
|
||
|
};
|
||
|
HERE
|
||
|
|
||
|
- $assets->child('cool-beans.js')->spurt('console.log(42);');
|
||
|
+ $assets->child('cool-beans.js')->spew('console.log(42);');
|
||
|
}
|
||
|
|
||
|
__DATA__
|
||
|
--
|
||
|
2.51.0
|
||
|
|