Skip to content

Commit

Permalink
Update DB and Server code post-ui merge
Browse files Browse the repository at this point in the history
  • Loading branch information
exodist committed Jun 10, 2024
1 parent b082dfb commit b7b7000
Show file tree
Hide file tree
Showing 100 changed files with 3,189 additions and 2,135 deletions.
12 changes: 6 additions & 6 deletions Makefile.PL
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,10 @@ my %WriteMakefileArgs = (
"DBIx::Class::UUIDColumns" => 0,
"DBIx::QuickDB" => "0.000020",
"Data::Dumper" => 0,
"Data::GUID" => 0,
"Data::UUID" => 0,
"DateTime" => 0,
"DateTime::Format::MySQL" => 0,
"DateTime::Format::Pg" => 0,
"DateTime::Format::SQLite" => 0,
"Email::Sender::Simple" => 0,
"Email::Simple" => 0,
"Email::Simple::Creator" => 0,
Expand Down Expand Up @@ -114,7 +113,7 @@ my %WriteMakefileArgs = (
"Test2::Event::V2" => "1.302198",
"Test2::Formatter" => "1.302198",
"Test2::Plugin::MemUsage" => "0.002003",
"Test2::Plugin::UUID" => "0.002001",
"Test2::Plugin::UUID" => "0.002008",
"Test2::Tools::AsyncSubtest" => "0.000159",
"Test2::Tools::Basic" => 0,
"Test2::Tools::Compare" => 0,
Expand All @@ -128,6 +127,7 @@ my %WriteMakefileArgs = (
"Test2::V0" => "0.000159",
"Test::Builder" => "1.302198",
"Test::Builder::Formatter" => "1.302198",
"Test::Harness" => "3.49",
"Test::More" => "1.302198",
"Text::ParseWords" => 0,
"Text::Xslate" => 0,
Expand Down Expand Up @@ -176,11 +176,10 @@ my %FallbackPrereqs = (
"DBIx::Class::UUIDColumns" => 0,
"DBIx::QuickDB" => "0.000020",
"Data::Dumper" => 0,
"Data::GUID" => 0,
"Data::UUID" => 0,
"DateTime" => 0,
"DateTime::Format::MySQL" => 0,
"DateTime::Format::Pg" => 0,
"DateTime::Format::SQLite" => 0,
"Email::Sender::Simple" => 0,
"Email::Simple" => 0,
"Email::Simple::Creator" => 0,
Expand Down Expand Up @@ -234,7 +233,7 @@ my %FallbackPrereqs = (
"Test2::Formatter" => "1.302198",
"Test2::Plugin::MemUsage" => "0.002003",
"Test2::Plugin::NoWarnings" => 0,
"Test2::Plugin::UUID" => "0.002001",
"Test2::Plugin::UUID" => "0.002008",
"Test2::Tools::AsyncSubtest" => "0.000159",
"Test2::Tools::Basic" => 0,
"Test2::Tools::Compare" => 0,
Expand All @@ -249,6 +248,7 @@ my %FallbackPrereqs = (
"Test2::V0" => "0.000159",
"Test::Builder" => "1.302198",
"Test::Builder::Formatter" => "1.302198",
"Test::Harness" => "3.49",
"Test::More" => "1.302198",
"Text::ParseWords" => 0,
"Text::Xslate" => 0,
Expand Down
11 changes: 8 additions & 3 deletions cpanfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,10 @@ requires "DBIx::Class::Tree::AdjacencyList" => "0";
requires "DBIx::Class::UUIDColumns" => "0";
requires "DBIx::QuickDB" => "0.000020";
requires "Data::Dumper" => "0";
requires "Data::GUID" => "0";
requires "Data::UUID" => "0";
requires "DateTime" => "0";
requires "DateTime::Format::MySQL" => "0";
requires "DateTime::Format::Pg" => "0";
requires "DateTime::Format::SQLite" => "0";
requires "Email::Sender::Simple" => "0";
requires "Email::Simple" => "0";
requires "Email::Simple::Creator" => "0";
Expand Down Expand Up @@ -73,7 +72,7 @@ requires "Test2::Event" => "1.302198";
requires "Test2::Event::V2" => "1.302198";
requires "Test2::Formatter" => "1.302198";
requires "Test2::Plugin::MemUsage" => "0.002003";
requires "Test2::Plugin::UUID" => "0.002001";
requires "Test2::Plugin::UUID" => "0.002008";
requires "Test2::Tools::AsyncSubtest" => "0.000159";
requires "Test2::Tools::Basic" => "0";
requires "Test2::Tools::Compare" => "0";
Expand All @@ -87,6 +86,7 @@ requires "Test2::Util::Times" => "0";
requires "Test2::V0" => "0.000159";
requires "Test::Builder" => "1.302198";
requires "Test::Builder::Formatter" => "1.302198";
requires "Test::Harness" => "3.49";
requires "Test::More" => "1.302198";
requires "Text::ParseWords" => "0";
requires "Text::Xslate" => "0";
Expand All @@ -103,7 +103,10 @@ suggests "Class::XSAccessor" => "1.19";
suggests "Cpanel::JSON::XS" => "0";
suggests "DBD::Pg" => "0";
suggests "DBD::mysql" => "0";
suggests "DBIx::Class::Storage::DBI::MariaDB" => "0";
suggests "DBIx::Class::Storage::DBI::mysql::Retryable" => "0";
suggests "Data::UUID" => "1.227";
suggests "Data::UUID::MT" => "1.001";
suggests "Email::Stuffer" => "0.016";
suggests "HTTP::Tiny" => "0.070";
suggests "HTTP::Tiny::Multipart" => "0.08";
Expand All @@ -114,6 +117,8 @@ suggests "Term::ANSIColor" => "4.06";
suggests "Test2::Plugin::Cover" => "0.000025";
suggests "Test2::Plugin::DBIProfile" => "0.002002";
suggests "Test2::Plugin::IOEvents" => "0.001001";
suggests "UUID" => "0.35";
suggests "UUID::Tiny" => "1.04";
suggests "Win32::Console::ANSI" => "0";

on 'test' => sub {
Expand Down
10 changes: 7 additions & 3 deletions dist.ini
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,10 @@ DBI = 0
DBIx::Class::UUIDColumns = 0
DBIx::QuickDB = 0.000020
Data::Dumper = 0
Data::GUID = 0
Data::UUID = 0
DateTime = 0
DateTime::Format::MySQL = 0
DateTime::Format::Pg = 0
DateTime::Format::SQLite = 0
Email::Sender::Simple = 0
Email::Simple = 0
Email::Simple::Creator = 0
Expand Down Expand Up @@ -131,7 +130,7 @@ Test2::Event = 1.302198
Test2::Event::V2 = 1.302198
Test2::Formatter = 1.302198
Test2::Plugin::MemUsage = 0.002003
Test2::Plugin::UUID = 0.002001
Test2::Plugin::UUID = 0.002008
Test2::Tools::AsyncSubtest = 0.000159
Test2::Tools::Basic = 0
Test2::Tools::Compare = 0
Expand Down Expand Up @@ -200,7 +199,12 @@ System::Info = 0.064
Cpanel::JSON::XS = 0
DBD::Pg = 0
DBD::mysql = 0
UUID = 0.35
Data::UUID = 1.227
UUID::Tiny = 1.04
Data::UUID::MT = 1.001

DBIx::Class::Storage::DBI::MariaDB = 0
DBIx::Class::Storage::DBI::mysql::Retryable = 0

[MakeMaker::Awesome]
Expand Down
78 changes: 46 additions & 32 deletions lib/App/Yath.pm
Original file line number Diff line number Diff line change
Expand Up @@ -104,29 +104,40 @@ sub cli_help {
my $opts = $options->docs('cli', groups => {':{' => '}:'}, group => $params{group}, settings => $settings, color => $self->use_color);

my $script = File::Spec->abs2rel($settings->yath->script // $0);
my $usage = '';
my $append = '';
if ($self->use_color) {
$usage = join ' ' => (
color('bold white') . "USAGE:" . color('reset'),
color('white') . $script,
color('cyan') . "[YATH OPTIONS]",
color('bold green') . $cmd . color('reset'),
color('cyan') . "[OPTIONS FOR COMMAND AND/OR YATH]",
color('yellow') . "[--]",
);

$append = ($cmd_class && $cmd_class->args_include_tests) ? ' ' . join " " => (
color('white') . "[ARGUMENTS/TESTS]",
color('green') . "[TEST :{ ARGS TO PASS TO TEST }:]",
color('magenta') . "[:: PASS-THROUGH]" . color('reset')
) : color('white') . " [ARGUMENTS]";
}
else {
$usage = "USAGE: $script [YATH OPTIONS] $cmd [OPTIONS FOR COMMAND AND/OR YATH] [--]";
$append = ($cmd_class && $cmd_class->args_include_tests) ? " [ARGUMENTS/TESTS] [TEST :{ ARGS TO PASS TO TEST }:] [:: PASS-THROUGH]" : " [ARGUMENTS]";
my $colors = {reset => ''};
if ($self->use_color) {
$colors = {
reset => color('reset'),
usage => color('bold white'),
script => color('white'),
yath_opts => color('cyan'),
command => color('bold green'),
cmd_opts => color('cyan'),
'--a' => color('yellow'),
'--b' => color('yellow'),
arguments => color('white'),
tests => color('green'),
dot_args => color('magenta'),
};
}

my $parts = {
usage => "USAGE:",
script => $script,
yath_opts => "[YATH OPTIONS]",
command => $cmd,
cmd_opts => "[OPTIONS FOR COMMAND AND/OR YATH]",
($cmd_class->cli_args || $cmd_class->args_include_tests) ? ('--a' => "[[--]", '--b' => ']') : (),
$cmd_class->args_include_tests ? (tests => "[TEST :{ ARGS TO PASS TO TEST }:]") : (),
$cmd_class->cli_args ? (arguments => $cmd_class->cli_args) : (),
$cmd_class->accepts_dot_args ? (dot_args => $cmd_class->cli_dot || "[:: PASS-THROUGH]") : (),
};

my $usage = join " " => map { ($colors->{$_} || '') . $parts->{$_} . $colors->{reset} } grep { $parts->{$_} } qw/usage script yath_opts command cmd_opts --a tests arguments/;
$usage .= ($colors->{'--b'} || '') . $parts->{'--b'} . $colors->{'reset'} if $parts->{'--b'};
$usage .= " " . ($colors->{'dot_args'} || '') . $parts->{'dot_args'} . $colors->{'reset'} if $parts->{'dot_args'};

my $end = "";
if ($settings->yath->help && !$params{group}) {
$end = $self->_render_groups(
Expand All @@ -135,16 +146,16 @@ sub cli_help {
);
}

return "${usage}${append}\n${help}\n${opts}\n${end}";
return "${usage}\n${help}\n${opts}\n${end}";
}

sub _strip_color {
my $self = shift;
my ($colors, $line) = @_;
return $line unless $self->use_color;

my $pattern = join '|' => map { "\Q$_\E"} values %$colors;
$line =~ s/($pattern)//g;
my $pattern = join '|' => map { "\Q$_\E"} grep { $_ } values %$colors;
$line =~ s/($pattern)//g if $pattern;

return $line;
}
Expand Down Expand Up @@ -345,6 +356,8 @@ sub load_command {
$self->include_options('plugins' => 'App::Yath::Plugin::*') if $cmd_class->load_plugins();
$self->include_options('resource' => 'App::Yath::Resource::*') if $cmd_class->load_resources();
$self->include_options('renderer' => 'App::Yath::Renderer::*') if $cmd_class->load_renderers();

return $cmd_class;
}

sub process_args {
Expand All @@ -365,7 +378,7 @@ sub process_args {

my $state = $self->_process_global_args($argv);

my $cmd;
my ($cmd, $cmd_class);

if (my $stop = $state->{stop}) {
my @cmd_args;
Expand Down Expand Up @@ -410,25 +423,26 @@ sub process_args {
@{$state->{remains} // []},
);

$self->load_command($cmd) if $cmd;
$cmd_class = $self->load_command($cmd) if $cmd;

$state = $self->_process_command_args(\@cmd_args, cmd => $cmd);
}

$cmd //= 'do';
$cmd_class //= 'App::Yath::Command::do';

my $test_args;
my $dot_args;
$argv = [@{$state->{skipped}}];
if (my $stop = $state->{stop}) {
if ($stop eq '--') {
for my $arg (@{$state->{remains}}) {
if ($test_args) { push @$test_args => $arg }
elsif ($arg eq '::') { $test_args //= [] }
if ($dot_args) { push @$dot_args => $arg }
elsif ($arg eq '::') { $dot_args //= [] }
else { push @$argv => $arg }
}
}
elsif ($stop eq '::') {
$test_args = [@{$state->{remains}}];
push @{$dot_args //= []} => @{$state->{remains}};
}
else {
push @$argv => ($stop, @{$state->{remains}});
Expand All @@ -438,9 +452,9 @@ sub process_args {
push @$argv => @{$state->{remains}};
}

if ($test_args) {
die "'::' cannot be used with the '$cmd' command" unless $settings->check_group('tests');
$settings->tests->option(args => $test_args);
if ($dot_args) {
die "'::' cannot be used with the '$cmd' command" unless $cmd_class->accepts_dot_args;
$cmd_class->set_dot_args($settings, $dot_args);
}

$self->{argv} = $argv;
Expand Down
6 changes: 5 additions & 1 deletion lib/App/Yath/Command.pm
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,24 @@ use Test2::Harness::Util qw/mod2file/;

use Test2::Harness::Util::HashBase qw/<settings <args <env_vars <option_state <plugins/;

sub accepts_dot_args { 0 }
sub args_include_tests { 0 }
sub internal_only { 0 }
sub summary { "No Summary" }
sub description { "No Description" }
sub group { "Z-FIXME" }

sub cli_args { }
sub cli_args { }
sub cli_dot { }

sub load_plugins { 0 }
sub load_resources { 0 }
sub load_renderers { 0 }

sub name { $_[0] =~ m/([^:=]+)(?:=.*)?$/; $1 || $_[0] }

sub set_dot_args { croak "set_dot_args is not implemented" }

sub run {
my $self = shift;

Expand Down
Empty file.
37 changes: 37 additions & 0 deletions lib/App/Yath/Command/client/recent.pm
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package App::Yath::Command::client::recent;
use strict;
use warnings;

our $VERSION = '2.000000';

use parent 'App::Yath::Command::recent';
use Test2::Harness::Util::HashBase;

use Getopt::Yath;

include_options(
'App::Yath::Options::Yath',
'App::Yath::Options::Recent',
'App::Yath::Options::WebClient',
);

sub summary { "Show a list of recent runs on a yathui server" }

sub description {
return <<" EOT";
This command will find the last several runs from a yath server
EOT
}

sub get_data {
my $self = shift;
my ($project, $count, $user) = @_;

return $self->get_from_http($project, $count, $user) // die "Could not get data from the server.\n";
}

1;

__END__
=head1 POD IS AUTO-GENERATED
Loading

0 comments on commit b7b7000

Please sign in to comment.