Skip to content

Commit 745ad0f

Browse files
committed
Add request-id, controller#action, remote-ip to exception headers.
Upgrade to support Rails 5.2
1 parent 7fea48a commit 745ad0f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+441
-253
lines changed

.rubocop.yml

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
inherit_gem:
2+
rubocop-rails:
3+
- config/rails.yml
4+
5+
AllCops:
6+
TargetRubyVersion: 2.3.4
7+
8+
Style/BlockDelimiters:
9+
Enabled: true

Gemfile

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
source 'https://rubygems.org'
1+
# frozen_string_literal: true
2+
3+
source "https://rubygems.org"
24

35
gemspec
46

5-
gem 'simplecov'
6-
gem 'codecov'
7+
group :test do
8+
gem "simplecov"
9+
gem "codecov"
10+
end

Gemfile.lock

+102-93
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,149 @@
11
PATH
22
remote: .
33
specs:
4-
exception-track (0.2.0)
4+
exception-track (0.3.0)
55
exception_notification (~> 4)
66
kaminari (>= 0.15)
7-
rails (>= 4.0, < 5.2)
7+
rails (>= 4.0, < 6)
88

99
GEM
1010
remote: https://rubygems.org/
1111
specs:
12-
actioncable (5.0.1)
13-
actionpack (= 5.0.1)
14-
nio4r (~> 1.2)
15-
websocket-driver (~> 0.6.1)
16-
actionmailer (5.0.1)
17-
actionpack (= 5.0.1)
18-
actionview (= 5.0.1)
19-
activejob (= 5.0.1)
12+
actioncable (5.2.0)
13+
actionpack (= 5.2.0)
14+
nio4r (~> 2.0)
15+
websocket-driver (>= 0.6.1)
16+
actionmailer (5.2.0)
17+
actionpack (= 5.2.0)
18+
actionview (= 5.2.0)
19+
activejob (= 5.2.0)
2020
mail (~> 2.5, >= 2.5.4)
2121
rails-dom-testing (~> 2.0)
22-
actionpack (5.0.1)
23-
actionview (= 5.0.1)
24-
activesupport (= 5.0.1)
22+
actionpack (5.2.0)
23+
actionview (= 5.2.0)
24+
activesupport (= 5.2.0)
2525
rack (~> 2.0)
26-
rack-test (~> 0.6.3)
26+
rack-test (>= 0.6.3)
2727
rails-dom-testing (~> 2.0)
2828
rails-html-sanitizer (~> 1.0, >= 1.0.2)
29-
actionview (5.0.1)
30-
activesupport (= 5.0.1)
29+
actionview (5.2.0)
30+
activesupport (= 5.2.0)
3131
builder (~> 3.1)
32-
erubis (~> 2.7.0)
32+
erubi (~> 1.4)
3333
rails-dom-testing (~> 2.0)
34-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
35-
activejob (5.0.1)
36-
activesupport (= 5.0.1)
34+
rails-html-sanitizer (~> 1.0, >= 1.0.3)
35+
activejob (5.2.0)
36+
activesupport (= 5.2.0)
3737
globalid (>= 0.3.6)
38-
activemodel (5.0.1)
39-
activesupport (= 5.0.1)
40-
activerecord (5.0.1)
41-
activemodel (= 5.0.1)
42-
activesupport (= 5.0.1)
43-
arel (~> 7.0)
44-
activesupport (5.0.1)
38+
activemodel (5.2.0)
39+
activesupport (= 5.2.0)
40+
activerecord (5.2.0)
41+
activemodel (= 5.2.0)
42+
activesupport (= 5.2.0)
43+
arel (>= 9.0)
44+
activestorage (5.2.0)
45+
actionpack (= 5.2.0)
46+
activerecord (= 5.2.0)
47+
marcel (~> 0.3.1)
48+
activesupport (5.2.0)
4549
concurrent-ruby (~> 1.0, >= 1.0.2)
46-
i18n (~> 0.7)
50+
i18n (>= 0.7, < 2)
4751
minitest (~> 5.1)
4852
tzinfo (~> 1.1)
49-
arel (7.1.4)
53+
arel (9.0.0)
5054
builder (3.2.3)
51-
codecov (0.1.9)
55+
codecov (0.1.10)
5256
json
5357
simplecov
5458
url
55-
concurrent-ruby (1.0.4)
56-
docile (1.1.5)
57-
erubis (2.7.0)
58-
exception_notification (4.2.1)
59+
concurrent-ruby (1.0.5)
60+
crass (1.0.4)
61+
docile (1.3.0)
62+
erubi (1.7.1)
63+
exception_notification (4.2.2)
5964
actionmailer (>= 4.0, < 6)
6065
activesupport (>= 4.0, < 6)
61-
globalid (0.3.7)
62-
activesupport (>= 4.1.0)
63-
i18n (0.8.0)
64-
json (2.0.3)
65-
kaminari (1.0.1)
66+
globalid (0.4.1)
67+
activesupport (>= 4.2.0)
68+
i18n (1.0.0)
69+
concurrent-ruby (~> 1.0)
70+
json (2.1.0)
71+
kaminari (1.1.1)
6672
activesupport (>= 4.1.0)
67-
kaminari-actionview (= 1.0.1)
68-
kaminari-activerecord (= 1.0.1)
69-
kaminari-core (= 1.0.1)
70-
kaminari-actionview (1.0.1)
73+
kaminari-actionview (= 1.1.1)
74+
kaminari-activerecord (= 1.1.1)
75+
kaminari-core (= 1.1.1)
76+
kaminari-actionview (1.1.1)
7177
actionview
72-
kaminari-core (= 1.0.1)
73-
kaminari-activerecord (1.0.1)
78+
kaminari-core (= 1.1.1)
79+
kaminari-activerecord (1.1.1)
7480
activerecord
75-
kaminari-core (= 1.0.1)
76-
kaminari-core (1.0.1)
77-
loofah (2.0.3)
81+
kaminari-core (= 1.1.1)
82+
kaminari-core (1.1.1)
83+
loofah (2.2.2)
84+
crass (~> 1.0.2)
7885
nokogiri (>= 1.5.9)
79-
mail (2.6.4)
80-
mime-types (>= 1.16, < 4)
81-
method_source (0.8.2)
82-
mime-types (3.1)
83-
mime-types-data (~> 3.2015)
84-
mime-types-data (3.2016.0521)
85-
mini_portile2 (2.1.0)
86-
minitest (5.10.1)
87-
mysql2 (0.4.5)
88-
nio4r (1.2.1)
89-
nokogiri (1.7.0.1)
90-
mini_portile2 (~> 2.1.0)
91-
rack (2.0.1)
92-
rack-test (0.6.3)
93-
rack (>= 1.0)
94-
rails (5.0.1)
95-
actioncable (= 5.0.1)
96-
actionmailer (= 5.0.1)
97-
actionpack (= 5.0.1)
98-
actionview (= 5.0.1)
99-
activejob (= 5.0.1)
100-
activemodel (= 5.0.1)
101-
activerecord (= 5.0.1)
102-
activesupport (= 5.0.1)
103-
bundler (>= 1.3.0, < 2.0)
104-
railties (= 5.0.1)
86+
mail (2.7.0)
87+
mini_mime (>= 0.1.1)
88+
marcel (0.3.2)
89+
mimemagic (~> 0.3.2)
90+
method_source (0.9.0)
91+
mimemagic (0.3.2)
92+
mini_mime (1.0.0)
93+
mini_portile2 (2.3.0)
94+
minitest (5.11.3)
95+
mysql2 (0.5.0)
96+
nio4r (2.3.0)
97+
nokogiri (1.8.2)
98+
mini_portile2 (~> 2.3.0)
99+
rack (2.0.4)
100+
rack-test (1.0.0)
101+
rack (>= 1.0, < 3)
102+
rails (5.2.0)
103+
actioncable (= 5.2.0)
104+
actionmailer (= 5.2.0)
105+
actionpack (= 5.2.0)
106+
actionview (= 5.2.0)
107+
activejob (= 5.2.0)
108+
activemodel (= 5.2.0)
109+
activerecord (= 5.2.0)
110+
activestorage (= 5.2.0)
111+
activesupport (= 5.2.0)
112+
bundler (>= 1.3.0)
113+
railties (= 5.2.0)
105114
sprockets-rails (>= 2.0.0)
106-
rails-dom-testing (2.0.2)
107-
activesupport (>= 4.2.0, < 6.0)
108-
nokogiri (~> 1.6)
109-
rails-html-sanitizer (1.0.3)
110-
loofah (~> 2.0)
111-
railties (5.0.1)
112-
actionpack (= 5.0.1)
113-
activesupport (= 5.0.1)
115+
rails-dom-testing (2.0.3)
116+
activesupport (>= 4.2.0)
117+
nokogiri (>= 1.6)
118+
rails-html-sanitizer (1.0.4)
119+
loofah (~> 2.2, >= 2.2.2)
120+
railties (5.2.0)
121+
actionpack (= 5.2.0)
122+
activesupport (= 5.2.0)
114123
method_source
115124
rake (>= 0.8.7)
116125
thor (>= 0.18.1, < 2.0)
117-
rake (12.0.0)
118-
simplecov (0.13.0)
119-
docile (~> 1.1.0)
126+
rake (12.3.1)
127+
simplecov (0.16.1)
128+
docile (~> 1.1)
120129
json (>= 1.8, < 3)
121130
simplecov-html (~> 0.10.0)
122-
simplecov-html (0.10.0)
131+
simplecov-html (0.10.2)
123132
sprockets (3.7.1)
124133
concurrent-ruby (~> 1.0)
125134
rack (> 1, < 3)
126-
sprockets-rails (3.2.0)
135+
sprockets-rails (3.2.1)
127136
actionpack (>= 4.0)
128137
activesupport (>= 4.0)
129138
sprockets (>= 3.0.0)
130-
thor (0.19.4)
131-
thread_safe (0.3.5)
132-
tzinfo (1.2.2)
139+
thor (0.20.0)
140+
thread_safe (0.3.6)
141+
tzinfo (1.2.5)
133142
thread_safe (~> 0.1)
134143
url (0.3.2)
135-
websocket-driver (0.6.5)
144+
websocket-driver (0.7.0)
136145
websocket-extensions (>= 0.1.0)
137-
websocket-extensions (0.1.2)
146+
websocket-extensions (0.1.3)
138147

139148
PLATFORMS
140149
ruby
@@ -146,4 +155,4 @@ DEPENDENCIES
146155
simplecov
147156

148157
BUNDLED WITH
149-
1.13.7
158+
1.16.1

Rakefile

+18-20
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,35 @@
1+
# frozen_string_literal: true
2+
13
begin
2-
require 'bundler/setup'
4+
require "bundler/setup"
35
rescue LoadError
4-
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
6+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
57
end
68

7-
require 'rdoc/task'
9+
require "rdoc/task"
810

911
RDoc::Task.new(:rdoc) do |rdoc|
10-
rdoc.rdoc_dir = 'rdoc'
11-
rdoc.title = 'ExceptionTrack'
12-
rdoc.options << '--line-numbers'
13-
rdoc.rdoc_files.include('README.md')
14-
rdoc.rdoc_files.include('lib/**/*.rb')
12+
rdoc.rdoc_dir = "rdoc"
13+
rdoc.title = "ExceptionTrack"
14+
rdoc.options << "--line-numbers"
15+
rdoc.rdoc_files.include("README.md")
16+
rdoc.rdoc_files.include("lib/**/*.rb")
1517
end
1618

17-
APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18-
load 'rails/tasks/engine.rake'
19-
20-
21-
load 'rails/tasks/statistics.rake'
19+
APP_RAKEFILE = File.expand_path("test/dummy/Rakefile", __dir__)
20+
load "rails/tasks/engine.rake"
2221

22+
load "rails/tasks/statistics.rake"
2323

24+
require "bundler/gem_tasks"
2425

25-
require 'bundler/gem_tasks'
26-
27-
require 'rake/testtask'
26+
require "rake/testtask"
2827

2928
Rake::TestTask.new(:test) do |t|
30-
t.libs << 'lib'
31-
t.libs << 'test'
32-
t.pattern = 'test/**/*_test.rb'
29+
t.libs << "lib"
30+
t.libs << "test"
31+
t.pattern = "test/**/*_test.rb"
3332
t.verbose = false
3433
end
3534

36-
3735
task default: :test

app/controllers/exception_track/logs_controller.rb

+8-6
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1+
# frozen_string_literal: true
2+
13
module ExceptionTrack
24
class LogsController < ActionController::Base
3-
layout 'exception-track/application'
4-
before_action :set_log, only: [:show, :destroy]
5+
layout "exception-track/application"
6+
before_action :set_log, only: %i[show destroy]
57

68
# GET /exception_logs
79
def index
8-
@logs = Log.order('id desc').page(params[:page]).per(15)
10+
@logs = Log.order("id desc").page(params[:page]).per(15)
911
end
1012

1113
# GET /exception_logs/1
12-
def show
13-
end
14+
def show; end
1415

1516
# DELETE /exception_logs/all
1617
def all
1718
Log.delete_all
18-
redirect_to logs_url, notice: 'Logs was successfully destroyed.'
19+
redirect_to logs_url, notice: "Logs was successfully destroyed."
1920
end
2021

2122
private
23+
2224
# Use callbacks to share common setup or constraints between actions.
2325
def set_log
2426
@log = Log.find(params[:id])

app/models/exception_track/log.rb

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
1+
# frozen_string_literal: true
2+
13
module ExceptionTrack
24
class Log < ActiveRecord::Base
3-
self.table_name = 'exception_tracks'
5+
self.table_name = "exception_tracks"
46
end
57
end

app/views/layouts/exception-track/application.html.erb

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<title>Exception track</title>
5-
<%= stylesheet_link_tag "exception-track/application", media: "all" %>
4+
<title>Exception Track</title>
5+
<%= stylesheet_link_tag "exception-track/application", media: "all" %>
66
<%= csrf_meta_tags %>
77
</head>
88
<body>

0 commit comments

Comments
 (0)