tartarus 2.0.1 → 2.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.rvmrc +9 -2
- data/Gemfile.lock +0 -1
- data/Rakefile +0 -4
- data/lib/tartarus/logger.rb +1 -1
- data/lib/tartarus/version.rb +1 -1
- data/spec/rails_app/Gemfile.lock +2 -0
- data/spec/tartarus/logger_spec.rb +8 -5
- data/tartarus.gemspec +1 -1
- metadata +9 -8
data/.rvmrc
CHANGED
@@ -1,2 +1,9 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
export rvm_gemset_create_on_use_flag=1
|
2
|
+
rvm_gemset_create_on_use_flag=1
|
3
|
+
rvm ruby-1.8.7-p334@tartarus
|
4
|
+
|
5
|
+
if ! command -v bundle ; then
|
6
|
+
printf "The rubygem 'bundler' is not installed, installing it now.\n"
|
7
|
+
gem install bundler
|
8
|
+
fi
|
9
|
+
|
data/Gemfile.lock
CHANGED
data/Rakefile
CHANGED
@@ -9,10 +9,6 @@ require "rspec/core/rake_task"
|
|
9
9
|
RSpec::Core::RakeTask.new(:spec) do |spec|
|
10
10
|
spec.rspec_opts = ['--color', '--format progress']
|
11
11
|
spec.pattern = 'spec/**/*_spec.rb'
|
12
|
-
# spec.rcov = true
|
13
|
-
# spec.rcov_opts = lambda do
|
14
|
-
# IO.readlines("spec/rcov.opts").map { |l| l.chomp.split " " }.flatten
|
15
|
-
# end
|
16
12
|
end
|
17
13
|
|
18
14
|
task :default => :spec
|
data/lib/tartarus/logger.rb
CHANGED
@@ -15,7 +15,7 @@ module Tartarus::Logger
|
|
15
15
|
def handle_notifications
|
16
16
|
notification_address = Tartarus.configuration['notification_address']
|
17
17
|
return unless notification_address.present?
|
18
|
-
Tartarus::Notifiers::Mail.
|
18
|
+
Tartarus::Notifiers::Mail.notification( notification_address, self ).deliver if group_count == 1 or (group_count%Tartarus.configuration['notification_threshold']).zero?
|
19
19
|
end
|
20
20
|
|
21
21
|
def json_serialize
|
data/lib/tartarus/version.rb
CHANGED
data/spec/rails_app/Gemfile.lock
CHANGED
@@ -2,6 +2,7 @@ PATH
|
|
2
2
|
remote: ../../
|
3
3
|
specs:
|
4
4
|
tartarus (2.0.0)
|
5
|
+
json (~> 1.4.6)
|
5
6
|
will_paginate (~> 3.0.pre2)
|
6
7
|
|
7
8
|
GEM
|
@@ -40,6 +41,7 @@ GEM
|
|
40
41
|
erubis (2.6.6)
|
41
42
|
abstract (>= 1.0.0)
|
42
43
|
i18n (0.5.0)
|
44
|
+
json (1.4.6)
|
43
45
|
mail (2.2.13)
|
44
46
|
activesupport (>= 2.3.6)
|
45
47
|
i18n (>= 0.4.0)
|
@@ -39,32 +39,35 @@ describe Tartarus::Logger do
|
|
39
39
|
end
|
40
40
|
|
41
41
|
describe '#handle_notifications' do
|
42
|
-
before(:each) do
|
42
|
+
before(:each) do
|
43
|
+
@notification = stub('notification', :deliver => true)
|
43
44
|
@logged_exception = LoggedException.create(:request => {})
|
44
45
|
Tartarus.stub(:configuration).and_return({ 'notification_threshold' => 10, 'notification_address' => 'test@example.com', 'enabled' => true, "logger_class"=>"LoggedException" })
|
45
46
|
end
|
46
47
|
|
47
48
|
it 'should return and not deliver notification if there is no address present' do
|
48
49
|
Tartarus.should_receive(:configuration).and_return({ 'enabled' => true, "logger_class"=>"LoggedException" })
|
49
|
-
Tartarus::Notifiers::Mail.should_receive( :
|
50
|
+
Tartarus::Notifiers::Mail.should_receive( :notification ).never
|
50
51
|
|
51
52
|
@logged_exception.handle_notifications
|
52
53
|
end
|
53
54
|
|
54
55
|
it 'should send email if there is an address present and the count matches the threshold' do
|
55
|
-
Tartarus::Notifiers::Mail.should_receive( :
|
56
|
+
Tartarus::Notifiers::Mail.should_receive( :notification ).with( 'test@example.com', @logged_exception ).and_return(@notification)
|
57
|
+
@notification.should_receive(:deliver)
|
56
58
|
@logged_exception.stub( :group_count ).and_return( 20 )
|
57
59
|
@logged_exception.handle_notifications
|
58
60
|
end
|
59
61
|
|
60
62
|
it 'should send email if there is an address present and it is the first exception in a group' do
|
61
|
-
Tartarus::Notifiers::Mail.should_receive( :
|
63
|
+
Tartarus::Notifiers::Mail.should_receive( :notification ).with( 'test@example.com', @logged_exception ).and_return(@notification)
|
64
|
+
@notification.should_receive(:deliver)
|
62
65
|
@logged_exception.stub( :group_count ).and_return( 1 )
|
63
66
|
@logged_exception.handle_notifications
|
64
67
|
end
|
65
68
|
|
66
69
|
it 'should not send email if there is an address present and the count does not match the threshold' do
|
67
|
-
Tartarus::Notifiers::Mail.should_receive( :
|
70
|
+
Tartarus::Notifiers::Mail.should_receive( :notification ).never
|
68
71
|
@logged_exception.stub( :group_count ).and_return( 22 )
|
69
72
|
@logged_exception.handle_notifications
|
70
73
|
end
|
data/tartarus.gemspec
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tartarus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 9
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 2.0.
|
9
|
+
- 3
|
10
|
+
version: 2.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Daniel Insley
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-06-30 00:00:00 -07:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -26,11 +26,12 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
hash:
|
29
|
+
hash: 1923831917
|
30
30
|
segments:
|
31
31
|
- 3
|
32
32
|
- 0
|
33
|
-
-
|
33
|
+
- pre
|
34
|
+
- 2
|
34
35
|
version: 3.0.pre2
|
35
36
|
type: :runtime
|
36
37
|
version_requirements: *id001
|
@@ -174,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
175
|
requirements: []
|
175
176
|
|
176
177
|
rubyforge_project:
|
177
|
-
rubygems_version: 1.
|
178
|
+
rubygems_version: 1.6.2
|
178
179
|
signing_key:
|
179
180
|
specification_version: 3
|
180
181
|
summary: Exception Logging for Rails
|