pakyow-fail-mail 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (5) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGES +3 -0
  3. data/MIT-LICENSE +20 -0
  4. data/lib/pakyow-fail-mail.rb +30 -0
  5. metadata +60 -0
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 67a1eb65c67a8c667e86fbddd9b60e16c0a849f1
4
+ data.tar.gz: 581023e1d5280e10662ec387e08eea22a92404e3
5
+ SHA512:
6
+ metadata.gz: d32f2015fa75a2f0510b0ec07ec911ea16197ed4dff9ff19a007420ad8681ae4c80b5e8a202b6e979d5effefd462733cf698f45ec4eb4b734baeebae9593e176
7
+ data.tar.gz: c62cddbcc1d4c8ba90551ffffcc82751d34b643ad61e8968a1af1337a9249bd522f00b448681e7110ec82b74e061f7d894973a04181a2790b09c97b1bfd28316
data/CHANGES ADDED
@@ -0,0 +1,3 @@
1
+ = 0.1.0 / 2014-11-14
2
+
3
+ * Initial gem release
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Bryan Powell
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,30 @@
1
+ module Pakyow
2
+ module Fail
3
+ module Handlers
4
+ class Mail
5
+ NICENAME = :mail
6
+
7
+ # register and enable the handler
8
+ Pakyow::Fail::Handler.register(NICENAME, self, %i[mail_to])
9
+ Pakyow::Fail::Handler.enable(NICENAME)
10
+
11
+ # define default config options
12
+ Pakyow::Config.fail.opt(:mail_sender, lambda { "#{Pakyow::Config.app.name} Fail" })
13
+
14
+ def initialize(app)
15
+ req = app.req
16
+
17
+ body = []
18
+ body << "<strong>#{req.method.upcase} #{req.path} (#{req.error.class.name}) #{CGI.escapeHTML(req.error.message)}</strong>"
19
+ body << "Params: #{app.params}"
20
+ body << "Session: #{app.session}"
21
+ body.concat(req.error.backtrace)
22
+
23
+ mail = Mailer.new(content: body.join('<br>'))
24
+ mail.message.subject = "#{Config.fail.mail_sender}: (#{req.error.class.name}) #{req.error.message}"
25
+ mail.deliver_to Config.fail.mail_to
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
metadata ADDED
@@ -0,0 +1,60 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: pakyow-fail-mail
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Bryan Powell
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-15 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: pakyow-fail
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.1'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.1'
27
+ description: An error handler for Pakyow apps that reports failures via email.
28
+ email: bryan@metabahn.com
29
+ executables: []
30
+ extensions: []
31
+ extra_rdoc_files: []
32
+ files:
33
+ - "./CHANGES"
34
+ - "./MIT-LICENSE"
35
+ - "./lib/pakyow-fail-mail.rb"
36
+ homepage: http://pakyow.com
37
+ licenses: []
38
+ metadata: {}
39
+ post_install_message:
40
+ rdoc_options: []
41
+ require_paths:
42
+ - "./lib"
43
+ required_ruby_version: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: 2.0.0
48
+ required_rubygems_version: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ requirements: []
54
+ rubyforge_project:
55
+ rubygems_version: 2.2.2
56
+ signing_key:
57
+ specification_version: 4
58
+ summary: Pakyow Mail error handler.
59
+ test_files: []
60
+ has_rdoc: