Skip to content

Instantly share code, notes, and snippets.

@preaction
preaction / outline.md
Last active December 5, 2019 16:02
CPAN Testers Network - Outline

CPAN Testers Network

Goals

  1. Reduce the live database set of the primary CPAN Testers servers
    1. Mostly-static data that does not need deep querying should be removed from the database
  2. Allow individuals to run CPAN Testers databases (schema, backend, api) for their own internal use
    1. Must have an easy way to run a single node that contains a database, backend, and API
    2. Must have an easy way to configure a tester to submit to the internal node
  3. Must have a web app to show the status of the local testing infrastructure
use v5.28;
use warnings;
use experimental qw( signatures postderef );
use version;
use Data::Printer;
use MetaCPAN::Client;
my $mcpan = MetaCPAN::Client->new;
@preaction
preaction / cpantesters-docker-compose.md
Created June 22, 2019 21:54
Work with the CPAN Testers docker-compose development environment
@preaction
preaction / vack.bash
Created February 22, 2019 17:03
Useful shell functions / scripts
vack() {
# Takes a keyword as an argument, acks current directory, opens a vim session
# with a tab for each file with a match found, and puts the keyword in the @/
# register, so that you can `n` through matches.
my_search=$(ack -l "$1")
if [[ -z $my_search ]]
then
echo "No results found for $1"
else
args=(--cmd "let @/=\"$1\"" -p )
package Local::Plugin::MyPlugin;
use Mojo::Base 'Mojolicious::Plugin';
sub cached_thing {
state $cache = 'expensive';
return $cache;
}
sub register {
my ( $self, $app, $conf ) = @_;
$app->helper( myplugin => sub { $self } );
}
#!/usr/bin/env perl
use Mojolicious::Lite;
use Time::HiRes qw( time );
plugin Minion => {
SQLite => 'sqlite:' . app->home->child('minion.db'),
};
app->minion->add_task(
package Local::Controller::Kubernetes;
BEGIN { $INC{'Local/Controller/Kubernetes.pm'} = __FILE__ }
use Mojo::Base 'Mojolicious::Controller';
sub log { shift->render( text => "Hello, World" ) }
package main;
use Mojolicious::Lite;
unshift @{ app->routes->namespaces }, 'Local::Controller';
app->routes->get( '/' )->to( 'kubernetes#log' );
app->start;
package Local::Format;
BEGIN { $INC{'Local/Format.pm'} = __FILE__ };
sub new {
my ( $class, %opt ) = @_;
$opt{delimiter} ||= ',';
return bless \%opt, $class;
}
package Local::Format::csv;
### -- Failure timeout after 60 seconds
$ curl -O http://api.cpantesters.org/v3/release
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 76 100 76 0 0 1 0 0:01:16 0:01:00 0:00:16 18
$ head -c 60 release
{ "message" :"The API is temporarily unavailable. Please try%
### -- Bypass Fastly, success in 2.5 minutes
$ curl -O http://api-3.cpantesters.org/v3/release
<head>
<link rel="stylesheet" type="text/css" href="print.css" media="print" />
</head>
<!DOCTYPE html>
<html dir="ltr" lang="en-gb">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1" />