[Rt-commit] r5533 - in Test-Chimps/branches/dbi: bin lib/Test/Chimps
zev at bestpractical.com
zev at bestpractical.com
Wed Jul 5 18:23:54 EDT 2006
Author: zev
Date: Wed Jul 5 18:23:53 2006
New Revision: 5533
Added:
Test-Chimps/branches/dbi/bin/yaml2dbi.pl (contents, props changed)
Modified:
Test-Chimps/branches/dbi/ (props changed)
Test-Chimps/branches/dbi/bin/report_server.pl
Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm
Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm
Log:
r11229 at galvatron: zev | 2006-07-05 18:18:25 -0400
* added internal yaml->dbi script
* cache all of the total_* methods from Test::TAP::model in the database
* misc typos
Modified: Test-Chimps/branches/dbi/bin/report_server.pl
==============================================================================
--- Test-Chimps/branches/dbi/bin/report_server.pl (original)
+++ Test-Chimps/branches/dbi/bin/report_server.pl Wed Jul 5 18:23:53 2006
@@ -1,6 +1,6 @@
#!/usr/bin/env perl
-use lib '/home/zev/bps/Test-Chimps/branches/dbi/lib';
+use lib '/home/zev/bps/Test-Chimps-dbi/lib';
use Test::Chimps::Server;
Added: Test-Chimps/branches/dbi/bin/yaml2dbi.pl
==============================================================================
--- (empty file)
+++ Test-Chimps/branches/dbi/bin/yaml2dbi.pl Wed Jul 5 18:23:53 2006
@@ -0,0 +1,92 @@
+#!/usr/bin/env perl
+
+use warnings;
+use strict;
+
+use lib '/home/zev/bps/Test-Chimps-dbi/lib';
+
+use YAML::Syck;
+use Jifty::DBI::Handle;
+use Jifty::DBI::SchemaGenerator;
+use IO::Dir;
+use File::Spec;
+use Test::TAP::Model::Visual;
+use Test::Chimps::Report;
+
+package Test::Chimps::Report::Schema;
+
+column($_, type(is('text'))) for (
+ qw/
+ project
+ revision
+ committer
+ timestamp
+ duration
+ osname
+ osver
+ archname
+ /
+);
+
+package main;
+
+my $handle = Jifty::DBI::Handle->new();
+$handle->connect(driver => 'SQLite', database => '/home/zev/bps/database');
+my $sg = Jifty::DBI::SchemaGenerator->new($handle);
+$sg->add_model(Test::Chimps::Report->new(handle => $handle));
+
+$handle->simple_query($_) for $sg->create_table_sql_statements;
+
+my $rec = Test::Chimps::Report->new(handle => $handle);
+
+my $dir = shift;
+my $d = IO::Dir->new($dir)
+ or die "Could not open report directory: $dir: $!";
+while (defined(my $entry = $d->read)) {
+ next unless $entry =~ m/\.yml$/;
+ my $report = LoadFile(File::Spec->catfile($dir, $entry));
+ my $params = {};
+
+ $params->{model_structure} = $report->{model_structure};
+
+ foreach my $var (keys %{$report->{report_variables}}) {
+ $params->{$var} = $report->{report_variables}->{$var};
+ }
+ $params->{report_html} = $report->{report_text};
+
+ my $model = Test::TAP::Model::Visual->new_with_struct($report->{model_structure});
+ foreach my $var (
+ qw/
+ total_ok
+ total_passed
+ total_nok
+ total_failed
+ total_percentage
+ total_ratio
+ total_seen
+ total_skipped
+ total_todo
+ total_unexpectedly_succeeded
+ /)
+ {
+ $params->{$var} = $model->$var;
+ }
+
+ foreach my $var (qw/category subcategory/) {
+ delete $params->{$var};
+ }
+
+ if (exists $params->{author}) {
+ $params->{committer} = $params->{author};
+ delete $params->{author};
+ }
+
+# if ($report->{project} eq 'BTDT') {
+# $report->{project} = 'Hiveminder';
+# }
+
+# if ($report->{project} eq 'trunk') {
+# $report->{project} = '
+
+ $rec->create(%$params);
+}
Modified: Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm
==============================================================================
--- Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm (original)
+++ Test-Chimps/branches/dbi/lib/Test/Chimps/Report.pm Wed Jul 5 18:23:53 2006
@@ -48,12 +48,17 @@
use Jifty::DBI::Schema;
-column report_html => type is 'text';
-column model_structure => type is 'text';
-column total_ok => type is 'integer';
-column total_failed => type is 'integer';
-column total_todo => type is 'integer';
-column total_skipped => type is 'integer';
+column report_html => type is 'text';
+column model_structure => type is 'text';
+column total_ok => type is 'integer';
+column total_passed => type is 'integer';
+column total_nok => type is 'integer';
+column total_failed => type is 'integer';
+column total_percentage => type is 'integer';
+column total_ratio => type is 'integer';
+column total_seen => type is 'integer';
+column total_skipped => type is 'integer';
+column total_todo => type is 'integer';
column total_unexpectedly_succeeded => type is 'integer';
=head1 AUTHOR
Modified: Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm
==============================================================================
--- Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm (original)
+++ Test-Chimps/branches/dbi/lib/Test/Chimps/Server.pm Wed Jul 5 18:23:53 2006
@@ -347,7 +347,7 @@
$params->{$var} = $report_variables->{$var};
}
- my $model = Test::TAP::Model::Visual->new_with_structure($cgi->param('model_structure'));
+ my $model = Test::TAP::Model::Visual->new_with_struct($cgi->param('model_structure'));
foreach my $var (qw/total_ok total_failed total_todo
total_skipped total_unexpectedly_succeeded/) {
More information about the Rt-commit
mailing list