hoptoad_notifier 2.3.2 → 2.3.3
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/CHANGELOG +8 -0
- data/README.rdoc +12 -0
- data/SUPPORTED_RAILS_VERSIONS +2 -1
- data/lib/hoptoad_notifier/configuration.rb +5 -1
- data/lib/hoptoad_notifier/rails.rb +2 -0
- data/lib/hoptoad_notifier/rails/javascript_notifier.rb +41 -0
- data/lib/hoptoad_notifier/rails3_tasks.rb +4 -3
- data/lib/hoptoad_notifier/railtie.rb +6 -0
- data/lib/hoptoad_notifier/version.rb +1 -1
- data/lib/templates/javascript_notifier.erb +6 -0
- data/test/configuration_test.rb +2 -1
- metadata +6 -4
data/CHANGELOG
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
Version 2.3.3 - 2010-08-04
|
2
|
+
===============================================================================
|
3
|
+
|
4
|
+
Tristan Dunn (1):
|
5
|
+
Initial injection of JS notifier.
|
6
|
+
|
7
|
+
|
1
8
|
Version 2.3.2 - 2010-07-06
|
2
9
|
===============================================================================
|
3
10
|
|
@@ -175,3 +182,4 @@ Nick Quaranto (3):
|
|
175
182
|
|
176
183
|
|
177
184
|
|
185
|
+
|
data/README.rdoc
CHANGED
@@ -376,6 +376,18 @@ Please open up a support ticket on Tender ( http://help.hoptoadapp.com ) if
|
|
376
376
|
you're using a version of Rails that is not listed above and the notifier is
|
377
377
|
not working properly.
|
378
378
|
|
379
|
+
== Javascript Notifer
|
380
|
+
|
381
|
+
To automatically include the Javascript node on every page, set the
|
382
|
+
:js_notifier to true:
|
383
|
+
|
384
|
+
HoptoadNotifier.configure do |config|
|
385
|
+
config.js_notifier = true
|
386
|
+
end
|
387
|
+
|
388
|
+
It automatically uses the API key, host, and port specified in the
|
389
|
+
configuration.
|
390
|
+
|
379
391
|
== Thanks
|
380
392
|
|
381
393
|
Thanks to Eugene Bolshakov for the excellent write-up on GOING BEYOND
|
data/SUPPORTED_RAILS_VERSIONS
CHANGED
@@ -7,7 +7,7 @@ module HoptoadNotifier
|
|
7
7
|
:http_open_timeout, :http_read_timeout, :ignore, :ignore_by_filters,
|
8
8
|
:ignore_user_agent, :notifier_name, :notifier_url, :notifier_version,
|
9
9
|
:params_filters, :project_root, :port, :protocol, :proxy_host,
|
10
|
-
:proxy_pass, :proxy_port, :proxy_user, :secure, :framework].freeze
|
10
|
+
:proxy_pass, :proxy_port, :proxy_user, :secure, :framework, :js_notifier].freeze
|
11
11
|
|
12
12
|
# The API key for your project, found on the project edit form.
|
13
13
|
attr_accessor :api_key
|
@@ -62,6 +62,9 @@ module HoptoadNotifier
|
|
62
62
|
# +true+ if you want to check for production errors matching development errors, +false+ otherwise.
|
63
63
|
attr_accessor :development_lookup
|
64
64
|
|
65
|
+
# +true+ if you want to enable the JavaScript notifier in production environments
|
66
|
+
attr_accessor :js_notifier
|
67
|
+
|
65
68
|
# The name of the environment the application is running in
|
66
69
|
attr_accessor :environment_name
|
67
70
|
|
@@ -124,6 +127,7 @@ module HoptoadNotifier
|
|
124
127
|
@ignore_user_agent = []
|
125
128
|
@development_environments = %w(development test cucumber)
|
126
129
|
@development_lookup = true
|
130
|
+
@js_notifier = false
|
127
131
|
@notifier_name = 'Hoptoad Notifier'
|
128
132
|
@notifier_version = VERSION
|
129
133
|
@notifier_url = 'http://hoptoadapp.com'
|
@@ -2,6 +2,7 @@ require 'hoptoad_notifier'
|
|
2
2
|
require 'hoptoad_notifier/rails/controller_methods'
|
3
3
|
require 'hoptoad_notifier/rails/action_controller_catcher'
|
4
4
|
require 'hoptoad_notifier/rails/error_lookup'
|
5
|
+
require 'hoptoad_notifier/rails/javascript_notifier'
|
5
6
|
|
6
7
|
module HoptoadNotifier
|
7
8
|
module Rails
|
@@ -10,6 +11,7 @@ module HoptoadNotifier
|
|
10
11
|
ActionController::Base.send(:include, HoptoadNotifier::Rails::ActionControllerCatcher)
|
11
12
|
ActionController::Base.send(:include, HoptoadNotifier::Rails::ErrorLookup)
|
12
13
|
ActionController::Base.send(:include, HoptoadNotifier::Rails::ControllerMethods)
|
14
|
+
ActionController::Base.send(:include, HoptoadNotifier::Rails::JavascriptNotifier)
|
13
15
|
end
|
14
16
|
|
15
17
|
rails_logger = if defined?(::Rails.logger)
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module HoptoadNotifier
|
2
|
+
module Rails
|
3
|
+
module JavascriptNotifier
|
4
|
+
def self.included(base) #:nodoc:
|
5
|
+
base.send(:after_filter, :insert_hoptoad_javascript_notifier)
|
6
|
+
end
|
7
|
+
|
8
|
+
private
|
9
|
+
|
10
|
+
def insert_hoptoad_javascript_notifier
|
11
|
+
return unless HoptoadNotifier.configuration.js_notifier
|
12
|
+
|
13
|
+
path = File.join(File.dirname(__FILE__), '..', '..', 'templates', 'javascript_notifier.erb')
|
14
|
+
host = HoptoadNotifier.configuration.host.dup
|
15
|
+
port = HoptoadNotifier.configuration.port
|
16
|
+
host << ":#{port}" unless port == 80
|
17
|
+
|
18
|
+
options = {
|
19
|
+
:file => path,
|
20
|
+
:layout => false,
|
21
|
+
:use_full_path => false,
|
22
|
+
:locals => {
|
23
|
+
:host => host,
|
24
|
+
:api_key => HoptoadNotifier.configuration.api_key,
|
25
|
+
:environment => HoptoadNotifier.configuration.environment_name
|
26
|
+
}
|
27
|
+
}
|
28
|
+
|
29
|
+
if @template
|
30
|
+
javascript = @template.render(options)
|
31
|
+
else
|
32
|
+
javascript = render_to_string(options)
|
33
|
+
end
|
34
|
+
|
35
|
+
if response.body.respond_to?(:gsub)
|
36
|
+
response.body = response.body.gsub(/<(head)>/i, "<\\1>\n" + javascript)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -77,14 +77,15 @@ namespace :hoptoad do
|
|
77
77
|
end
|
78
78
|
class HoptoadVerificationController < ApplicationController; end
|
79
79
|
|
80
|
-
Rails
|
81
|
-
Rails
|
80
|
+
Rails.application.routes_reloader.execute_if_updated
|
81
|
+
Rails.application.routes.draw do
|
82
82
|
match 'verify' => 'application#verify', :as => 'verify'
|
83
83
|
end
|
84
84
|
|
85
85
|
puts 'Processing request.'
|
86
86
|
env = Rack::MockRequest.env_for("/verify")
|
87
|
-
|
87
|
+
|
88
|
+
Rails.application.call(env)
|
88
89
|
end
|
89
90
|
end
|
90
91
|
|
@@ -18,6 +18,12 @@ module HoptoadNotifier
|
|
18
18
|
config.project_root = Rails.root
|
19
19
|
config.framework = "Rails: #{::Rails::VERSION::STRING}"
|
20
20
|
end
|
21
|
+
|
22
|
+
if defined?(::ActionController::Base)
|
23
|
+
require 'hoptoad_notifier/rails/javascript_notifier'
|
24
|
+
|
25
|
+
::ActionController::Base.send(:include, HoptoadNotifier::Rails::JavascriptNotifier)
|
26
|
+
end
|
21
27
|
end
|
22
28
|
end
|
23
29
|
end
|
data/test/configuration_test.rb
CHANGED
@@ -29,6 +29,7 @@ class ConfigurationTest < Test::Unit::TestCase
|
|
29
29
|
HoptoadNotifier::Configuration::IGNORE_DEFAULT
|
30
30
|
assert_config_default :development_lookup, true
|
31
31
|
assert_config_default :framework, 'Standalone'
|
32
|
+
assert_config_default :js_notifier, false
|
32
33
|
end
|
33
34
|
|
34
35
|
should "provide default values for secure connections" do
|
@@ -84,7 +85,7 @@ class ConfigurationTest < Test::Unit::TestCase
|
|
84
85
|
:http_read_timeout, :ignore, :ignore_by_filters, :ignore_user_agent,
|
85
86
|
:notifier_name, :notifier_url, :notifier_version, :params_filters,
|
86
87
|
:project_root, :port, :protocol, :proxy_host, :proxy_pass, :proxy_port,
|
87
|
-
:proxy_user, :secure, :development_lookup].each do |option|
|
88
|
+
:proxy_user, :secure, :development_lookup, :js_notifier].each do |option|
|
88
89
|
assert_equal config[option], hash[option], "Wrong value for #{option}"
|
89
90
|
end
|
90
91
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoptoad_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 5
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 2.3.
|
9
|
+
- 3
|
10
|
+
version: 2.3.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- thoughtbot, inc
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-
|
18
|
+
date: 2010-08-04 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -132,6 +132,7 @@ files:
|
|
132
132
|
- lib/hoptoad_notifier/rails/action_controller_catcher.rb
|
133
133
|
- lib/hoptoad_notifier/rails/controller_methods.rb
|
134
134
|
- lib/hoptoad_notifier/rails/error_lookup.rb
|
135
|
+
- lib/hoptoad_notifier/rails/javascript_notifier.rb
|
135
136
|
- lib/hoptoad_notifier/rails.rb
|
136
137
|
- lib/hoptoad_notifier/rails3_tasks.rb
|
137
138
|
- lib/hoptoad_notifier/railtie.rb
|
@@ -154,6 +155,7 @@ files:
|
|
154
155
|
- test/sender_test.rb
|
155
156
|
- rails/init.rb
|
156
157
|
- script/integration_test.rb
|
158
|
+
- lib/templates/javascript_notifier.erb
|
157
159
|
- lib/templates/rescue.erb
|
158
160
|
has_rdoc: true
|
159
161
|
homepage: http://www.hoptoadapp.com
|