failbot_rails 0.3.2 → 0.7.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.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 441b416474c1c69f22134a48f0020ad0785dc5553265f53cc783ee8197a9f5b3
4
+ data.tar.gz: 519fe049ede9e2befbcdd49cf01122dd764f3e1c4a08123dc872084702ee40ca
5
+ SHA512:
6
+ metadata.gz: 3d9abe3b2fa52c43867175219a9a7170404ddf613a69f5c5eb8497e56341e087c7cb109c10dbf43d49274490b4c6f8f4b6b6269251aab4f70dd439775d4df5cf
7
+ data.tar.gz: ffbf33ec1535ce975f005e2b7771a6f026f8f26e860933f5fd72169ccea2ffe423893b4bfe5d2b152b03cae30239d100c28af1bd3e7cb9404621b951fba7c9b8
data/.gitignore ADDED
@@ -0,0 +1,15 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ *.bundle
11
+ *.so
12
+ *.o
13
+ *.a
14
+ mkmf.log
15
+ vendor/gems
data/Dockerfile ADDED
@@ -0,0 +1,6 @@
1
+ FROM ruby:2.5
2
+
3
+ WORKDIR /ci
4
+ ADD . .
5
+
6
+ ENTRYPOINT ["/ci/script/cibuild.docker"]
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in failbot_rails.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2014 GitHub
2
+
3
+ MIT License
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining
6
+ a copy of this software and associated documentation files (the
7
+ "Software"), to deal in the Software without restriction, including
8
+ without limitation the rights to use, copy, modify, merge, publish,
9
+ distribute, sublicense, and/or sell copies of the Software, and to
10
+ permit persons to whom the Software is furnished to do so, subject to
11
+ the following conditions:
12
+
13
+ The above copyright notice and this permission notice shall be
14
+ included in all copies or substantial portions of the Software.
15
+
16
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -12,7 +12,7 @@ Add it to the app's Gemfile manifest. The gem is publicly available but **keep
12
12
  this repository private.**
13
13
 
14
14
  ```ruby
15
- gem "failbot_rails", "~>0.3.1"
15
+ gem "failbot_rails", "~>0.3.4"
16
16
  ```
17
17
 
18
18
  ## Usage
@@ -33,6 +33,34 @@ FailbotRails.setup("my_app")
33
33
  Every library, script or unicorn that loads the Rails environment are now setup
34
34
  to automatically report all exceptions to Haystack.
35
35
 
36
+ ### ENV Vars
37
+
38
+ In order for your exceptions to reach Haystack, you'll need to inform your
39
+ application of how to do that. Set these `ENV` vars on your application in
40
+ production.
41
+
42
+ #### Heroku
43
+
44
+ To use failbot with heroku applications, the application needs the following environment variables set:
45
+
46
+ * `FAILBOT_BACKEND`
47
+ * `FAILBOT_HAYSTACK_URL`
48
+
49
+ `FAILBOT_BACKEND` should always be set to `http`. `FAILBOT_HAYSTACK_URL` should be set to the value of `FAILBOT_HAYSTACK_URL` of https://github.com/github/puppet/blob/master/modules/github/files/home/deploy/.rbexec/_failbot.rb.
50
+
51
+ Most versions of Failbot expect `FAILBOT_BACKEND` to always be present. Try adding this line above `require 'failbot'` to ensure that if `FAILBOT_BACKEND` isn't configured, it will fall back to `memory`:
52
+
53
+ ```ruby
54
+ ENV["FAILBOT_BACKEND"] ||= "memory"
55
+ ```
56
+
57
+
58
+ #### EC2
59
+
60
+ Apps hosted on EC2 are managed by puppet. Puppet has these ENV vars already. You
61
+ don't have to worry about them.
62
+
63
+
36
64
  ### `failbot_context`
37
65
 
38
66
  The exception context is automatically populated with request metadata including
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rake/testtask'
4
+
5
+ Rake::TestTask.new do |t|
6
+ t.pattern = "test/**/*_test.rb"
7
+ end
8
+
9
+ task :default => :test
@@ -1,21 +1,29 @@
1
- # -*- encoding: utf-8 -*-
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'failbot_rails/version'
2
5
 
3
- Gem::Specification.new do |s|
4
- s.name = "failbot_rails"
5
- s.version = "0.3.2"
6
- s.platform = Gem::Platform::RUBY
7
- s.authors = %w[@sr]
8
- s.email = ["sr@github.com"]
9
- s.homepage = "https://github.com/github/failbot_rails#readme"
10
- s.summary = "Glue code for using Failbot in a Rails app"
11
- s.description = s.summary
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "failbot_rails"
8
+ spec.version = FailbotRails::VERSION
9
+ spec.authors = ["sr", "Grant Rodgers"]
10
+ spec.email = ["grant.rodgers@github.com"]
11
+ spec.summary = %q{Glue code for using Failbot in a Rails app}
12
+ spec.description = %q{Glue code for using Failbot in a Rails app}
13
+ spec.homepage = "https://github.com/github/failbot_rails"
14
+ spec.license = "MIT"
12
15
 
13
- s.required_rubygems_version = ">= 1.3.6"
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.files.reject! { |filename| filename == ".ruby-version" }
14
18
 
15
- s.add_runtime_dependency "failbot", "~>0.9.1"
19
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
20
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
+ spec.require_paths = ["lib"]
16
22
 
17
- s.files = `git ls-files`.split("\n") - %w[Gemfile Gemfile.lock]
18
- s.test_files = `git ls-files -- test`.split("\n").select { |f| f =~ /_test.rb$/ }
19
- s.executables = `git ls-files -- bin`.split("\n").map { |f| File.basename(f) }
20
- s.require_paths = %w[lib]
23
+ spec.add_runtime_dependency "failbot", ">= 0.9.2", "< 3"
24
+ spec.add_runtime_dependency "rails", "~> 6.0"
25
+
26
+ spec.add_development_dependency "rake", "~> 10.0"
27
+
28
+ spec.required_ruby_version = ">= 2.5.0"
21
29
  end
data/lib/failbot_rails.rb CHANGED
@@ -6,7 +6,7 @@ require "rails/railtie"
6
6
  require "active_support/concern"
7
7
 
8
8
  module FailbotRails
9
- def self.setup(app_name)
9
+ def self.setup(app_name, default_context={})
10
10
  if _setup
11
11
  fail "FailbotRails already setup"
12
12
  end
@@ -26,7 +26,7 @@ module FailbotRails
26
26
  end
27
27
  end
28
28
 
29
- Failbot.setup(settings, {:app => app_name.to_str})
29
+ Failbot.setup(settings, default_context.merge({:app => app_name.to_str}))
30
30
  Failbot.install_unhandled_exception_hook!
31
31
 
32
32
  @_setup = true
@@ -63,30 +63,18 @@ module FailbotRails
63
63
  class Middleware < ::Failbot::Rescuer
64
64
  def initialize(app)
65
65
  @app = app
66
+ @other = {}
66
67
  end
67
68
 
68
- def call(env)
69
- request = Rack::Request.new(env)
70
- @app.call(env)
71
- rescue Exception
72
- context = {
73
- :method => request.request_method,
74
- :url => request.url,
75
- :user_agent => request.env["HTTP_USER_AGENT"],
76
- :params => request.params,
77
- :session => (request.session.to_hash rescue nil),
78
- :referrer => request.referrer,
79
- :remote_ip => request.ip,
80
- }
81
- Failbot.report($!, ::FailbotRails._failbot_safe_context(context))
82
- raise
69
+ def self.context(env)
70
+ ::FailbotRails._failbot_safe_context(super)
83
71
  end
84
72
  end
85
73
 
86
74
  def self._failbot_safe_context(context)
87
75
  new_context = {}.merge(context)
88
76
  filters = Rails.application.config.filter_parameters
89
- filter = ActionDispatch::Http::ParameterFilter.new(filters)
77
+ filter = ActiveSupport::ParameterFilter.new(filters)
90
78
 
91
79
  if new_context.key?(:params)
92
80
  new_context[:params] = filter.filter(new_context[:params])
@@ -100,9 +88,9 @@ module FailbotRails
100
88
 
101
89
  included do
102
90
  # reset context before populating it with rails-specific info
103
- before_filter :_failbot_rails
91
+ before_action :_failbot_rails
104
92
 
105
- helper_method :failbot
93
+ respond_to?(:helper_method) and helper_method :failbot
106
94
  end
107
95
 
108
96
  private
@@ -122,9 +110,6 @@ module FailbotRails
122
110
  end
123
111
 
124
112
  def _failbot_rails
125
- # clear context before every request
126
- Failbot.reset!
127
-
128
113
  context = {
129
114
  :controller => params[:controller],
130
115
  :action => params[:action],
@@ -0,0 +1,3 @@
1
+ module FailbotRails
2
+ VERSION = "0.7.0"
3
+ end
data/script/cibuild ADDED
@@ -0,0 +1,8 @@
1
+ #!/bin/bash
2
+
3
+ set -e
4
+ set -x
5
+
6
+ img=failbotd:$(git rev-parse HEAD)
7
+ docker build -f Dockerfile . -t $img
8
+ docker run --rm -i $img
@@ -0,0 +1,8 @@
1
+ #!/bin/sh
2
+ set -e
3
+
4
+ export PATH=/usr/share/rbenv/shims:$PATH
5
+
6
+ bundle --path vendor/gems --binstubs vendor/gems
7
+
8
+ bundle exec rake
metadata CHANGED
@@ -1,64 +1,103 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: failbot_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
5
- prerelease:
4
+ version: 0.7.0
6
5
  platform: ruby
7
6
  authors:
8
- - ! '@sr'
9
- autorequire:
7
+ - sr
8
+ - Grant Rodgers
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-08-15 00:00:00.000000000 Z
12
+ date: 2021-04-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: failbot
16
16
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
17
  requirements:
19
- - - ~>
18
+ - - ">="
20
19
  - !ruby/object:Gem::Version
21
- version: 0.9.1
20
+ version: 0.9.2
21
+ - - "<"
22
+ - !ruby/object:Gem::Version
23
+ version: '3'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: !ruby/object:Gem::Requirement
27
+ requirements:
28
+ - - ">="
29
+ - !ruby/object:Gem::Version
30
+ version: 0.9.2
31
+ - - "<"
32
+ - !ruby/object:Gem::Version
33
+ version: '3'
34
+ - !ruby/object:Gem::Dependency
35
+ name: rails
36
+ requirement: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '6.0'
22
41
  type: :runtime
23
42
  prerelease: false
24
43
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
44
  requirements:
27
- - - ~>
45
+ - - "~>"
28
46
  - !ruby/object:Gem::Version
29
- version: 0.9.1
47
+ version: '6.0'
48
+ - !ruby/object:Gem::Dependency
49
+ name: rake
50
+ requirement: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '10.0'
55
+ type: :development
56
+ prerelease: false
57
+ version_requirements: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '10.0'
30
62
  description: Glue code for using Failbot in a Rails app
31
63
  email:
32
- - sr@github.com
64
+ - grant.rodgers@github.com
33
65
  executables: []
34
66
  extensions: []
35
67
  extra_rdoc_files: []
36
68
  files:
69
+ - ".gitignore"
70
+ - Dockerfile
71
+ - Gemfile
72
+ - LICENSE.txt
37
73
  - README.md
74
+ - Rakefile
38
75
  - failbot_rails.gemspec
39
76
  - lib/failbot_rails.rb
40
- homepage: https://github.com/github/failbot_rails#readme
41
- licenses: []
42
- post_install_message:
77
+ - lib/failbot_rails/version.rb
78
+ - script/cibuild
79
+ - script/cibuild.docker
80
+ homepage: https://github.com/github/failbot_rails
81
+ licenses:
82
+ - MIT
83
+ metadata: {}
84
+ post_install_message:
43
85
  rdoc_options: []
44
86
  require_paths:
45
87
  - lib
46
88
  required_ruby_version: !ruby/object:Gem::Requirement
47
- none: false
48
89
  requirements:
49
- - - ! '>='
90
+ - - ">="
50
91
  - !ruby/object:Gem::Version
51
- version: '0'
92
+ version: 2.5.0
52
93
  required_rubygems_version: !ruby/object:Gem::Requirement
53
- none: false
54
94
  requirements:
55
- - - ! '>='
95
+ - - ">="
56
96
  - !ruby/object:Gem::Version
57
- version: 1.3.6
97
+ version: '0'
58
98
  requirements: []
59
- rubyforge_project:
60
- rubygems_version: 1.8.23
61
- signing_key:
62
- specification_version: 3
99
+ rubygems_version: 3.1.4
100
+ signing_key:
101
+ specification_version: 4
63
102
  summary: Glue code for using Failbot in a Rails app
64
103
  test_files: []