hoptoad_notifier 2.4.9 → 2.4.10
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/Rakefile +1 -0
- data/SUPPORTED_RAILS_VERSIONS +2 -0
- data/lib/hoptoad_notifier/backtrace.rb +2 -1
- data/lib/hoptoad_notifier/capistrano.rb +2 -1
- data/lib/hoptoad_notifier/shared_tasks.rb +2 -1
- data/lib/hoptoad_notifier/tasks.rb +3 -3
- data/lib/hoptoad_tasks.rb +9 -3
- data/test/backtrace_test.rb +19 -0
- data/test/helper.rb +1 -0
- data/test/hoptoad_tasks_test.rb +12 -1
- metadata +6 -8
data/Rakefile
CHANGED
@@ -158,6 +158,7 @@ RAILS_VERSIONS = IO.read('SUPPORTED_RAILS_VERSIONS').strip.split("\n")
|
|
158
158
|
LOCAL_GEMS = [['sham_rack', nil], ['capistrano', nil], ['sqlite3-ruby', nil], ['sinatra', nil]] +
|
159
159
|
RAILS_VERSIONS.collect { |version| ['rails', version] }
|
160
160
|
|
161
|
+
desc "Vendor test gems: Run this once to prepare your test environment"
|
161
162
|
task :vendor_test_gems do
|
162
163
|
old_gem_path = ENV['GEM_PATH']
|
163
164
|
old_gem_home = ENV['GEM_HOME']
|
data/SUPPORTED_RAILS_VERSIONS
CHANGED
@@ -5,7 +5,8 @@ module HoptoadNotifier
|
|
5
5
|
# Handles backtrace parsing line by line
|
6
6
|
class Line
|
7
7
|
|
8
|
-
|
8
|
+
# regexp (optionnally allowing leading X: for windows support)
|
9
|
+
INPUT_FORMAT = %r{^((?:[a-zA-Z]:)?[^:]+):(\d+)(?::in `([^']+)')?$}.freeze
|
9
10
|
|
10
11
|
# The file portion of the line (such as app/models/user.rb)
|
11
12
|
attr_reader :file
|
@@ -9,8 +9,9 @@ Capistrano::Configuration.instance(:must_exist).load do
|
|
9
9
|
task :notify_hoptoad, :except => { :no_release => true } do
|
10
10
|
rails_env = fetch(:hoptoad_env, fetch(:rails_env, "production"))
|
11
11
|
local_user = ENV['USER'] || ENV['USERNAME']
|
12
|
-
executable = RUBY_PLATFORM.downcase.include?('mswin') ? 'rake.bat' : 'rake'
|
12
|
+
executable = RUBY_PLATFORM.downcase.include?('mswin') ? fetch(:rake, 'rake.bat') : fetch(:rake, 'rake')
|
13
13
|
notify_command = "#{executable} hoptoad:deploy TO=#{rails_env} REVISION=#{current_revision} REPO=#{repository} USER=#{local_user}"
|
14
|
+
notify_command << " DRY_RUN=true" if dry_run
|
14
15
|
notify_command << " API_KEY=#{ENV['API_KEY']}" if ENV['API_KEY']
|
15
16
|
puts "Notifying Hoptoad of Deploy (#{notify_command})"
|
16
17
|
`#{notify_command}`
|
@@ -8,7 +8,7 @@ namespace :hoptoad do
|
|
8
8
|
|
9
9
|
require 'action_controller/test_process'
|
10
10
|
|
11
|
-
Dir["app/controllers/application*.rb"].each { |file| require(file) }
|
11
|
+
Dir["app/controllers/application*.rb"].each { |file| require(File.expand_path(file)) }
|
12
12
|
|
13
13
|
class HoptoadTestingException < RuntimeError; end
|
14
14
|
|
@@ -63,9 +63,9 @@ namespace :hoptoad do
|
|
63
63
|
|
64
64
|
def exception_class
|
65
65
|
exception_name = ENV['EXCEPTION'] || "HoptoadTestingException"
|
66
|
-
Object.const_get(
|
66
|
+
exception_name.split("::").inject(Object){|klass, name| klass.const_get(name)}
|
67
67
|
rescue
|
68
|
-
Object.const_set(exception_name, Class.new(Exception))
|
68
|
+
Object.const_set(exception_name.gsub(/:+/, "_"), Class.new(Exception))
|
69
69
|
end
|
70
70
|
|
71
71
|
def logger
|
data/lib/hoptoad_tasks.rb
CHANGED
@@ -24,6 +24,7 @@ module HoptoadTasks
|
|
24
24
|
return false
|
25
25
|
end
|
26
26
|
|
27
|
+
dry_run = opts.delete(:dry_run)
|
27
28
|
params = {'api_key' => opts.delete(:api_key) ||
|
28
29
|
HoptoadNotifier.configuration.api_key}
|
29
30
|
opts.each {|k,v| params["deploy[#{k}]"] = v }
|
@@ -35,10 +36,15 @@ module HoptoadTasks
|
|
35
36
|
HoptoadNotifier.configuration.proxy_user,
|
36
37
|
HoptoadNotifier.configuration.proxy_pass)
|
37
38
|
|
38
|
-
|
39
|
+
if dry_run
|
40
|
+
puts url, params.inspect
|
41
|
+
return true
|
42
|
+
else
|
43
|
+
response = proxy.post_form(url, params)
|
39
44
|
|
40
|
-
|
41
|
-
|
45
|
+
puts response.body
|
46
|
+
return Net::HTTPSuccess === response
|
47
|
+
end
|
42
48
|
end
|
43
49
|
end
|
44
50
|
|
data/test/backtrace_test.rb
CHANGED
@@ -20,6 +20,25 @@ class BacktraceTest < Test::Unit::TestCase
|
|
20
20
|
assert_equal 'app/controllers/users_controller.rb', line.file
|
21
21
|
assert_equal 'index', line.method
|
22
22
|
end
|
23
|
+
|
24
|
+
should "parse a windows backtrace into lines" do
|
25
|
+
array = [
|
26
|
+
"C:/Program Files/Server/app/models/user.rb:13:in `magic'",
|
27
|
+
"C:/Program Files/Server/app/controllers/users_controller.rb:8:in `index'"
|
28
|
+
]
|
29
|
+
|
30
|
+
backtrace = HoptoadNotifier::Backtrace.parse(array)
|
31
|
+
|
32
|
+
line = backtrace.lines.first
|
33
|
+
assert_equal '13', line.number
|
34
|
+
assert_equal 'C:/Program Files/Server/app/models/user.rb', line.file
|
35
|
+
assert_equal 'magic', line.method
|
36
|
+
|
37
|
+
line = backtrace.lines.last
|
38
|
+
assert_equal '8', line.number
|
39
|
+
assert_equal 'C:/Program Files/Server/app/controllers/users_controller.rb', line.file
|
40
|
+
assert_equal 'index', line.method
|
41
|
+
end
|
23
42
|
|
24
43
|
should "be equal with equal lines" do
|
25
44
|
one = build_backtrace_array
|
data/test/helper.rb
CHANGED
data/test/hoptoad_tasks_test.rb
CHANGED
@@ -49,7 +49,18 @@ class HoptoadTasksTest < Test::Unit::TestCase
|
|
49
49
|
HoptoadNotifier.configuration.proxy_pass).
|
50
50
|
returns(@http_proxy)
|
51
51
|
|
52
|
-
@options = { :rails_env => "staging" }
|
52
|
+
@options = { :rails_env => "staging", :dry_run => false }
|
53
|
+
end
|
54
|
+
|
55
|
+
context "performing a dry run" do
|
56
|
+
setup { @output = HoptoadTasks.deploy(@options.merge(:dry_run => true)) }
|
57
|
+
|
58
|
+
should "return true without performing any actual request" do
|
59
|
+
assert_equal true, @output
|
60
|
+
assert_received(@http_proxy, :post_form) do|expects|
|
61
|
+
expects.never
|
62
|
+
end
|
63
|
+
end
|
53
64
|
end
|
54
65
|
|
55
66
|
context "on deploy(options)" do
|
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:
|
5
|
-
prerelease:
|
4
|
+
hash: 11
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 4
|
9
|
-
-
|
10
|
-
version: 2.4.
|
9
|
+
- 10
|
10
|
+
version: 2.4.10
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- thoughtbot, inc
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03
|
19
|
-
default_executable:
|
18
|
+
date: 2011-05-03 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: builder
|
@@ -177,7 +176,6 @@ files:
|
|
177
176
|
- script/integration_test.rb
|
178
177
|
- lib/templates/javascript_notifier.erb
|
179
178
|
- lib/templates/rescue.erb
|
180
|
-
has_rdoc: true
|
181
179
|
homepage: http://www.hoptoadapp.com
|
182
180
|
licenses: []
|
183
181
|
|
@@ -207,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
207
205
|
requirements: []
|
208
206
|
|
209
207
|
rubyforge_project:
|
210
|
-
rubygems_version: 1.
|
208
|
+
rubygems_version: 1.7.2
|
211
209
|
signing_key:
|
212
210
|
specification_version: 3
|
213
211
|
summary: Send your application errors to our hosted service and reclaim your inbox.
|