errornot_notifier 0.1.0 → 1.0.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.
- data/CHANGELOG +5 -0
- data/INSTALL +8 -8
- data/README.rdoc +63 -53
- data/Rakefile +92 -8
- data/TESTING.rdoc +1 -1
- data/generators/{hoptoad/hoptoad_generator.rb → errornot/errornot_generator.rb} +6 -6
- data/generators/{hoptoad → errornot}/lib/insert_commands.rb +0 -0
- data/generators/{hoptoad → errornot}/lib/rake_commands.rb +0 -0
- data/generators/errornot/templates/capistrano_hook.rb +6 -0
- data/generators/errornot/templates/errornot_notifier_tasks.rake +5 -0
- data/generators/{hoptoad → errornot}/templates/initializer.rb +2 -2
- data/lib/{hoptoad_notifier → errornot_notifier}/backtrace.rb +1 -1
- data/lib/errornot_notifier/capistrano.rb +20 -0
- data/lib/{hoptoad_notifier → errornot_notifier}/configuration.rb +14 -16
- data/lib/{hoptoad_notifier → errornot_notifier}/notice.rb +2 -2
- data/lib/{hoptoad_notifier → errornot_notifier}/rack.rb +8 -8
- data/lib/{hoptoad_notifier → errornot_notifier}/rails/action_controller_catcher.rb +9 -9
- data/lib/{hoptoad_notifier → errornot_notifier}/rails/controller_methods.rb +15 -15
- data/lib/{hoptoad_notifier → errornot_notifier}/rails/error_lookup.rb +9 -9
- data/lib/{hoptoad_notifier → errornot_notifier}/rails.rb +11 -11
- data/lib/{hoptoad_notifier → errornot_notifier}/sender.rb +8 -8
- data/lib/{hoptoad_notifier → errornot_notifier}/tasks.rb +19 -19
- data/lib/errornot_notifier/version.rb +3 -0
- data/lib/{hoptoad_notifier.rb → errornot_notifier.rb} +20 -20
- data/lib/{hoptoad_tasks.rb → errornot_tasks.rb} +9 -7
- data/lib/templates/rescue.erb +5 -5
- data/rails/init.rb +1 -1
- data/script/integration_test.rb +6 -6
- data/test/backtrace_test.rb +16 -16
- data/test/catcher_test.rb +22 -22
- data/test/configuration_test.rb +21 -23
- data/test/erronot_tasks_test.rb +147 -0
- data/test/helper.rb +16 -15
- data/test/logger_test.rb +12 -10
- data/test/notice_test.rb +9 -9
- data/test/notifier_test.rb +30 -30
- data/test/rack_test.rb +7 -7
- data/test/rails_initializer_test.rb +8 -8
- data/test/sender_test.rb +13 -12
- metadata +73 -53
- data/generators/hoptoad/templates/capistrano_hook.rb +0 -6
- data/generators/hoptoad/templates/hoptoad_notifier_tasks.rake +0 -5
- data/lib/hoptoad_notifier/capistrano.rb +0 -20
- data/lib/hoptoad_notifier/version.rb +0 -3
- data/test/hoptoad_tasks_test.rb +0 -138
data/CHANGELOG
ADDED
data/INSTALL
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
=== Configuration
|
2
2
|
|
3
|
-
You should have something like this in config/initializers/
|
3
|
+
You should have something like this in config/initializers/errornot.rb.
|
4
4
|
|
5
|
-
|
5
|
+
ErrornotNotifier.configure do |config|
|
6
6
|
config.api_key = '1234567890abcdef'
|
7
7
|
end
|
8
8
|
|
9
9
|
(Please note that this configuration should be in a global configuration, and
|
10
|
-
is *not* environment-specific.
|
10
|
+
is *not* environment-specific. Errornot is smart enough to know what errors are
|
11
11
|
caused by what environments, so your staging errors don't get mixed in with
|
12
12
|
your production errors.)
|
13
13
|
|
14
|
-
You can test that
|
14
|
+
You can test that Errornot is working in your production environment by using
|
15
15
|
this rake task (from RAILS_ROOT):
|
16
16
|
|
17
|
-
rake
|
17
|
+
rake errornot:test
|
18
18
|
|
19
|
-
If everything is configured properly, that task will send a notice to
|
19
|
+
If everything is configured properly, that task will send a notice to Errornot
|
20
20
|
which will be visible immediately.
|
21
21
|
|
22
22
|
NOTE FOR RAILS 1.2.* USERS:
|
23
23
|
|
24
|
-
You will need to copy the
|
25
|
-
RAILS_ROOT/lib/tasks directory in order for the rake
|
24
|
+
You will need to copy the errornot_notifier_tasks.rake file into your
|
25
|
+
RAILS_ROOT/lib/tasks directory in order for the rake errornot:test task to work.
|
data/README.rdoc
CHANGED
@@ -21,14 +21,14 @@ Remove the vendor/plugins/exception_notifier directory.
|
|
21
21
|
|
22
22
|
Add the errornot_notifier gem to your app. In config/environment.rb:
|
23
23
|
|
24
|
-
config.gem 'errornot_notifier'
|
24
|
+
config.gem 'errornot_notifier'
|
25
25
|
|
26
26
|
Then from your project's RAILS_ROOT, run:
|
27
27
|
|
28
28
|
rake gems:install
|
29
|
-
script/generate
|
29
|
+
script/generate errornot --api-key your_key_here --server your_host
|
30
30
|
|
31
|
-
Once installed, you should vendor the
|
31
|
+
Once installed, you should vendor the errornot_notifier gem.
|
32
32
|
|
33
33
|
rake gems:unpack GEM=errornot_notifier
|
34
34
|
|
@@ -41,7 +41,7 @@ Install the errornot_notifier gem:
|
|
41
41
|
|
42
42
|
gem install errornot_notifier
|
43
43
|
|
44
|
-
Once installed, you should vendor the
|
44
|
+
Once installed, you should vendor the errornot_notifier gem:
|
45
45
|
|
46
46
|
mkdir vendor/gems
|
47
47
|
cd vendor/gems
|
@@ -55,17 +55,17 @@ block in environment.rb so that the vendored gem is loaded.
|
|
55
55
|
|
56
56
|
Next add something like this at the bottom of your config/environment.rb:
|
57
57
|
|
58
|
-
require '
|
59
|
-
require '
|
60
|
-
|
58
|
+
require 'errornot_notifier'
|
59
|
+
require 'errornot_notifier/rails'
|
60
|
+
ErrornotNotifier.configure do |config|
|
61
61
|
config.api_key = 'your_key_here'
|
62
62
|
config.host = 'host_of_your_errornot_instance'
|
63
63
|
end
|
64
64
|
|
65
|
-
You will also need to copy the
|
66
|
-
RAILS_ROOT/lib/tasks directory in order for the rake
|
65
|
+
You will also need to copy the errornot_notifier_tasks.rake file into your
|
66
|
+
RAILS_ROOT/lib/tasks directory in order for the rake errornot:test task to work:
|
67
67
|
|
68
|
-
cp vendor/gems/errornot_notifier
|
68
|
+
cp vendor/gems/errornot_notifier-*/generators/errornot/templates/errornot_notifier_tasks.rake lib/tasks
|
69
69
|
|
70
70
|
As always, if you choose not to vendor the errornot_notifier gem, make sure
|
71
71
|
every server you deploy to has the gem installed or your application won't start.
|
@@ -75,27 +75,27 @@ every server you deploy to has the gem installed or your application won't start
|
|
75
75
|
You can test that ErrorNot is working in your production environment by using
|
76
76
|
this rake task (from RAILS_ROOT):
|
77
77
|
|
78
|
-
rake
|
78
|
+
rake errornot:test
|
79
79
|
|
80
|
-
If everything is configured properly, that task will send a notice to
|
80
|
+
If everything is configured properly, that task will send a notice to Errornot
|
81
81
|
which will be visible immediately.
|
82
82
|
|
83
83
|
== Rack
|
84
84
|
|
85
|
-
In order to use
|
86
|
-
|
85
|
+
In order to use errornot_notifier in a non-Rails rack app, just load the
|
86
|
+
errornot_notifier, configure your API key, and use the ErrornotNotifier::Rack
|
87
87
|
middleware:
|
88
88
|
|
89
89
|
require 'rack'
|
90
|
-
require '
|
90
|
+
require 'errornot_notifier'
|
91
91
|
|
92
|
-
|
92
|
+
ErrornotNotifier.configure do |config|
|
93
93
|
config.api_key = 'my_api_key'
|
94
94
|
config.host = 'host_of_your_errornot_instance'
|
95
95
|
end
|
96
96
|
|
97
97
|
app = Rack::Builder.app do
|
98
|
-
use
|
98
|
+
use errornotNotifier::Rack
|
99
99
|
run lambda { |env| raise "Rack down" }
|
100
100
|
end
|
101
101
|
|
@@ -105,15 +105,15 @@ Using errornot_notifier in a Sinatra app is just like a Rack app, but you have
|
|
105
105
|
to disable Sinatra's error rescuing functionality:
|
106
106
|
|
107
107
|
require 'sinatra/base'
|
108
|
-
require '
|
108
|
+
require 'errornot_notifier'
|
109
109
|
|
110
|
-
|
110
|
+
ErrornotNotifier.configure do |config|
|
111
111
|
config.api_key = 'my_api_key'
|
112
112
|
config.host =' host_of_your_errornot_instance'
|
113
113
|
end
|
114
114
|
|
115
115
|
class MyApp < Sinatra::Default
|
116
|
-
use
|
116
|
+
use ErrornotNotifier::Rack
|
117
117
|
enable :raise_errors
|
118
118
|
|
119
119
|
get "/" do
|
@@ -132,36 +132,36 @@ controller, you can do something like this:
|
|
132
132
|
|
133
133
|
...
|
134
134
|
rescue => ex
|
135
|
-
|
135
|
+
notify_errornot(ex)
|
136
136
|
flash[:failure] = 'Encryptions could not be rerouted, try again.'
|
137
137
|
end
|
138
138
|
...
|
139
139
|
|
140
|
-
The #
|
141
|
-
analysis. While in your controllers you use the
|
142
|
-
else in your code, use
|
140
|
+
The #notify_errornot call will send the notice over to Errornot for later
|
141
|
+
analysis. While in your controllers you use the notify_errornot method, anywhere
|
142
|
+
else in your code, use ErrornotNotifier.notify.
|
143
143
|
|
144
|
-
To perform custom error processing after
|
145
|
-
instance method #
|
144
|
+
To perform custom error processing after Errornot has been notified, define the
|
145
|
+
instance method #rescue_action_in_public_without_errornot(exception) in your
|
146
146
|
controller.
|
147
147
|
|
148
|
-
== Tracking deployments in
|
148
|
+
== Tracking deployments in Errornot ( It's not implement in ErrorNot )
|
149
149
|
|
150
|
-
Paying
|
151
|
-
By notifying
|
150
|
+
Paying Errornot plans support the ability to track deployments of your application in Errornot.
|
151
|
+
By notifying Errornot of your application deployments, all errors are resolved when a deploy occurs,
|
152
152
|
so that you'll be notified again about any errors that reoccur after a deployment.
|
153
153
|
|
154
|
-
Additionally, it's possible to review the errors in
|
154
|
+
Additionally, it's possible to review the errors in Errornot that occurred before and after a deploy.
|
155
155
|
|
156
|
-
When
|
156
|
+
When Errornot is installed as a gem, you need to add
|
157
157
|
|
158
|
-
require '
|
158
|
+
require 'errornot_notifier/capistrano'
|
159
159
|
|
160
160
|
to your deploy.rb
|
161
161
|
|
162
162
|
== Going beyond exceptions
|
163
163
|
|
164
|
-
You can also pass a hash to
|
164
|
+
You can also pass a hash to notify_errornot method and store whatever you want,
|
165
165
|
not just an exception. And you can also use it anywhere, not just in
|
166
166
|
controllers:
|
167
167
|
|
@@ -171,25 +171,25 @@ controllers:
|
|
171
171
|
}
|
172
172
|
my_unpredicable_method(params)
|
173
173
|
rescue => e
|
174
|
-
|
174
|
+
ErrornotNotifier.notify(
|
175
175
|
:error_class => "Special Error",
|
176
176
|
:error_message => "Special Error: #{e.message}",
|
177
177
|
:parameters => params
|
178
178
|
)
|
179
179
|
end
|
180
180
|
|
181
|
-
While in your controllers you use the
|
182
|
-
your code, use
|
181
|
+
While in your controllers you use the notify_errornot method, anywhere else in
|
182
|
+
your code, use ErrornotNotifier.notify. Errornot will get all the information
|
183
183
|
about the error itself. As for a hash, these are the keys you should pass:
|
184
184
|
|
185
|
-
* :error_class - Use this to group similar errors together. When
|
185
|
+
* :error_class - Use this to group similar errors together. When Errornot catches an exception it sends the class name of that exception object.
|
186
186
|
* :error_message - This is the title of the error you see in the errors list. For exceptions it is "#{exception.class.name}: #{exception.message}"
|
187
|
-
* :parameters - While there are several ways to send additional data to
|
187
|
+
* :parameters - While there are several ways to send additional data to Errornot, passing a Hash as :parameters as in the example above is the most common use case. When Errornot catches an exception in a controller, the actual HTTP client request parameters are sent using this key.
|
188
188
|
|
189
|
-
|
189
|
+
Errornot merges the hash you pass with these default options:
|
190
190
|
|
191
191
|
{
|
192
|
-
:api_key =>
|
192
|
+
:api_key => ErrornotNotifier.api_key,
|
193
193
|
:error_message => 'Notification',
|
194
194
|
:backtrace => caller,
|
195
195
|
:parameters => {},
|
@@ -200,14 +200,14 @@ You can override any of those parameters.
|
|
200
200
|
|
201
201
|
== Filtering
|
202
202
|
|
203
|
-
You can specify a whitelist of errors, that
|
203
|
+
You can specify a whitelist of errors, that Errornot will not report on. Use
|
204
204
|
this feature when you are so apathetic to certain errors that you don't want
|
205
205
|
them even logged.
|
206
206
|
|
207
207
|
This filter will only be applied to automatic notifications, not manual
|
208
208
|
notifications (when #notify is called directly).
|
209
209
|
|
210
|
-
|
210
|
+
Errornot ignores the following exceptions by default:
|
211
211
|
|
212
212
|
ActiveRecord::RecordNotFound
|
213
213
|
ActionController::RoutingError
|
@@ -215,10 +215,10 @@ Hoptoad ignores the following exceptions by default:
|
|
215
215
|
ActionController::UnknownAction
|
216
216
|
CGI::Session::CookieStore::TamperedWithCookie
|
217
217
|
|
218
|
-
To ignore errors in addition to those, specify their names in your
|
218
|
+
To ignore errors in addition to those, specify their names in your Errornot
|
219
219
|
configuration block.
|
220
220
|
|
221
|
-
|
221
|
+
ErrornotNotifier.configure do |config|
|
222
222
|
config.api_key = '1234567890abcdef'
|
223
223
|
config.ignore << ActiveRecord::IgnoreThisError
|
224
224
|
end
|
@@ -226,7 +226,7 @@ configuration block.
|
|
226
226
|
To ignore *only* certain errors (and override the defaults), use the
|
227
227
|
#ignore_only attribute.
|
228
228
|
|
229
|
-
|
229
|
+
ErrornotNotifier.configure do |config|
|
230
230
|
config.api_key = '1234567890abcdef'
|
231
231
|
config.ignore_only = [ActiveRecord::IgnoreThisError]
|
232
232
|
end
|
@@ -234,7 +234,7 @@ To ignore *only* certain errors (and override the defaults), use the
|
|
234
234
|
To ignore certain user agents, add in the #ignore_user_agent attribute as a
|
235
235
|
string or regexp:
|
236
236
|
|
237
|
-
|
237
|
+
ErrornotNotifier.configure do |config|
|
238
238
|
config.api_key = '1234567890abcdef'
|
239
239
|
config.ignore_user_agent << /Ignored/
|
240
240
|
config.ignore_user_agent << 'IgnoredUserAgent'
|
@@ -242,42 +242,52 @@ string or regexp:
|
|
242
242
|
|
243
243
|
To ignore exceptions based on other conditions, use #ignore_by_filter:
|
244
244
|
|
245
|
-
|
245
|
+
ErrornotNotifier.configure do |config|
|
246
246
|
config.api_key = '1234567890abcdef'
|
247
247
|
config.ignore_by_filter do |exception_data|
|
248
248
|
true if exception_data[:error_class] == "RuntimeError"
|
249
249
|
end
|
250
250
|
end
|
251
251
|
|
252
|
-
To replace sensitive information sent to the
|
252
|
+
To replace sensitive information sent to the Errornot service with [FILTERED] use #params_filters:
|
253
253
|
|
254
|
-
|
254
|
+
ErrornotNotifier.configure do |config|
|
255
255
|
config.api_key = '1234567890abcdef'
|
256
256
|
config.params_filters << "credit_card_number"
|
257
257
|
end
|
258
258
|
|
259
259
|
Note that, when rescuing exceptions within an ActionController method,
|
260
|
-
|
260
|
+
errornot_notifier will reuse filters specified by #filter_params_logging.
|
261
261
|
|
262
262
|
== Testing
|
263
263
|
|
264
|
-
When you run your tests, you might notice that the
|
264
|
+
When you run your tests, you might notice that the Errornot service is recording
|
265
265
|
notices generated using #notify when you don't expect it to. You can
|
266
266
|
use code like this in your test_helper.rb to redefine that method so those
|
267
267
|
errors are not reported while running tests.
|
268
268
|
|
269
|
-
module
|
269
|
+
module ErrornotNotifier
|
270
270
|
def self.notify(thing)
|
271
271
|
# do nothing.
|
272
272
|
end
|
273
273
|
end
|
274
274
|
|
275
|
+
== Proxy Support
|
276
|
+
|
277
|
+
The notifier supports using a proxy, if your server is not able to directly reach the Errornot servers. To configure the proxy settings, added the following information to your Errornot configuration block.
|
278
|
+
|
279
|
+
ErrornotNotifier.configure do |config|
|
280
|
+
config.proxy_host = ...
|
281
|
+
config.proxy_port = ...
|
282
|
+
config.proxy_user = ...
|
283
|
+
config.proxy_pass = ...
|
284
|
+
|
275
285
|
== Supported Rails versions
|
276
286
|
|
277
287
|
See SUPPORTED_RAILS_VERSIONS for a list of official supported versions of
|
278
288
|
Rails.
|
279
289
|
|
280
|
-
Please open up a support ticket on Tender ( http://help.
|
290
|
+
Please open up a support ticket on Tender ( http://help.Errornotapp.com ) if
|
281
291
|
you're using a version of Rails that is not listed above and the notifier is
|
282
292
|
not working properly.
|
283
293
|
|
data/Rakefile
CHANGED
@@ -7,7 +7,7 @@ require 'cucumber/rake/task'
|
|
7
7
|
desc 'Default: run unit tests.'
|
8
8
|
task :default => [:test, :cucumber]
|
9
9
|
|
10
|
-
desc 'Test the
|
10
|
+
desc 'Test the errornot_notifier gem.'
|
11
11
|
Rake::TestTask.new(:test) do |t|
|
12
12
|
t.libs << 'lib'
|
13
13
|
t.pattern = 'test/**/*_test.rb'
|
@@ -22,6 +22,83 @@ task :ginger do
|
|
22
22
|
load File.join(*%w[vendor ginger bin ginger])
|
23
23
|
end
|
24
24
|
|
25
|
+
namespace :changeling do
|
26
|
+
desc "Bumps the version by a minor or patch version, depending on what was passed in."
|
27
|
+
task :bump, :part do |t, args|
|
28
|
+
# Thanks, Jeweler!
|
29
|
+
if ErrornotNotifier::VERSION =~ /^(\d+)\.(\d+)\.(\d+)(?:\.(.*?))?$/
|
30
|
+
major = $1.to_i
|
31
|
+
minor = $2.to_i
|
32
|
+
patch = $3.to_i
|
33
|
+
build = $4
|
34
|
+
else
|
35
|
+
abort
|
36
|
+
end
|
37
|
+
|
38
|
+
case args[:part]
|
39
|
+
when /minor/
|
40
|
+
minor += 1
|
41
|
+
patch = 0
|
42
|
+
when /patch/
|
43
|
+
patch += 1
|
44
|
+
else
|
45
|
+
abort
|
46
|
+
end
|
47
|
+
|
48
|
+
version = [major, minor, patch, build].compact.join('.')
|
49
|
+
|
50
|
+
File.open(File.join("lib", "errornot_notifier", "version.rb"), "w") do |f|
|
51
|
+
f.write <<EOF
|
52
|
+
module ErrornotNotifier
|
53
|
+
VERSION = "#{version}".freeze
|
54
|
+
end
|
55
|
+
EOF
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
desc "Writes out the new CHANGELOG and prepares the release"
|
60
|
+
task :change do
|
61
|
+
load 'lib/errornot_notifier/version.rb'
|
62
|
+
file = "CHANGELOG"
|
63
|
+
old = File.read(file)
|
64
|
+
version = ErrornotNotifier::VERSION
|
65
|
+
message = "Bumping to version #{version}"
|
66
|
+
|
67
|
+
File.open(file, "w") do |f|
|
68
|
+
f.write <<EOF
|
69
|
+
Version #{version} - #{Date.today}
|
70
|
+
===============================================================================
|
71
|
+
|
72
|
+
#{`git log $(git tag | tail -1)..HEAD | git shortlog`}
|
73
|
+
#{old}
|
74
|
+
EOF
|
75
|
+
end
|
76
|
+
|
77
|
+
exec ["#{ENV["EDITOR"]} #{file}",
|
78
|
+
"git commit -aqm '#{message}'",
|
79
|
+
"git tag -a -m '#{message}' v#{version}",
|
80
|
+
"echo '\n\n\033[32mMarked v#{version} /' `git show-ref -s refs/heads/master` 'for release. Run: rake changeling:push\033[0m\n\n'"].join(' && ')
|
81
|
+
end
|
82
|
+
|
83
|
+
desc "Bump by a minor version (1.2.3 => 1.3.0)"
|
84
|
+
task :minor do |t|
|
85
|
+
Rake::Task['changeling:bump'].invoke(t.name)
|
86
|
+
Rake::Task['changeling:change'].invoke
|
87
|
+
end
|
88
|
+
|
89
|
+
desc "Bump by a patch version, (1.2.3 => 1.2.4)"
|
90
|
+
task :patch do |t|
|
91
|
+
Rake::Task['changeling:bump'].invoke(t.name)
|
92
|
+
Rake::Task['changeling:change'].invoke
|
93
|
+
end
|
94
|
+
|
95
|
+
desc "Push the latest version and tags"
|
96
|
+
task :push do |t|
|
97
|
+
system("git push origin master")
|
98
|
+
system("git push origin $(git tag | tail -1)")
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
25
102
|
begin
|
26
103
|
require 'yard'
|
27
104
|
YARD::Rake::YardocTask.new do |t|
|
@@ -31,13 +108,13 @@ rescue LoadError
|
|
31
108
|
end
|
32
109
|
|
33
110
|
GEM_ROOT = File.dirname(__FILE__).freeze
|
34
|
-
VERSION_FILE = File.join(GEM_ROOT, 'lib', '
|
111
|
+
VERSION_FILE = File.join(GEM_ROOT, 'lib', 'errornot_notifier', 'version')
|
35
112
|
|
36
113
|
require VERSION_FILE
|
37
114
|
|
38
115
|
gemspec = Gem::Specification.new do |s|
|
39
116
|
s.name = %q{errornot_notifier}
|
40
|
-
s.version =
|
117
|
+
s.version = ErrornotNotifier::VERSION
|
41
118
|
s.summary = %q{Send your application errors to a hosted service and reclaim your inbox.}
|
42
119
|
|
43
120
|
s.files = FileList['[A-Z]*', 'generators/**/*.*', 'lib/**/*.rb',
|
@@ -58,8 +135,8 @@ gemspec = Gem::Specification.new do |s|
|
|
58
135
|
s.add_development_dependency("shoulda")
|
59
136
|
|
60
137
|
s.authors = ["thoughtbot, inc, Cyril Mougel"]
|
61
|
-
s.email = %q{
|
62
|
-
s.homepage = "http://
|
138
|
+
s.email = %q{cyril.mougel@gmail.com}
|
139
|
+
s.homepage = "http://github.com/shingara/errornot_notifier"
|
63
140
|
|
64
141
|
s.platform = Gem::Platform::RUBY
|
65
142
|
end
|
@@ -85,19 +162,26 @@ LOCAL_GEMS = [['sham_rack', nil], ['capistrano', nil], ['sqlite3-ruby', nil], ['
|
|
85
162
|
RAILS_VERSIONS.collect { |version| ['rails', version] }
|
86
163
|
|
87
164
|
task :vendor_test_gems do
|
165
|
+
old_gem_path = ENV['GEM_PATH']
|
166
|
+
old_gem_home = ENV['GEM_HOME']
|
167
|
+
ENV['GEM_PATH'] = LOCAL_GEM_ROOT
|
168
|
+
ENV['GEM_HOME'] = LOCAL_GEM_ROOT
|
88
169
|
LOCAL_GEMS.each do |gem_name, version|
|
89
170
|
gem_file_pattern = [gem_name, version || '*'].compact.join('-')
|
90
171
|
version_option = version ? "-v #{version}" : ''
|
91
172
|
pattern = File.join(LOCAL_GEM_ROOT, 'gems', "#{gem_file_pattern}")
|
92
173
|
existing = Dir.glob(pattern).first
|
93
174
|
unless existing
|
94
|
-
command = "gem install -i #{LOCAL_GEM_ROOT} --no-ri --no-rdoc #{version_option} #{gem_name}"
|
175
|
+
command = "gem install -i #{LOCAL_GEM_ROOT} --no-ri --no-rdoc --backtrace #{version_option} #{gem_name}"
|
95
176
|
puts "Vendoring #{gem_file_pattern}..."
|
96
|
-
unless system(command)
|
97
|
-
|
177
|
+
unless system("#{command} 2>&1")
|
178
|
+
puts "Command failed: #{command}"
|
179
|
+
exit(1)
|
98
180
|
end
|
99
181
|
end
|
100
182
|
end
|
183
|
+
ENV['GEM_PATH'] = old_gem_path
|
184
|
+
ENV['GEM_HOME'] = old_gem_home
|
101
185
|
end
|
102
186
|
|
103
187
|
Cucumber::Rake::Task.new(:cucumber) do |t|
|
data/TESTING.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
= For Maintainers:
|
2
2
|
|
3
|
-
When developing the
|
3
|
+
When developing the Errornot Notifier, be sure to use the integration test
|
4
4
|
against an existing project on staging before pushing to master.
|
5
5
|
|
6
6
|
+./script/integration_test.rb <test project's api key> <staging server hostname>+
|
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + "/lib/insert_commands.rb")
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + "/lib/rake_commands.rb")
|
3
3
|
|
4
|
-
class
|
4
|
+
class ErrornotGenerator < Rails::Generator::Base
|
5
5
|
def add_options!(opt)
|
6
6
|
opt.on('-k', '--api-key=key', String, "Your ErrorNot API key") {|v| options[:api_key] = v}
|
7
7
|
opt.on('-s', '--server=host', String, "Your host with errorNot is installed") {|v| options[:host] = v}
|
@@ -19,7 +19,7 @@ class HoptoadGenerator < Rails::Generator::Base
|
|
19
19
|
end
|
20
20
|
record do |m|
|
21
21
|
m.directory 'lib/tasks'
|
22
|
-
m.file '
|
22
|
+
m.file 'errornot_notifier_tasks.rake', 'lib/tasks/errornot_notifier_tasks.rake'
|
23
23
|
if File.exists?('config/deploy.rb')
|
24
24
|
m.append_to 'config/deploy.rb', capistrano_hook
|
25
25
|
end
|
@@ -32,10 +32,10 @@ class HoptoadGenerator < Rails::Generator::Base
|
|
32
32
|
m.template 'initializer.rb', 'config/errornot.rb',
|
33
33
|
:assigns => {:api_key => options[:api_key],
|
34
34
|
:host => options[:host]}
|
35
|
-
m.append_to 'config/environment.rb', "require 'config/
|
35
|
+
m.append_to 'config/environment.rb', "require 'config/errornot'"
|
36
36
|
end
|
37
37
|
end
|
38
|
-
m.rake "
|
38
|
+
m.rake "errornot:test", :generate_only => true
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
@@ -44,8 +44,8 @@ class HoptoadGenerator < Rails::Generator::Base
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def api_key_configured?
|
47
|
-
File.exists?('config/initializers/
|
48
|
-
system("grep
|
47
|
+
File.exists?('config/initializers/errornot.rb') ||
|
48
|
+
system("grep ErrornotNotifier config/environment.rb")
|
49
49
|
end
|
50
50
|
|
51
51
|
def capistrano_hook
|
File without changes
|
File without changes
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<% if Rails::VERSION::MINOR < 2 -%>
|
2
|
-
require '
|
2
|
+
require 'errornot_notifier/rails'
|
3
3
|
<% end -%>
|
4
|
-
|
4
|
+
ErrornotNotifier.configure do |config|
|
5
5
|
config.api_key = '<%= api_key %>'
|
6
6
|
config.host = '<%= host %>'
|
7
7
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# Defines deploy:notify_errornot which will send information about the deploy to Errornot.
|
2
|
+
|
3
|
+
Capistrano::Configuration.instance(:must_exist).load do
|
4
|
+
after "deploy", "deploy:notify_errornot"
|
5
|
+
after "deploy:migrations", "deploy:notify_errornot"
|
6
|
+
|
7
|
+
namespace :deploy do
|
8
|
+
desc "Notify Errornot of the deployment"
|
9
|
+
task :notify_errornot, :except => { :no_release => true } do
|
10
|
+
rails_env = fetch(:errornot_env, fetch(:rails_env, "production"))
|
11
|
+
local_user = ENV['USER'] || ENV['USERNAME']
|
12
|
+
executable = RUBY_PLATFORM.downcase.include?('mswin') ? 'rake.bat' : 'rake'
|
13
|
+
notify_command = "#{executable} errornot:deploy TO=#{rails_env} REVISION=#{current_revision} REPO=#{repository} USER=#{local_user}"
|
14
|
+
notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
|
15
|
+
puts "Notifying Errornot of Deploy (#{notify_command})"
|
16
|
+
`#{notify_command}`
|
17
|
+
puts "Errornot Notification Complete."
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|