notifyR 0.1.1

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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: efa895c2b4da597804c437f3e92dcc4fc1974286
4
+ data.tar.gz: 50a907247afb40d9b2f309330af8eaf81a0150f1
5
+ SHA512:
6
+ metadata.gz: bea97bac6ae039b413a7b4d9dc2ad51b63c7616f12d67544056582008c601ab4920eaa069f6435ed1c1837ac4d5efa35523d5c5539a8885ab3edaac853a6ec37
7
+ data.tar.gz: ee9182899256d4452416216bfbc8bd22e4fd98231b7c85d7f2b86d13f86696bc84208e6356cb40e0416f39baf5ba24e56e3bd1cf315d0f3b9e56ff56eef1940e
data/.gitignore ADDED
@@ -0,0 +1,22 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
18
+ *.bundle
19
+ *.so
20
+ *.o
21
+ *.a
22
+ mkmf.log
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in notifyR.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,23 @@
1
+ Copyright (c) 2015 ashokgadikoppula
2
+
3
+
4
+ MIT License
5
+
6
+ Permission is hereby granted, free of charge, to any person obtaining
7
+ a copy of this software and associated documentation files (the
8
+ "Software"), to deal in the Software without restriction, including
9
+ without limitation the rights to use, copy, modify, merge, publish,
10
+ distribute, sublicense, and/or sell copies of the Software, and to
11
+ permit persons to whom the Software is furnished to do so, subject to
12
+ the following conditions:
13
+
14
+ The above copyright notice and this permission notice shall be
15
+ included in all copies or substantial portions of the Software.
16
+
17
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
20
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
21
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,37 @@
1
+ # NotifyR
2
+
3
+ NotifyR is a nice gem to send exception notifications
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'notifyR'
10
+
11
+ And then execute:
12
+
13
+ $ bundle
14
+
15
+ Or install it yourself as:
16
+
17
+ $ gem install notifyR
18
+
19
+ ## Usage
20
+ Smtp settings must be setup
21
+
22
+ NotifyR.notify_exception(from_address, to_address, subject, exception, server_name)
23
+
24
+ from_address: Must be a email string
25
+ to_address: Must be a email string comma separated in case of muliple
26
+ subject: optional string(optional)
27
+ exception: Exception object(optional)
28
+ server_name: optional string(optional)
29
+
30
+
31
+ ## Contributing
32
+
33
+ 1. Fork it ( https://github.com/ashokgadikoppula/notifyR/fork )
34
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
35
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
36
+ 4. Push to the branch (`git push origin my-new-feature`)
37
+ 5. Create a new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+
@@ -0,0 +1,3 @@
1
+ module NotifyR
2
+ VERSION = "0.1.1"
3
+ end
data/lib/notifyR.rb ADDED
@@ -0,0 +1,55 @@
1
+
2
+ class NotifyR < ActionMailer::Base
3
+ def notify_exception(from_address, to_address, subject=nil, exception=nil, server_name=nil)
4
+ unless from_address
5
+ raise ArgumentError.new("From address is needed")
6
+ end
7
+ unless to_address
8
+ raise ArgumentError.new("To address is needed")
9
+ end
10
+ unless subject
11
+ subject = "Exception Notification"
12
+ end
13
+ unless server_name
14
+ server_name = "--"
15
+ end
16
+ if exception
17
+ email_body = get_email_body_from_exception(exception, server_name)
18
+ else
19
+ email_body = "An exception has occured. Please find and fix it."
20
+ end
21
+ mail(from: "\"Exception NotifyR\" <#{from_address}>", to: "#{to_address}", content_type: "text/html", subject: "#{subject}", body: email_body)
22
+ end
23
+
24
+ def get_email_body_from_exception exception, server_name
25
+ str = "<table border='1' cellspacing='0' cellpadding='2' class='tbl' style='font-family: sans-serif; font-size: 8pt; border-collapse: collapse; border: 1px solid navy;'>
26
+ <tbody>
27
+ <tr class='hdr' style='background-color: #eaeaea; text-align: center;'>
28
+ <td colspan='2'>An error was logged</td>
29
+ </tr>
30
+ <tr>
31
+ <td class='lft'>ERROR SOURCE</td>
32
+ <td>#{server_name}</td>
33
+ </tr>
34
+ <tr>
35
+ <td class='lft'> MESSAGE</td>
36
+ <td class='lftRed' style='color: red;'>#{exception.message}</td>
37
+ </tr>
38
+ <tr>
39
+ <td class='lft'>STACK/TRACE</td>
40
+ <td>#{exception.backtrace}</td>
41
+ </tr>
42
+ <tr>
43
+ <td class='lft'>ERROR TYPE</td>
44
+ <td>#{exception.class}</td>
45
+ </tr>
46
+ </tbody>
47
+ </table>"
48
+ return str
49
+ end
50
+
51
+ end
52
+
53
+
54
+
55
+
data/notifyR.gemspec ADDED
@@ -0,0 +1,23 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'notifyR/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "notifyR"
8
+ spec.version = NotifyR::VERSION
9
+ spec.authors = ["ashokgadikoppula\n"]
10
+ spec.email = ["ashokgadikoppula@gmail.com"]
11
+ spec.summary = "NotifyR is a nice gem"
12
+ spec.description = %q{NotifyR is a nice gem to send exception notifications}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ["lib"]
20
+
21
+ spec.add_development_dependency "bundler", "~> 1.6"
22
+ spec.add_development_dependency "rake"
23
+ end
metadata ADDED
@@ -0,0 +1,82 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: notifyR
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.1
5
+ platform: ruby
6
+ authors:
7
+ - |
8
+ ashokgadikoppula
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2015-01-07 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - "~>"
19
+ - !ruby/object:Gem::Version
20
+ version: '1.6'
21
+ type: :development
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - "~>"
26
+ - !ruby/object:Gem::Version
27
+ version: '1.6'
28
+ - !ruby/object:Gem::Dependency
29
+ name: rake
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ description: NotifyR is a nice gem to send exception notifications
43
+ email:
44
+ - ashokgadikoppula@gmail.com
45
+ executables: []
46
+ extensions: []
47
+ extra_rdoc_files: []
48
+ files:
49
+ - ".gitignore"
50
+ - Gemfile
51
+ - LICENSE.txt
52
+ - README.md
53
+ - Rakefile
54
+ - lib/notifyR.rb
55
+ - lib/notifyR/version.rb
56
+ - notifyR.gemspec
57
+ homepage: ''
58
+ licenses:
59
+ - MIT
60
+ metadata: {}
61
+ post_install_message:
62
+ rdoc_options: []
63
+ require_paths:
64
+ - lib
65
+ required_ruby_version: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ required_rubygems_version: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ requirements: []
76
+ rubyforge_project:
77
+ rubygems_version: 2.2.2
78
+ signing_key:
79
+ specification_version: 4
80
+ summary: NotifyR is a nice gem
81
+ test_files: []
82
+ has_rdoc: