[Jifty-commit] jifty-plugin-emailerrors branch, master, updated. 4935728637c8d85c49cf47a507ac68bf610bf2d8

Jifty commits jifty-commit at lists.jifty.org
Fri Dec 10 16:48:51 EST 2010


The branch, master has been updated
       via  4935728637c8d85c49cf47a507ac68bf610bf2d8 (commit)
       via  4aabbb5b1e0f0bfda2fb88c00224adb477dea92b (commit)
       via  cea63308caf15472a66b9fba17290870ac6e3cfa (commit)
       via  ff2b84415747cf95b2320ced524b5265485f2f3f (commit)
       via  7dadd00f178620fafb3f6264d14b79bec7d92bbe (commit)
       via  bd8a62eb004e8643217aad79a373d1cb4563c4b5 (commit)
       via  189796e6b5d41752f6704a076831a35543bfbc72 (commit)
       via  5902331258970cb2b724eb5fe352e7429c2a272b (commit)
       via  188a6dfefe3af7d38574e01527732f83474f632e (commit)
      from  b6d3c9a9bc71a84e92db92e86514a1aad4e41308 (commit)

Summary of changes:
 .gitignore                                         |   14 ++++
 lib/Jifty/Plugin/EmailErrors.pm                    |    9 ++-
 t/TestApp-Plugin-EmailErrors/Makefile.PL           |    7 ++
 t/TestApp-Plugin-EmailErrors/app.psgi              |    3 +
 t/TestApp-Plugin-EmailErrors/bin/jifty             |   16 ++++
 t/TestApp-Plugin-EmailErrors/etc/config.yml        |   80 ++++++++++++++++++++
 .../share/web/templates/dereference-error.html     |    6 ++
 t/TestApp-Plugin-EmailErrors/t/001-mason.t         |   35 +++++++++
 8 files changed, 169 insertions(+), 1 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 t/TestApp-Plugin-EmailErrors/Makefile.PL
 create mode 100644 t/TestApp-Plugin-EmailErrors/app.psgi
 create mode 100755 t/TestApp-Plugin-EmailErrors/bin/jifty
 create mode 100644 t/TestApp-Plugin-EmailErrors/etc/config.yml
 create mode 100644 t/TestApp-Plugin-EmailErrors/share/web/templates/dereference-error.html
 create mode 100644 t/TestApp-Plugin-EmailErrors/t/001-mason.t

- Log -----------------------------------------------------------------
commit 188a6dfefe3af7d38574e01527732f83474f632e
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 9 14:55:18 2010 -0500

    Typo fix

diff --git a/lib/Jifty/Plugin/EmailErrors.pm b/lib/Jifty/Plugin/EmailErrors.pm
index 4a3d9d0..11795bf 100644
--- a/lib/Jifty/Plugin/EmailErrors.pm
+++ b/lib/Jifty/Plugin/EmailErrors.pm
@@ -12,7 +12,7 @@ Jifty::Plugin::EmailErrors - Emails all 500 pages to an arbitrary email address
 
 =head1 SYNOPSIS
 
-In your config.yml or equivilent:
+In your config.yml or equivalent:
 
   Plugins:
    - EmailErrors:

commit 5902331258970cb2b724eb5fe352e7429c2a272b
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 9 14:55:40 2010 -0500

    gitignore

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..54babd9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,12 @@
+MANIFEST
+MANIFEST.bak
+META.yml
+Makefile
+Makefile.old
+SIGNATURE
+blib/
+inc/
+pm_to_blib
+.prove
+*.sw[po]
+cover_db/

commit 189796e6b5d41752f6704a076831a35543bfbc72
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 9 14:57:42 2010 -0500

    license

diff --git a/lib/Jifty/Plugin/EmailErrors.pm b/lib/Jifty/Plugin/EmailErrors.pm
index 11795bf..84ad56b 100644
--- a/lib/Jifty/Plugin/EmailErrors.pm
+++ b/lib/Jifty/Plugin/EmailErrors.pm
@@ -42,4 +42,11 @@ sub init {
     $Jifty::Plugin::EmailErrors::Notification::EmailError::SUBJECT = $args{subject} || 'Jifty error';
 }
 
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2006-2010 Best Practical Solutions
+
+This is free software and may be modified and distributed under the same terms as Perl itself.
+
+
 1;

commit bd8a62eb004e8643217aad79a373d1cb4563c4b5
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 9 14:59:22 2010 -0500

    Begin adding tests

diff --git a/t/TestApp-Plugin-EmailErrors/Makefile.PL b/t/TestApp-Plugin-EmailErrors/Makefile.PL
new file mode 100644
index 0000000..a934a08
--- /dev/null
+++ b/t/TestApp-Plugin-EmailErrors/Makefile.PL
@@ -0,0 +1,7 @@
+use inc::Module::Install;
+
+name        'TestApp::Plugin::EmailErrors';
+version     '0.01';
+requires    'Jifty' => '1.00506';
+
+WriteAll;
diff --git a/t/TestApp-Plugin-EmailErrors/app.psgi b/t/TestApp-Plugin-EmailErrors/app.psgi
new file mode 100644
index 0000000..ff05fb1
--- /dev/null
+++ b/t/TestApp-Plugin-EmailErrors/app.psgi
@@ -0,0 +1,3 @@
+use Jifty;
+Jifty->new;
+Jifty->handler->psgi_app;
diff --git a/t/TestApp-Plugin-EmailErrors/bin/jifty b/t/TestApp-Plugin-EmailErrors/bin/jifty
new file mode 100755
index 0000000..118d895
--- /dev/null
+++ b/t/TestApp-Plugin-EmailErrors/bin/jifty
@@ -0,0 +1,16 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+use UNIVERSAL::require;
+
+BEGIN {
+    Jifty::Util->require or die $UNIVERSAL::require::ERROR;
+    my $root = Jifty::Util->app_root(quiet => 1);
+    unshift @INC, "$root/lib" if ($root);
+}
+
+use Jifty;
+use Jifty::Script;
+
+local $SIG{INT} = sub { warn "Stopped\n"; exit; };
+Jifty::Script->dispatch();
diff --git a/t/TestApp-Plugin-EmailErrors/etc/config.yml b/t/TestApp-Plugin-EmailErrors/etc/config.yml
new file mode 100644
index 0000000..0b72a00
--- /dev/null
+++ b/t/TestApp-Plugin-EmailErrors/etc/config.yml
@@ -0,0 +1,74 @@
+--- 
+framework: 
+  AdminMode: 1
+  ApplicationClass: TestApp::Plugin::EmailErrors
+  ApplicationName: TestApp-Plugin-EmailErrors
+  ApplicationUUID: C2C3404E-03CE-11E0-8CAD-D61A07ABC711
+  ConfigFileVersion: 5
+  Database: 
+    AutoUpgrade: 1
+    CheckSchema: 1
+    Database: testapp_plugin_emailerrors
+    Driver: SQLite
+    Host: localhost
+    Password: ''
+    RecordBaseClass: Jifty::DBI::Record::Cachable
+    User: ''
+    Version: 0.0.1
+  DevelMode: 1
+  L10N: 
+    PoDir: share/po
+  LogLevel: INFO
+  Mailer: Sendmail
+  MailerArgs: []
+
+  Plugins: 
+    - 
+      AdminUI: {}
+
+    - 
+      CompressedCSSandJS: {}
+
+    - 
+      ErrorTemplates: {}
+
+    - 
+      Halo: {}
+
+    - 
+      LetMe: {}
+
+    - 
+      OnlineDocs: {}
+
+    - 
+      REST: {}
+
+    - 
+      SkeletonApp: {}
+
+  PubSub: 
+    Backend: Memcached
+    Enable: ~
+  SkipAccessControl: 0
+  TemplateClass: TestApp::Plugin::EmailErrors::View
+  View: 
+    Handlers: 
+      - Jifty::View::Static::Handler
+      - Jifty::View::Declare::Handler
+      - Jifty::View::Mason::Handler
+  Web: 
+    BaseURL: http://localhost
+    DataDir: var/mason
+    Globals: []
+
+    MasonConfig: 
+      autoflush: 0
+      default_escape_flags: h
+      error_format: text
+      error_mode: fatal
+    PSGIStatic: 1
+    Port: 8888
+    ServeStaticFiles: 1
+    StaticRoot: share/web/static
+    TemplateRoot: share/web/templates

commit 7dadd00f178620fafb3f6264d14b79bec7d92bbe
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 9 15:01:22 2010 -0500

    More gitignore

diff --git a/.gitignore b/.gitignore
index 54babd9..16f853a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,3 +10,5 @@ pm_to_blib
 .prove
 *.sw[po]
 cover_db/
+t/TestApp-Plugin-EmailErrors/testapp_plugin_emailerrors
+t/TestApp-Plugin-EmailErrors/var/

commit ff2b84415747cf95b2320ced524b5265485f2f3f
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 9 15:04:49 2010 -0500

    Turn off Admin and DevelMode for this test

diff --git a/t/TestApp-Plugin-EmailErrors/etc/config.yml b/t/TestApp-Plugin-EmailErrors/etc/config.yml
index 0b72a00..acc7dbe 100644
--- a/t/TestApp-Plugin-EmailErrors/etc/config.yml
+++ b/t/TestApp-Plugin-EmailErrors/etc/config.yml
@@ -1,6 +1,6 @@
 --- 
 framework: 
-  AdminMode: 1
+  AdminMode: 0
   ApplicationClass: TestApp::Plugin::EmailErrors
   ApplicationName: TestApp-Plugin-EmailErrors
   ApplicationUUID: C2C3404E-03CE-11E0-8CAD-D61A07ABC711
@@ -15,7 +15,7 @@ framework:
     RecordBaseClass: Jifty::DBI::Record::Cachable
     User: ''
     Version: 0.0.1
-  DevelMode: 1
+  DevelMode: 0
   L10N: 
     PoDir: share/po
   LogLevel: INFO

commit cea63308caf15472a66b9fba17290870ac6e3cfa
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 9 15:04:58 2010 -0500

    Add a template with an intentional runtime error in it

diff --git a/t/TestApp-Plugin-EmailErrors/share/web/templates/dereference-error.html b/t/TestApp-Plugin-EmailErrors/share/web/templates/dereference-error.html
new file mode 100644
index 0000000..be48138
--- /dev/null
+++ b/t/TestApp-Plugin-EmailErrors/share/web/templates/dereference-error.html
@@ -0,0 +1,6 @@
+<%INIT>
+my $array = [];
+if (%{ $array } ) { # <-- intentional error
+    warn "what";
+}
+</%INIT>

commit 4aabbb5b1e0f0bfda2fb88c00224adb477dea92b
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 9 15:19:01 2010 -0500

    Include EmailErrors in the test config

diff --git a/t/TestApp-Plugin-EmailErrors/etc/config.yml b/t/TestApp-Plugin-EmailErrors/etc/config.yml
index acc7dbe..e931b2a 100644
--- a/t/TestApp-Plugin-EmailErrors/etc/config.yml
+++ b/t/TestApp-Plugin-EmailErrors/etc/config.yml
@@ -47,6 +47,12 @@ framework:
     - 
       SkeletonApp: {}
 
+    -
+      EmailErrors:
+        to: errors at example.com
+        from: server at example.com
+        subject: Sound the alarm!
+
   PubSub: 
     Backend: Memcached
     Enable: ~

commit 4935728637c8d85c49cf47a507ac68bf610bf2d8
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Thu Dec 9 15:19:51 2010 -0500

    Test for a runtime error in mason

diff --git a/t/TestApp-Plugin-EmailErrors/t/001-mason.t b/t/TestApp-Plugin-EmailErrors/t/001-mason.t
new file mode 100644
index 0000000..01d412f
--- /dev/null
+++ b/t/TestApp-Plugin-EmailErrors/t/001-mason.t
@@ -0,0 +1,35 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+use Jifty::Test::Dist tests => 14;
+
+use Jifty::Test::WWW::Mechanize;
+
+my $server  = Jifty::Test->make_server;
+
+isa_ok($server, 'Jifty::TestServer');
+
+my $URL     = $server->started_ok;
+my $mech    = Jifty::Test::WWW::Mechanize->new();
+
+$mech->get_ok('/');
+
+$mech->no_warnings_ok;
+
+Jifty::Test->setup_mailbox;
+$mech->get_ok('/dereference-error.html');
+$mech->warnings_like(qr/View error: Not a HASH reference/);
+
+my @emails = Jifty::Test->messages;
+is(@emails, 1);
+my $email = Email::MIME->new($emails[0]->as_string);
+
+like($email->body_str, qr{Error in /.*/share/web/templates/dereference-error.html, line 4}, "error location");
+like($email->body_str, qr{Not a HASH reference}, "error message");
+like($email->body_str, qr{/.*/share/dist/Jifty/web/templates/autohandler, line \d+}, "stack trace");
+like($email->body_str, qr{HTTP_USER_AGENT: Test-WWW-Mechanize}, "environment");
+
+is($email->header("To"), 'errors at example.com');
+is($email->header("From"), 'server at example.com');
+is($email->header("Subject"), 'Sound the alarm!');
+

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list