[Catalyst-commits] r9453 - in trunk/examples/SmokeServer: . lib
script
t0m at dev.catalyst.perl.org
t0m at dev.catalyst.perl.org
Sat Mar 7 20:34:07 GMT 2009
Author: t0m
Date: 2009-03-07 20:34:06 +0000 (Sat, 07 Mar 2009)
New Revision: 9453
Modified:
trunk/examples/SmokeServer/Makefile.PL
trunk/examples/SmokeServer/lib/SmokeRepos.pm
trunk/examples/SmokeServer/script/smokeserver_repository.pl
Log:
Moosify the client test runner module, add ability to specify arbitrary tags on the CLI, so that I can smoke runtime_branch.trunk and runtime_branch.register_actions and you can filter by them..
Modified: trunk/examples/SmokeServer/Makefile.PL
===================================================================
--- trunk/examples/SmokeServer/Makefile.PL 2009-03-07 20:07:47 UTC (rev 9452)
+++ trunk/examples/SmokeServer/Makefile.PL 2009-03-07 20:34:06 UTC (rev 9453)
@@ -3,6 +3,8 @@
name 'SmokeServer';
all_from 'lib/SmokeServer.pm';
+requires 'Moose';
+requires 'MooseX::Types::Moose';
requires 'YAML::Syck';
requires Catalyst => '5.64';
requires 'DBIx::Class' => '0.08012';
Modified: trunk/examples/SmokeServer/lib/SmokeRepos.pm
===================================================================
--- trunk/examples/SmokeServer/lib/SmokeRepos.pm 2009-03-07 20:07:47 UTC (rev 9452)
+++ trunk/examples/SmokeServer/lib/SmokeRepos.pm 2009-03-07 20:34:06 UTC (rev 9453)
@@ -1,8 +1,7 @@
package SmokeRepos;
-use warnings;
-use strict;
-
+use Moose;
+use MooseX::Types::Moose qw/Str Int ArrayRef/;
use Config;
use File::Basename;
use File::Path;
@@ -62,44 +61,18 @@
=cut
-use base qw/Class::Accessor/;
-__PACKAGE__->mk_ro_accessors(qw/server config_file simulate/);
-__PACKAGE__->mk_accessors(
- qw/_added_to_inc _env_stack _checkout_paths _config projects iterations/);
-
+has [qw/ _added_to_inc _env_stack _checkout_paths _config projects /] => ( is => 'rw' );
+has iterations => ( is => 'ro', isa => Str, required => 1, default => 'inf' );
+has server => ( is => 'ro', isa => Str, required => 1 );
+has simulate => ( is => 'ro', isa => Int, default => 0 );
+has config_file => ( is => 'ro', isa => Str, required => 1 );
+has tags => ( is => 'ro', isa => ArrayRef[Str], required => 1, default => sub { [] } );
+has projects => ( is => 'ro', isa => ArrayRef[Str], required => 1, default => sub { [] } );
# add a signal handler so destructor gets run
$SIG{INT} = sub {print "caught sigint. cleaning up...\n"; exit(1)};
-sub new {
- my $class = shift;
- my $obj = bless {}, $class;
- $obj->_init(@_);
- return $obj;
-}
-
-sub _init {
+sub BUILD{
my $self = shift;
- my %args = validate_with(
- params => \@_,
- spec => {
- server => 1,
- config_file => 1,
- simulate => 0,
- iterations => {
- optional => 1,
- default => 'inf'
- },
- projects => {
- optional => 1,
- default => 'all'
- }
- },
- called => 'The SmokeRepos constructor'
- );
-
- foreach my $key (keys %args) {
- $self->{$key} = $args{$key};
- }
$self->_added_to_inc([]);
$self->_env_stack([]);
$self->_checkout_paths([]);
@@ -107,7 +80,7 @@
$self->_config(LoadFile($self->config_file));
}
-sub DESTROY {
+sub DEMOLISH {
my $self = shift;
foreach my $tmpdir (@{$self->_checkout_paths}) {
_remove_tmpdir($tmpdir);
@@ -200,6 +173,7 @@
'osname.' . $Config{osname},
'osvers.' . $Config{osvers},
'archname.' . $Config{archname},
+ @{ $self->{tags} },
);
my ($status, $msg);
Modified: trunk/examples/SmokeServer/script/smokeserver_repository.pl
===================================================================
--- trunk/examples/SmokeServer/script/smokeserver_repository.pl 2009-03-07 20:07:47 UTC (rev 9452)
+++ trunk/examples/SmokeServer/script/smokeserver_repository.pl 2009-03-07 20:34:06 UTC (rev 9453)
@@ -12,12 +12,14 @@
my $config_file = File::Spec->catfile($ENV{HOME}, 'smoker-config.yml');
my $iterations = 'inf';
my $projects = 'all';
+my $tags = '';
my $help = 0;
GetOptions("server|s=s", \$server,
"config_file|c=s", \$config_file,
"iterations|i=i", \$iterations,
"projects|p=s", \$projects,
+ "tags|t=s", \$tags,
"help|h", \$help)
|| pod2usage(-exitval => 2,
-verbose => 1);
@@ -43,9 +45,12 @@
$projects = [split /,/, $projects];
}
+my @tags = split /,\s*/, $tags if $tags;
+
my $poller = SmokeRepos->new(
server => $server,
- config_file => $config_file
+ config_file => $config_file,
+ tags => [ @tags ],
);
$poller->smoke(iterations => $iterations,
More information about the Catalyst-commits
mailing list