hoptoad_notifier 2.1.0 → 2.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/SUPPORTED_RAILS_VERSIONS +1 -1
- data/generators/hoptoad/hoptoad_generator.rb +5 -1
- data/generators/hoptoad/templates/capistrano_hook.rb +6 -0
- data/lib/hoptoad_notifier/version.rb +1 -1
- data/script/integration_test.rb +38 -0
- metadata +4 -3
- data/tasks/hoptoad_notifier_tasks.rake +0 -89
data/Rakefile
CHANGED
@@ -41,7 +41,7 @@ gemspec = Gem::Specification.new do |s|
|
|
41
41
|
s.summary = %q{Send your application errors to our hosted service and reclaim your inbox.}
|
42
42
|
|
43
43
|
s.files = FileList['[A-Z]*', 'generators/**/*.*', 'lib/**/*.rb',
|
44
|
-
'test/**/*.rb', 'rails/**/*.rb', '
|
44
|
+
'test/**/*.rb', 'rails/**/*.rb', 'script/*']
|
45
45
|
s.require_path = 'lib'
|
46
46
|
s.test_files = Dir[*['test/**/*_test.rb']]
|
47
47
|
|
data/SUPPORTED_RAILS_VERSIONS
CHANGED
@@ -15,7 +15,7 @@ class HoptoadGenerator < Rails::Generator::Base
|
|
15
15
|
m.directory 'lib/tasks'
|
16
16
|
m.file 'hoptoad_notifier_tasks.rake', 'lib/tasks/hoptoad_notifier_tasks.rake'
|
17
17
|
if File.exists?('config/deploy.rb')
|
18
|
-
m.append_to 'config/deploy.rb',
|
18
|
+
m.append_to 'config/deploy.rb', capistrano_hook
|
19
19
|
end
|
20
20
|
if options[:api_key]
|
21
21
|
if use_initializer?
|
@@ -39,4 +39,8 @@ class HoptoadGenerator < Rails::Generator::Base
|
|
39
39
|
File.exists?('config/initializers/hoptoad.rb') ||
|
40
40
|
system("grep HoptoadNotifier config/environment.rb")
|
41
41
|
end
|
42
|
+
|
43
|
+
def capistrano_hook
|
44
|
+
IO.read(source_path('capistrano_hook.rb'))
|
45
|
+
end
|
42
46
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'logger'
|
4
|
+
require 'fileutils'
|
5
|
+
|
6
|
+
RAILS_ENV = "production"
|
7
|
+
RAILS_ROOT = FileUtils.pwd
|
8
|
+
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
|
9
|
+
|
10
|
+
$: << File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib'))
|
11
|
+
require 'hoptoad_notifier'
|
12
|
+
require 'rails/init'
|
13
|
+
|
14
|
+
fail "Please supply an API Key as the first argument" if ARGV.empty?
|
15
|
+
|
16
|
+
host = ARGV[1]
|
17
|
+
host ||= "hoptoadapp.com"
|
18
|
+
|
19
|
+
secure = (ARGV[2] == "secure")
|
20
|
+
|
21
|
+
exception = begin
|
22
|
+
raise "Testing hoptoad notifier with secure = #{secure}. If you can see this, it works."
|
23
|
+
rescue => foo
|
24
|
+
foo
|
25
|
+
end
|
26
|
+
|
27
|
+
HoptoadNotifier.configure do |config|
|
28
|
+
config.secure = secure
|
29
|
+
config.host = host
|
30
|
+
config.api_key = ARGV.first
|
31
|
+
end
|
32
|
+
puts "Configuration:"
|
33
|
+
HoptoadNotifier.configuration.to_hash.each do |key, value|
|
34
|
+
puts sprintf("%25s: %s", key.to_s, value.inspect.slice(0, 55))
|
35
|
+
end
|
36
|
+
puts "Sending #{secure ? "" : "in"}secure notification to project with key #{ARGV.first}"
|
37
|
+
HoptoadNotifier.notify(exception)
|
38
|
+
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hoptoad_notifier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.1.
|
4
|
+
version: 2.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thoughtbot, inc
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2010-01-
|
12
|
+
date: 2010-01-20 00:00:00 -05:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- generators/hoptoad/hoptoad_generator.rb
|
32
32
|
- generators/hoptoad/lib/insert_commands.rb
|
33
33
|
- generators/hoptoad/lib/rake_commands.rb
|
34
|
+
- generators/hoptoad/templates/capistrano_hook.rb
|
34
35
|
- generators/hoptoad/templates/hoptoad_notifier_tasks.rake
|
35
36
|
- generators/hoptoad/templates/initializer.rb
|
36
37
|
- lib/hoptoad_notifier/backtrace.rb
|
@@ -56,7 +57,7 @@ files:
|
|
56
57
|
- test/rails_initializer_test.rb
|
57
58
|
- test/sender_test.rb
|
58
59
|
- rails/init.rb
|
59
|
-
-
|
60
|
+
- script/integration_test.rb
|
60
61
|
has_rdoc: true
|
61
62
|
homepage: http://www.hoptoadapp.com
|
62
63
|
licenses: []
|
@@ -1,89 +0,0 @@
|
|
1
|
-
namespace :hoptoad do
|
2
|
-
desc "Notify Hoptoad of a new deploy."
|
3
|
-
task :deploy => :environment do
|
4
|
-
require 'hoptoad_tasks'
|
5
|
-
HoptoadTasks.deploy(:rails_env => ENV['TO'],
|
6
|
-
:scm_revision => ENV['REVISION'],
|
7
|
-
:scm_repository => ENV['REPO'],
|
8
|
-
:local_username => ENV['USER'],
|
9
|
-
:api_key => ENV['API_KEY'])
|
10
|
-
end
|
11
|
-
|
12
|
-
task :log_stdout do
|
13
|
-
require 'logger'
|
14
|
-
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT)
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "Verify your gem installation by sending a test exception to the hoptoad service"
|
18
|
-
task :test => ['hoptoad:log_stdout', :environment] do
|
19
|
-
RAILS_DEFAULT_LOGGER.level = Logger::DEBUG
|
20
|
-
|
21
|
-
require 'action_controller/test_process'
|
22
|
-
require 'app/controllers/application' if File.exists?('app/controllers/application.rb')
|
23
|
-
|
24
|
-
request = ActionController::TestRequest.new
|
25
|
-
response = ActionController::TestResponse.new
|
26
|
-
|
27
|
-
class HoptoadTestingException < RuntimeError; end
|
28
|
-
|
29
|
-
unless HoptoadNotifier.configuration.api_key
|
30
|
-
puts "Hoptoad needs an API key configured! Check the README to see how to add it."
|
31
|
-
exit
|
32
|
-
end
|
33
|
-
|
34
|
-
HoptoadNotifier.configuration.development_environments = []
|
35
|
-
|
36
|
-
in_controller = ApplicationController.included_modules.include? HoptoadNotifier::Catcher
|
37
|
-
in_base = ActionController::Base.included_modules.include? HoptoadNotifier::Catcher
|
38
|
-
if !in_controller || !in_base
|
39
|
-
puts "HoptoadNotifier::Catcher must be included inside your ApplicationController class."
|
40
|
-
exit
|
41
|
-
end
|
42
|
-
|
43
|
-
puts "Configuration:"
|
44
|
-
HoptoadNotifier.configuration.to_hash.each do |key, value|
|
45
|
-
puts sprintf("%25s: %s", key.to_s, value.inspect.slice(0, 55))
|
46
|
-
end
|
47
|
-
|
48
|
-
puts 'Setting up the Controller.'
|
49
|
-
class ApplicationController
|
50
|
-
# This is to bypass any filters that may prevent access to the action.
|
51
|
-
prepend_before_filter :test_hoptoad
|
52
|
-
def test_hoptoad
|
53
|
-
puts "Raising '#{exception_class.name}' to simulate application failure."
|
54
|
-
raise exception_class.new, 'Testing hoptoad via "rake hoptoad:test". If you can see this, it works.'
|
55
|
-
end
|
56
|
-
|
57
|
-
def rescue_action exception
|
58
|
-
rescue_action_in_public exception
|
59
|
-
end
|
60
|
-
|
61
|
-
# Ensure we actually have an action to go to.
|
62
|
-
def verify; end
|
63
|
-
|
64
|
-
def consider_all_requests_local
|
65
|
-
false
|
66
|
-
end
|
67
|
-
|
68
|
-
def local_request?
|
69
|
-
false
|
70
|
-
end
|
71
|
-
|
72
|
-
def exception_class
|
73
|
-
exception_name = ENV['EXCEPTION'] || "HoptoadTestingException"
|
74
|
-
Object.const_get(exception_name)
|
75
|
-
rescue
|
76
|
-
Object.const_set(exception_name, Class.new(Exception))
|
77
|
-
end
|
78
|
-
|
79
|
-
def logger
|
80
|
-
nil
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
puts 'Processing request.'
|
85
|
-
class HoptoadVerificationController < ApplicationController; end
|
86
|
-
HoptoadVerificationController.new.process(request, response)
|
87
|
-
end
|
88
|
-
end
|
89
|
-
|