Skip to content

Commit

Permalink
Replace deprecated use of spurt with spew
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusramberg committed Sep 26, 2023
1 parent b63e246 commit 2dfab36
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion lib/Convos/Core/Backend/File.pm
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ sub save_object_p {
eval {
my $dir = $storage_file->dirname;
$dir->make_path($dir) unless -d $dir;
$swap_file->spurt(Mojo::JSON::encode_json($obj->TO_JSON('private')));
$swap_file->spew(Mojo::JSON::encode_json($obj->TO_JSON('private')));
die "Failed to write $swap_file" unless -s $swap_file;
$swap_file->move_to($storage_file);
$obj->logf(debug => 'Save success. (%s)', $storage_file);
Expand Down
2 changes: 1 addition & 1 deletion t/plugin-bot-join-part.t
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ done_testing;
sub write_config {
my $config = data_section('main', shift);
$config =~ s!\bCONVOS_DEFAULT_CONNECTION\b!{$server->url->to_string}!ge;
$core->home->child($ENV{CONVOS_BOT_EMAIL}, 'bot.yaml')->spurt($config);
$core->home->child($ENV{CONVOS_BOT_EMAIL}, 'bot.yaml')->spew($config);
}

__DATA__
Expand Down
2 changes: 1 addition & 1 deletion t/plugin-bot-spool.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ my $server = t::Server::Irc->new->start;
my $bot = $t->app->bot;
my $spool = Convos::Plugin::Bot::Action::Spool->new;
$spool->register($bot, {});
$spool->_dir->child('whatever.yml')->spurt(test_file());
$spool->_dir->child('whatever.yml')->spew(test_file());

my $connection = $bot->user->connection({url => 'irc://localhost'});
my $event;
Expand Down
6 changes: 3 additions & 3 deletions t/plugin-bot.t
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ subtest 'register bot' => sub {

subtest 'load two_actions.yaml' => sub {
my $config_file = config_file();
$config_file->spurt(config('two_actions.yaml'));
$config_file->spew(config('two_actions.yaml'));
Mojo::Promise->timer(0.05)->wait;
ok $bot->action($_), "$_ present" for qw(core karma);
ok !$bot->action('hailo'), "Convos::Plugin::Bot::Action::Hailo not present";
Expand All @@ -53,7 +53,7 @@ subtest 'load all_actions.yaml' => sub {
->server_event_ok('_irc_event_mode', sub { $msg = pop })->server_event_ok('_irc_event_join');

my $config_file = config_file();
$config_file->spurt(config('all_actions.yaml'));
$config_file->spew(config('all_actions.yaml'));
$server->process_ok('mode +B');
ok $bot->action('hailo'), 'action by a-z';
ok $bot->action('Hailo'), 'action by A-Z';
Expand All @@ -75,7 +75,7 @@ subtest 'make sure we do not reply multiple times when reloading config' => sub
my $config_file = config_file();
for my $name (qw(two_actions.yaml all_actions.yaml all_actions.yaml)) {
delete $bot->config->data->{ts};
$config_file->spurt(config($name));
$config_file->spew(config($name));
Mojo::Promise->timer(0.1)->wait;
}
ok 1, 'no tests are run here';
Expand Down
4 changes: 2 additions & 2 deletions t/web-cms.t
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ subtest 'default index file' => sub {

subtest 'custom index file' => sub {
$cms_dir->make_path;
$cms_dir->child('index.md')->spurt("# Custom index\n\nToo cool for school!\n");
$cms_dir->child('index.md')->spew("# Custom index\n\nToo cool for school!\n");
$t->get_ok('/')->status_is(200)->header_is('X-Provider-Name', undef)
->element_exists(qq(meta[name="convos:start_app"][content=""]))->element_exists('body.for-cms')
->element_exists('body.for-cms > article')->text_is('title', 'Custom index - Convos')
Expand All @@ -49,7 +49,7 @@ HERE

$t->get_ok('/blog/2020/5/17/too-cool.html')->status_is(404);
$cms_dir->child(qw(blog 2020))->make_path;
$cms_dir->child(qw(blog 2020 2020-05-17-too-cool.md))->spurt(<<"HERE");
$cms_dir->child(qw(blog 2020 2020-05-17-too-cool.md))->spew(<<"HERE");
---
title: Cool title
author: Jan Henning Thorsen
Expand Down
4 changes: 2 additions & 2 deletions t/web-themes.t
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ my $t = t::Helper->t;
my $v = $t->app->VERSION;

my $user_themes = Mojo::File->new($t->app->config('home'), 'themes');
$user_themes->child('README.md')->spurt("# skip this\n");
$user_themes->child('MyTheme.css')->spurt("/* custom theme */");
$user_themes->child('README.md')->spew("# skip this\n");
$user_themes->child('MyTheme.css')->spew("/* custom theme */");
$t->app->themes->detect;

$t->get_ok('/')->status_is(200)->element_exists('link[id$="dark-convos"][title="Convos (dark)"]')
Expand Down
2 changes: 1 addition & 1 deletion t/web-webhook-github.t
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ done_testing;
sub write_config {
my $config = data_section('main', shift);
$config =~ s!\bCONVOS_DEFAULT_CONNECTION\b!{$server->url->to_string}!ge;
$core->home->child($ENV{CONVOS_BOT_EMAIL}, 'bot.yaml')->spurt($config);
$core->home->child($ENV{CONVOS_BOT_EMAIL}, 'bot.yaml')->spew($config);
}

__DATA__
Expand Down

0 comments on commit 2dfab36

Please sign in to comment.