toad_notifier 0.1 → 0.2

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.
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ Gemfile.lock
4
+ pkg/*
5
+ config/credentials.yml
data/Gemfile.lock CHANGED
@@ -1,19 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- toad_notifier (0.1)
4
+ toad_notifier (0.2)
5
5
  activesupport
6
6
  toadhopper (~> 2.1)
7
7
 
8
8
  GEM
9
9
  remote: http://rubygems.org/
10
10
  specs:
11
- activesupport (3.2.12)
12
- i18n (~> 0.6)
11
+ activesupport (3.2.13)
12
+ i18n (= 0.6.1)
13
13
  multi_json (~> 1.0)
14
+ addressable (2.3.4)
15
+ crack (0.3.2)
14
16
  diff-lcs (1.2.4)
15
- i18n (0.6.4)
16
- multi_json (1.6.1)
17
+ i18n (0.6.1)
18
+ multi_json (1.7.6)
17
19
  rake (10.0.4)
18
20
  rspec (2.13.0)
19
21
  rspec-core (~> 2.13.0)
@@ -24,6 +26,10 @@ GEM
24
26
  diff-lcs (>= 1.1.3, < 2.0)
25
27
  rspec-mocks (2.13.1)
26
28
  toadhopper (2.1)
29
+ vcr (2.4.0)
30
+ webmock (1.11.0)
31
+ addressable (>= 2.2.7)
32
+ crack (>= 0.3.2)
27
33
 
28
34
  PLATFORMS
29
35
  ruby
@@ -32,3 +38,5 @@ DEPENDENCIES
32
38
  rake
33
39
  rspec
34
40
  toad_notifier!
41
+ vcr
42
+ webmock
data/lib/toad_notifier.rb CHANGED
@@ -7,6 +7,14 @@ class ToadNotifier
7
7
  Toadhopper.new(@@config[:api_key]).post!(exception, options)
8
8
  end
9
9
 
10
+ # Logs a exception with a custom error message, preserving the
11
+ # original exception class and backtrace
12
+ def self.notify_with_message!(exception, message, options = {})
13
+ custom_exception = exception.class.new message
14
+ custom_exception.set_backtrace exception.backtrace
15
+ Toadhopper.new(@@config[:api_key]).post!(custom_exception, options)
16
+ end
17
+
10
18
  def self.config=(config)
11
19
  @@config = config.with_indifferent_access
12
20
  end
@@ -1,3 +1,3 @@
1
1
  class ToadNotifier
2
- VERSION = 0.1
2
+ VERSION = 0.2
3
3
  end
@@ -0,0 +1,72 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://airbrake.io/notifier_api/v2/notices
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ! "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<notice version=\"2.0\">\n
9
+ \ <api-key>cd9a20fa10be6ee207822c3691c530e2</api-key>\n <notifier>\n <name>Toadhopper</name>\n
10
+ \ <version>2.1</version>\n <url>http://github.com/toolmantim/toadhopper</url>\n
11
+ \ </notifier>\n <server-environment>\n <project-root>/Users/glennr/git/toad_notifier</project-root>\n
12
+ \ <environment-name>development</environment-name>\n </server-environment>\n
13
+ \ <error>\n <class>ArgumentError</class>\n <message>ArgumentError: some
14
+ custom error</message>\n <backtrace>\n <line file=\"some backtrace\"
15
+ method=\"\" number=\"1\" />\n </backtrace>\n </error>\n <request>\n <url>http://localhost/</url>\n
16
+ \ <component>http://localhost/</component>\n <cgi-data>\n <var key=\"RBENV_VERSION\">1.9.3-p392</var>\n
17
+ \ <var key=\"GREP_COLOR\">1;32</var>\n <var key=\"TERM_PROGRAM\">Apple_Terminal</var>\n
18
+ \ <var key=\"TERM\">xterm-256color</var>\n <var key=\"SHELL\">/bin/zsh</var>\n
19
+ \ <var key=\"TMPDIR\">/var/folders/k0/sb0czp_90k5794hn6tjbrkbw0000gn/T/</var>\n
20
+ \ <var key=\"Apple_PubSub_Socket_Render\">/tmp/launch-aKc7hx/Render</var>\n
21
+ \ <var key=\"TERM_PROGRAM_VERSION\">309</var>\n <var key=\"TERM_SESSION_ID\">11D5FF51-82FB-4AC4-B367-F4FC96969447</var>\n
22
+ \ <var key=\"USER\">glennr</var>\n <var key=\"COMMAND_MODE\">unix2003</var>\n
23
+ \ <var key=\"RBENV_ROOT\">/usr/local/opt/rbenv</var>\n <var key=\"SSH_AUTH_SOCK\">/tmp/launch-N4VjkY/Listeners</var>\n
24
+ \ <var key=\"__CF_USER_TEXT_ENCODING\">0x1F5:0:0</var>\n <var key=\"Apple_Ubiquity_Message\">/tmp/launch-u4Nujt/Apple_Ubiquity_Message</var>\n
25
+ \ <var key=\"PAGER\">less</var>\n <var key=\"RBENV_HOOK_PATH\">:/usr/local/opt/rbenv/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks</var>\n
26
+ \ <var key=\"LSCOLORS\">Gxfxcxdxbxegedabagacad</var>\n <var key=\"PATH\">/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/bin:/usr/local/opt/rbenv/versions/1.9.3-p392/bin:/usr/local/opt/rbenv/libexec:/usr/local/opt/rbenv/plugins/ruby-build/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/heroku/bin:/Users/glennr/bin:/usr/local/sbin:/usr/local/opt/rbenv/shims:/usr/local/opt/rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin</var>\n
27
+ \ <var key=\"PWD\">/Users/glennr/git/toad_notifier</var>\n <var key=\"EDITOR\">vi</var>\n
28
+ \ <var key=\"SHLVL\">1</var>\n <var key=\"HOME\">/Users/glennr</var>\n
29
+ \ <var key=\"GREP_OPTIONS\">--color=auto</var>\n <var key=\"RBENV_DIR\">/Users/glennr/git/toad_notifier</var>\n
30
+ \ <var key=\"LESS\">-R</var>\n <var key=\"LOGNAME\">glennr</var>\n
31
+ \ <var key=\"LC_CTYPE\"></var>\n <var key=\"SECURITYSESSIONID\">186a5</var>\n
32
+ \ <var key=\"GEM_PATH\">/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1:/Users/glennr/.gem/ruby/1.9.1</var>\n
33
+ \ <var key=\"GEM_HOME\">/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1</var>\n
34
+ \ <var key=\"BUNDLE_BIN_PATH\">/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/bin/bundle</var>\n
35
+ \ <var key=\"BUNDLE_GEMFILE\">/Users/glennr/git/toad_notifier/Gemfile</var>\n
36
+ \ <var key=\"RUBYOPT\">-I/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib
37
+ -rbundler/setup</var>\n <var key=\"_ORIGINAL_GEM_PATH\">/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1:/Users/glennr/.gem/ruby/1.9.1</var>\n
38
+ \ </cgi-data>\n </request>\n</notice>\n"
39
+ headers:
40
+ Content-Type:
41
+ - text/xml
42
+ Accept:
43
+ - text/xml, application/xml
44
+ X-Airbrake-Client-Name:
45
+ - Toadhopper
46
+ User-Agent:
47
+ - Ruby
48
+ response:
49
+ status:
50
+ code: 200
51
+ message: OK
52
+ headers:
53
+ Content-Type:
54
+ - text/plain; charset=utf-8
55
+ Connection:
56
+ - close
57
+ Date:
58
+ - Mon, 24 Jun 2013 07:52:56 GMT
59
+ Transfer-Encoding:
60
+ - chunked
61
+ body:
62
+ encoding: US-ASCII
63
+ string: ! '<notice>
64
+
65
+ <id>cb9da522-14cf-a2ae-e4c7-7b50c918e2c1</id>
66
+
67
+ <url>http://airbrake.io/locate/cb9da522-14cf-a2ae-e4c7-7b50c918e2c1</url>
68
+
69
+ </notice>'
70
+ http_version:
71
+ recorded_at: Mon, 24 Jun 2013 07:52:56 GMT
72
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,72 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: http://airbrake.io/notifier_api/v2/notices
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ! "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<notice version=\"2.0\">\n
9
+ \ <api-key>cd9a20fa10be6ee207822c3691c530e2</api-key>\n <notifier>\n <name>Toadhopper</name>\n
10
+ \ <version>2.1</version>\n <url>http://github.com/toolmantim/toadhopper</url>\n
11
+ \ </notifier>\n <server-environment>\n <project-root>/Users/glennr/git/toad_notifier</project-root>\n
12
+ \ <environment-name>development</environment-name>\n </server-environment>\n
13
+ \ <error>\n <class>ArgumentError</class>\n <message>ArgumentError: some
14
+ message</message>\n <backtrace>\n <line file=\"no-backtrace\" method=\"\"
15
+ number=\"1\" />\n </backtrace>\n </error>\n <request>\n <url>http://localhost/</url>\n
16
+ \ <component>http://localhost/</component>\n <cgi-data>\n <var key=\"RBENV_VERSION\">1.9.3-p392</var>\n
17
+ \ <var key=\"GREP_COLOR\">1;32</var>\n <var key=\"TERM_PROGRAM\">Apple_Terminal</var>\n
18
+ \ <var key=\"TERM\">xterm-256color</var>\n <var key=\"SHELL\">/bin/zsh</var>\n
19
+ \ <var key=\"TMPDIR\">/var/folders/k0/sb0czp_90k5794hn6tjbrkbw0000gn/T/</var>\n
20
+ \ <var key=\"Apple_PubSub_Socket_Render\">/tmp/launch-aKc7hx/Render</var>\n
21
+ \ <var key=\"TERM_PROGRAM_VERSION\">309</var>\n <var key=\"TERM_SESSION_ID\">11D5FF51-82FB-4AC4-B367-F4FC96969447</var>\n
22
+ \ <var key=\"USER\">glennr</var>\n <var key=\"COMMAND_MODE\">unix2003</var>\n
23
+ \ <var key=\"RBENV_ROOT\">/usr/local/opt/rbenv</var>\n <var key=\"SSH_AUTH_SOCK\">/tmp/launch-N4VjkY/Listeners</var>\n
24
+ \ <var key=\"__CF_USER_TEXT_ENCODING\">0x1F5:0:0</var>\n <var key=\"Apple_Ubiquity_Message\">/tmp/launch-u4Nujt/Apple_Ubiquity_Message</var>\n
25
+ \ <var key=\"PAGER\">less</var>\n <var key=\"RBENV_HOOK_PATH\">:/usr/local/opt/rbenv/rbenv.d:/usr/local/etc/rbenv.d:/etc/rbenv.d:/usr/lib/rbenv/hooks</var>\n
26
+ \ <var key=\"LSCOLORS\">Gxfxcxdxbxegedabagacad</var>\n <var key=\"PATH\">/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/bin:/usr/local/opt/rbenv/versions/1.9.3-p392/bin:/usr/local/opt/rbenv/libexec:/usr/local/opt/rbenv/plugins/ruby-build/bin:/usr/local/opt/coreutils/libexec/gnubin:/usr/local/heroku/bin:/Users/glennr/bin:/usr/local/sbin:/usr/local/opt/rbenv/shims:/usr/local/opt/rbenv/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin</var>\n
27
+ \ <var key=\"PWD\">/Users/glennr/git/toad_notifier</var>\n <var key=\"EDITOR\">vi</var>\n
28
+ \ <var key=\"SHLVL\">1</var>\n <var key=\"HOME\">/Users/glennr</var>\n
29
+ \ <var key=\"GREP_OPTIONS\">--color=auto</var>\n <var key=\"RBENV_DIR\">/Users/glennr/git/toad_notifier</var>\n
30
+ \ <var key=\"LESS\">-R</var>\n <var key=\"LOGNAME\">glennr</var>\n
31
+ \ <var key=\"LC_CTYPE\"></var>\n <var key=\"SECURITYSESSIONID\">186a5</var>\n
32
+ \ <var key=\"GEM_PATH\">/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1:/Users/glennr/.gem/ruby/1.9.1</var>\n
33
+ \ <var key=\"GEM_HOME\">/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1</var>\n
34
+ \ <var key=\"BUNDLE_BIN_PATH\">/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/bin/bundle</var>\n
35
+ \ <var key=\"BUNDLE_GEMFILE\">/Users/glennr/git/toad_notifier/Gemfile</var>\n
36
+ \ <var key=\"RUBYOPT\">-I/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1/gems/bundler-1.3.0/lib
37
+ -rbundler/setup</var>\n <var key=\"_ORIGINAL_GEM_PATH\">/usr/local/opt/rbenv/versions/1.9.3-p392/lib/ruby/gems/1.9.1:/Users/glennr/.gem/ruby/1.9.1</var>\n
38
+ \ </cgi-data>\n </request>\n</notice>\n"
39
+ headers:
40
+ Content-Type:
41
+ - text/xml
42
+ Accept:
43
+ - text/xml, application/xml
44
+ X-Airbrake-Client-Name:
45
+ - Toadhopper
46
+ User-Agent:
47
+ - Ruby
48
+ response:
49
+ status:
50
+ code: 200
51
+ message: OK
52
+ headers:
53
+ Content-Type:
54
+ - text/plain; charset=utf-8
55
+ Connection:
56
+ - close
57
+ Date:
58
+ - Mon, 24 Jun 2013 07:52:55 GMT
59
+ Transfer-Encoding:
60
+ - chunked
61
+ body:
62
+ encoding: US-ASCII
63
+ string: ! '<notice>
64
+
65
+ <id>62b8b916-96b8-27b5-86c6-feadf86ad880</id>
66
+
67
+ <url>http://airbrake.io/locate/62b8b916-96b8-27b5-86c6-feadf86ad880</url>
68
+
69
+ </notice>'
70
+ http_version:
71
+ recorded_at: Mon, 24 Jun 2013 07:52:55 GMT
72
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,26 @@
1
+ require_relative '../spec_helper.rb'
2
+
3
+ describe ToadNotifier do
4
+
5
+ let(:exception) { ArgumentError.new('some message') }
6
+
7
+ before :all do
8
+ ToadNotifier.config = {'api_key' => 'cd9a20fa10be6ee207822c3691c530e2'}
9
+ end
10
+
11
+ describe "#notify!" do
12
+
13
+ it "passes supplied data on to Toadhopper" do
14
+ VCR.use_cassette('notify_ok') do
15
+ expect( ToadNotifier.notify!(exception, {}) ).to be_true
16
+ end
17
+ end
18
+
19
+ it "passes supplied data on to Toadhopper" do
20
+ VCR.use_cassette('notify_custom_ok') do
21
+ exception.set_backtrace('some backtrace')
22
+ expect( ToadNotifier.notify_with_message!(exception, 'some custom error', {}) ).to be_true
23
+ end
24
+ end
25
+ end
26
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,2 +1,9 @@
1
1
  require_relative '../lib/toad_notifier'
2
+ require 'webmock/rspec'
3
+ require 'vcr'
4
+
5
+ VCR.configure do |c|
6
+ c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
7
+ c.hook_into :webmock # or :fakeweb
8
+ end
2
9
 
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
7
7
  s.version = ToadNotifier::VERSION
8
8
  s.authors = ["Glenn Roberts", "Ile Eftimov"]
9
9
  s.email = ["glenn@siyelo.com", "ile@siyelo.com"]
10
- s.homepage = ""
10
+ s.homepage = "https://github.com/hetznerZA/toad_notifier"
11
11
  s.summary = %q{Hetzner wrapper for ToadHopper}
12
12
  s.description = %q{Hetzner wrapper for ToadHopper}
13
13
 
@@ -21,6 +21,8 @@ Gem::Specification.new do |s|
21
21
  # specify any dependencies here; for example:
22
22
  s.add_development_dependency "rspec"
23
23
  s.add_development_dependency "rake"
24
+ s.add_development_dependency "vcr"
25
+ s.add_development_dependency "webmock"
24
26
  s.add_runtime_dependency "activesupport"
25
27
  s.add_runtime_dependency "toadhopper", '~> 2.1'
26
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: toad_notifier
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-18 00:00:00.000000000 Z
13
+ date: 2013-06-24 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
@@ -44,6 +44,38 @@ dependencies:
44
44
  - - ! '>='
45
45
  - !ruby/object:Gem::Version
46
46
  version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ name: vcr
49
+ requirement: !ruby/object:Gem::Requirement
50
+ none: false
51
+ requirements:
52
+ - - ! '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ none: false
59
+ requirements:
60
+ - - ! '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ - !ruby/object:Gem::Dependency
64
+ name: webmock
65
+ requirement: !ruby/object:Gem::Requirement
66
+ none: false
67
+ requirements:
68
+ - - ! '>='
69
+ - !ruby/object:Gem::Version
70
+ version: '0'
71
+ type: :development
72
+ prerelease: false
73
+ version_requirements: !ruby/object:Gem::Requirement
74
+ none: false
75
+ requirements:
76
+ - - ! '>='
77
+ - !ruby/object:Gem::Version
78
+ version: '0'
47
79
  - !ruby/object:Gem::Dependency
48
80
  name: activesupport
49
81
  requirement: !ruby/object:Gem::Requirement
@@ -84,16 +116,20 @@ executables: []
84
116
  extensions: []
85
117
  extra_rdoc_files: []
86
118
  files:
119
+ - .gitignore
87
120
  - Gemfile
88
121
  - Gemfile.lock
89
122
  - README.md
90
123
  - Rakefile
91
124
  - lib/toad_notifier.rb
92
125
  - lib/toad_notifier/version.rb
126
+ - spec/fixtures/vcr_cassettes/notify_custom_ok.yml
127
+ - spec/fixtures/vcr_cassettes/notify_ok.yml
128
+ - spec/integration/toad_notifier_spec.rb
93
129
  - spec/spec_helper.rb
94
130
  - spec/toad_notifier_spec.rb
95
131
  - toad_notifier.gemspec
96
- homepage: ''
132
+ homepage: https://github.com/hetznerZA/toad_notifier
97
133
  licenses: []
98
134
  post_install_message:
99
135
  rdoc_options: []
@@ -107,7 +143,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
107
143
  version: '0'
108
144
  segments:
109
145
  - 0
110
- hash: -2809266027088210016
146
+ hash: -4546247888876324164
111
147
  required_rubygems_version: !ruby/object:Gem::Requirement
112
148
  none: false
113
149
  requirements:
@@ -116,7 +152,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
116
152
  version: '0'
117
153
  segments:
118
154
  - 0
119
- hash: -2809266027088210016
155
+ hash: -4546247888876324164
120
156
  requirements: []
121
157
  rubyforge_project: toad_notifier
122
158
  rubygems_version: 1.8.23
@@ -124,5 +160,8 @@ signing_key:
124
160
  specification_version: 3
125
161
  summary: Hetzner wrapper for ToadHopper
126
162
  test_files:
163
+ - spec/fixtures/vcr_cassettes/notify_custom_ok.yml
164
+ - spec/fixtures/vcr_cassettes/notify_ok.yml
165
+ - spec/integration/toad_notifier_spec.rb
127
166
  - spec/spec_helper.rb
128
167
  - spec/toad_notifier_spec.rb