rails_mini_profiler 0.1.2 → 0.3.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 +4 -4
- data/README.md +19 -10
- data/app/assets/javascripts/rails_mini_profiler.js +1 -78
- data/app/assets/stylesheets/rails_mini_profiler/application.css +1 -171
- data/app/controllers/rails_mini_profiler/profiled_requests_controller.rb +10 -1
- data/app/helpers/rails_mini_profiler/application_helper.rb +9 -0
- data/app/{assets/images/rails_mini_profiler → javascript/images}/bookmark.svg +0 -0
- data/app/{assets/images/rails_mini_profiler → javascript/images}/chart.svg +0 -0
- data/app/{assets/images/rails_mini_profiler → javascript/images}/delete.svg +0 -0
- data/app/{assets/images/rails_mini_profiler → javascript/images}/graph.svg +0 -0
- data/app/{assets/images/rails_mini_profiler → javascript/images}/logo.svg +0 -0
- data/app/{assets/images/rails_mini_profiler → javascript/images}/logo_variant.svg +0 -0
- data/app/{assets/images/rails_mini_profiler → javascript/images}/search.svg +0 -0
- data/app/{assets/images/rails_mini_profiler → javascript/images}/setting.svg +0 -0
- data/app/{assets/images/rails_mini_profiler → javascript/images}/show.svg +0 -0
- data/app/javascript/packs/rails-mini-profiler.js +80 -0
- data/app/javascript/stylesheets/flamegraph.scss +9 -0
- data/app/{assets/stylesheets/rails_mini_profiler/flashes.css → javascript/stylesheets/flashes.scss} +0 -0
- data/app/{assets/stylesheets/rails_mini_profiler/navbar.css → javascript/stylesheets/navbar.scss} +2 -2
- data/app/{assets/stylesheets/rails_mini_profiler/profiled_requests.css → javascript/stylesheets/profiled_requests.scss} +1 -7
- data/app/javascript/stylesheets/rails-mini-profiler.scss +175 -0
- data/app/{assets/stylesheets/rails_mini_profiler/traces.css → javascript/stylesheets/traces.scss} +0 -5
- data/app/models/rails_mini_profiler/application_record.rb +1 -1
- data/app/presenters/rails_mini_profiler/profiled_request_presenter.rb +2 -2
- data/app/views/layouts/rails_mini_profiler/application.html.erb +1 -8
- data/app/views/layouts/rails_mini_profiler/flamegraph.html.erb +1 -8
- data/app/views/rails_mini_profiler/badge.html.erb +1 -1
- data/app/views/rails_mini_profiler/profiled_requests/index.html.erb +3 -3
- data/app/views/rails_mini_profiler/shared/_head.erb +13 -0
- data/app/views/rails_mini_profiler/shared/_navbar.html.erb +1 -1
- data/lib/generators/rails_mini_profiler/install_generator.rb +18 -0
- data/lib/generators/rails_mini_profiler/templates/rails_mini_profiler.js.erb +13 -0
- data/lib/generators/rails_mini_profiler/templates/rails_mini_profiler.rb.erb +18 -7
- data/lib/rails_mini_profiler.rb +29 -3
- data/lib/rails_mini_profiler/badge.rb +21 -1
- data/lib/rails_mini_profiler/configuration.rb +24 -0
- data/lib/rails_mini_profiler/engine.rb +8 -1
- data/lib/rails_mini_profiler/guard.rb +18 -7
- data/lib/rails_mini_profiler/logger.rb +5 -0
- data/lib/rails_mini_profiler/models/base_model.rb +5 -0
- data/lib/rails_mini_profiler/models/trace.rb +28 -0
- data/lib/rails_mini_profiler/redirect.rb +8 -0
- data/lib/rails_mini_profiler/request_context.rb +24 -5
- data/lib/rails_mini_profiler/storage.rb +18 -0
- data/lib/rails_mini_profiler/tracers.rb +1 -1
- data/lib/rails_mini_profiler/version.rb +4 -1
- data/vendor/assets/images/bookmark.svg +10 -0
- data/vendor/assets/images/chart.svg +12 -0
- data/vendor/assets/images/delete.svg +9 -0
- data/vendor/assets/images/graph.svg +11 -0
- data/vendor/assets/images/logo.svg +18 -0
- data/vendor/assets/images/logo_variant.svg +32 -0
- data/vendor/assets/images/search.svg +10 -0
- data/vendor/assets/images/setting.svg +10 -0
- data/vendor/assets/images/show.svg +11 -0
- data/vendor/assets/javascripts/rails-mini-profiler.css +1 -0
- data/vendor/assets/javascripts/rails-mini-profiler.js +1 -0
- metadata +31 -21
- data/app/assets/fonts/rails_mini_profiler/LICENSE.txt +0 -202
- data/app/assets/fonts/rails_mini_profiler/OpenSans-Bold.ttf +0 -0
- data/app/assets/fonts/rails_mini_profiler/OpenSans-Regular.ttf +0 -0
- data/app/assets/fonts/rails_mini_profiler/OpenSans-SemiBold.ttf +0 -0
- data/app/assets/stylesheets/rails_mini_profiler/flamegraph.css +0 -14
- data/lib/rails_mini_profiler/errors.rb +0 -8
data/app/{assets/stylesheets/rails_mini_profiler/flashes.css → javascript/stylesheets/flashes.scss}
RENAMED
File without changes
|
data/app/{assets/stylesheets/rails_mini_profiler/navbar.css → javascript/stylesheets/navbar.scss}
RENAMED
@@ -5,13 +5,13 @@
|
|
5
5
|
display: flex;
|
6
6
|
justify-content: center;
|
7
7
|
|
8
|
-
box-shadow: 0 0 20px 0 rgba(0,0,0
|
8
|
+
box-shadow: 0 0 20px 0 rgba(0, 0, 0, .2);
|
9
9
|
|
10
10
|
background: var(--primary);
|
11
11
|
}
|
12
12
|
|
13
13
|
.header a {
|
14
|
-
color:white;
|
14
|
+
color: white;
|
15
15
|
text-decoration: none;
|
16
16
|
}
|
17
17
|
|
@@ -1,9 +1,3 @@
|
|
1
|
-
/*
|
2
|
-
Place all the styles related to the matching controller here.
|
3
|
-
They will automatically be included in application.css.
|
4
|
-
*/
|
5
|
-
|
6
|
-
|
7
1
|
main {
|
8
2
|
width: 100%;
|
9
3
|
|
@@ -133,7 +127,7 @@ main {
|
|
133
127
|
.data-item {
|
134
128
|
display: flex;
|
135
129
|
flex-direction: column;
|
136
|
-
align-items: start;
|
130
|
+
align-items: flex-start;
|
137
131
|
list-style: none;
|
138
132
|
|
139
133
|
margin-right: 3rem;
|
@@ -0,0 +1,175 @@
|
|
1
|
+
@import 'flashes';
|
2
|
+
@import 'flamegraph';
|
3
|
+
@import 'navbar';
|
4
|
+
@import 'profiled_requests';
|
5
|
+
@import 'traces';
|
6
|
+
|
7
|
+
@import url('https://fonts.googleapis.com/css2?family=Open+Sans:wght@400;600;700&display=swap');
|
8
|
+
|
9
|
+
@font-face {
|
10
|
+
font-family: 'Open Sans';
|
11
|
+
font-weight: 400;
|
12
|
+
font-style: normal;
|
13
|
+
}
|
14
|
+
|
15
|
+
@font-face {
|
16
|
+
font-family: 'Open Sans';
|
17
|
+
font-weight: 600;
|
18
|
+
font-style: normal;
|
19
|
+
}
|
20
|
+
|
21
|
+
@font-face {
|
22
|
+
font-family: 'Open Sans';
|
23
|
+
font-weight: 700;
|
24
|
+
font-style: normal;
|
25
|
+
}
|
26
|
+
|
27
|
+
html {
|
28
|
+
width: 100%;
|
29
|
+
height: 100%;
|
30
|
+
margin: 0;
|
31
|
+
padding: 0;
|
32
|
+
|
33
|
+
--grey-50: #F9FAFB;
|
34
|
+
--grey-100: #F3F4F6;
|
35
|
+
--grey-200: #E5E7EB;
|
36
|
+
--grey-400: #9CA3AF;
|
37
|
+
--grey-500: #6B7280;
|
38
|
+
--grey-700: #374151;
|
39
|
+
--grey-900: #111827;
|
40
|
+
|
41
|
+
--red-400: #F87171;
|
42
|
+
--red-500: #EF4444;
|
43
|
+
--red-600: #DC2626;
|
44
|
+
|
45
|
+
--yellow-400: #FBBF24;
|
46
|
+
--yellow-500: #F59E0B;
|
47
|
+
|
48
|
+
--green-300: #6EE7B7;
|
49
|
+
--green-400: #34D399;
|
50
|
+
--green-500: #10B981;
|
51
|
+
|
52
|
+
--blue-400: #60A5FA;
|
53
|
+
--blue-500: #3B82F6;
|
54
|
+
|
55
|
+
--main-width: 1056px;
|
56
|
+
|
57
|
+
--primary: var(--red-600);
|
58
|
+
|
59
|
+
--border-color: var(--grey-200);
|
60
|
+
--text-color: var(--grey-900);
|
61
|
+
|
62
|
+
font-family: 'Open Sans', monospace;
|
63
|
+
|
64
|
+
}
|
65
|
+
|
66
|
+
body {
|
67
|
+
width: 100%;
|
68
|
+
height: 100%;
|
69
|
+
margin: 0;
|
70
|
+
padding: 0;
|
71
|
+
|
72
|
+
color: var(--text-color)
|
73
|
+
}
|
74
|
+
|
75
|
+
h1 {
|
76
|
+
padding: 2rem 0 1rem;
|
77
|
+
}
|
78
|
+
|
79
|
+
button {
|
80
|
+
border: none;
|
81
|
+
border-radius: .25rem;
|
82
|
+
padding: 0.5em .5em;
|
83
|
+
text-align: center;
|
84
|
+
text-decoration: none;
|
85
|
+
display: inline-block;
|
86
|
+
font-size: 1rem;
|
87
|
+
cursor: pointer;
|
88
|
+
}
|
89
|
+
|
90
|
+
button:hover {
|
91
|
+
box-shadow: 0 .25rem .25rem 0 var(--grey-50);
|
92
|
+
}
|
93
|
+
|
94
|
+
/* --------------------------------------- */
|
95
|
+
|
96
|
+
.text-left {
|
97
|
+
text-align: left;
|
98
|
+
}
|
99
|
+
|
100
|
+
.text-right {
|
101
|
+
text-align: right;
|
102
|
+
}
|
103
|
+
|
104
|
+
/* --------------------------------------- */
|
105
|
+
|
106
|
+
.pill {
|
107
|
+
margin: .2rem 0;
|
108
|
+
padding: .1rem .4rem;
|
109
|
+
border-radius: 5px;
|
110
|
+
|
111
|
+
font-size: .9rem;
|
112
|
+
font-weight: 600;
|
113
|
+
letter-spacing: .1rem;
|
114
|
+
|
115
|
+
background: var(--grey-200);
|
116
|
+
}
|
117
|
+
|
118
|
+
/* --------------------------------------- */
|
119
|
+
|
120
|
+
.popover {
|
121
|
+
display: flex;
|
122
|
+
flex-direction: column;
|
123
|
+
width: 600px;
|
124
|
+
padding: 1em;
|
125
|
+
color: black;
|
126
|
+
}
|
127
|
+
|
128
|
+
.popover-header {
|
129
|
+
display: flex;
|
130
|
+
padding-bottom: 1em;
|
131
|
+
flex-direction: row;
|
132
|
+
justify-content: space-between;
|
133
|
+
align-items: center;
|
134
|
+
}
|
135
|
+
|
136
|
+
.popover-description {
|
137
|
+
margin: 0;
|
138
|
+
padding: 0;
|
139
|
+
}
|
140
|
+
|
141
|
+
.popover-close {
|
142
|
+
background: transparent;
|
143
|
+
padding: 0;
|
144
|
+
font-weight: 700;
|
145
|
+
font-size: 20px;
|
146
|
+
color: var(--grey-400);
|
147
|
+
}
|
148
|
+
|
149
|
+
.popover-body {
|
150
|
+
padding: 1em 0;
|
151
|
+
}
|
152
|
+
|
153
|
+
.popover-footer {
|
154
|
+
border-top: 1px solid var(--grey-50);
|
155
|
+
}
|
156
|
+
|
157
|
+
.tippy-box[data-theme~='rmp'] {
|
158
|
+
background: white;
|
159
|
+
box-shadow: 8px 0 30px 4px rgba(0, 0, 0, .2), 8px 4px 10px 0 rgba(0, 0, 0, .05);
|
160
|
+
border-radius: 3px;
|
161
|
+
|
162
|
+
transition: all cubic-bezier(.19,1,.22,1) .2s;
|
163
|
+
}
|
164
|
+
.tippy-box[data-theme~='rmp'][data-placement^='top'] > .tippy-arrow::before {
|
165
|
+
border-top-color: white;
|
166
|
+
}
|
167
|
+
.tippy-box[data-theme~='rmp'][data-placement^='bottom'] > .tippy-arrow::before {
|
168
|
+
border-bottom-color: white;
|
169
|
+
}
|
170
|
+
.tippy-box[data-theme~='rmp'][data-placement^='left'] > .tippy-arrow::before {
|
171
|
+
border-left-color: white;
|
172
|
+
}
|
173
|
+
.tippy-box[data-theme~='rmp'][data-placement^='right'] > .tippy-arrow::before {
|
174
|
+
border-right-color: white;
|
175
|
+
}
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module RailsMiniProfiler
|
4
4
|
class ApplicationRecord < ActiveRecord::Base
|
5
5
|
if RailsMiniProfiler.storage_configuration.database.present?
|
6
|
-
establish_connection(RailsMiniProfiler.storage_configuration.database
|
6
|
+
establish_connection(RailsMiniProfiler.storage_configuration.database)
|
7
7
|
end
|
8
8
|
|
9
9
|
self.abstract_class = true
|
@@ -23,11 +23,11 @@ module RailsMiniProfiler
|
|
23
23
|
|
24
24
|
if model.flamegraph.present?
|
25
25
|
link_to(flamegraph_path(model.id), title: 'Show Flamegraph') do
|
26
|
-
|
26
|
+
inline_svg('graph.svg')
|
27
27
|
end
|
28
28
|
else
|
29
29
|
link_to(flamegraph_path(model.id), title: 'No Flamegraph present for this request', class: 'link-disabled') do
|
30
|
-
|
30
|
+
inline_svg('graph.svg')
|
31
31
|
end
|
32
32
|
end
|
33
33
|
end
|
@@ -1,13 +1,6 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
|
4
|
-
<title>Rails Mini Profiler</title>
|
5
|
-
<%= csrf_meta_tags %>
|
6
|
-
<%= csp_meta_tag %>
|
7
|
-
|
8
|
-
<%= javascript_include_tag "rails_mini_profiler" %>
|
9
|
-
<%= stylesheet_link_tag "rails_mini_profiler/application", media: "all" %>
|
10
|
-
</head>
|
3
|
+
<%= render 'rails_mini_profiler/shared/head' %>
|
11
4
|
<body>
|
12
5
|
|
13
6
|
<%= render 'rails_mini_profiler/shared/navbar' %>
|
@@ -1,13 +1,6 @@
|
|
1
1
|
<!DOCTYPE html>
|
2
2
|
<html>
|
3
|
-
|
4
|
-
<title>Rails Mini Profiler</title>
|
5
|
-
<%= csrf_meta_tags %>
|
6
|
-
<%= csp_meta_tag %>
|
7
|
-
|
8
|
-
<%= javascript_include_tag "rails_mini_profiler" %>
|
9
|
-
<%= stylesheet_link_tag "rails_mini_profiler/application", media: "all" %>
|
10
|
-
</head>
|
3
|
+
<%= render 'rails_mini_profiler/shared/head' %>
|
11
4
|
<body>
|
12
5
|
|
13
6
|
<main>
|
@@ -32,6 +32,6 @@
|
|
32
32
|
}
|
33
33
|
</style>
|
34
34
|
<a id="rails-mini-profiler-badge" href="<%= profiled_request_path(@profiled_request.id) %>" data-turbolinks="false" title="View performance data">
|
35
|
-
<%=
|
35
|
+
<%= inline_svg('logo_variant.svg', id: "rails-mini-profiler-badge-icon") %>
|
36
36
|
<%= (@profiled_request.duration.to_f / 100).round %>ms
|
37
37
|
</a>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<% if @profiled_requests.empty? %>
|
2
2
|
<section class="placeholder">
|
3
|
-
<%=
|
3
|
+
<%= inline_svg('logo_variant.svg', class: 'placeholder-image') %>
|
4
4
|
<div class="placeholder-text">
|
5
5
|
<h2> There is nothing here yet! </h2>
|
6
6
|
<p>Send some requests to your app for them to show up here</p>
|
@@ -43,11 +43,11 @@
|
|
43
43
|
<td class=""><%= profiled_request.created_at %></td>
|
44
44
|
<td class="request-buttons">
|
45
45
|
<%= link_to(profiled_request_path(profiled_request.id), title: 'Show Details') do %>
|
46
|
-
<%=
|
46
|
+
<%= inline_svg('show.svg', options = {}) %>
|
47
47
|
<% end %>
|
48
48
|
<%= profiled_request.flamegraph_icon %>
|
49
49
|
<%= link_to(profiled_request_path(profiled_request.id), title: 'Delete Request', method: :delete) do %>
|
50
|
-
<%=
|
50
|
+
<%= inline_svg('delete.svg') %>
|
51
51
|
<% end %>
|
52
52
|
</td>
|
53
53
|
</tr>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<head>
|
2
|
+
<title>Rails Mini Profiler</title>
|
3
|
+
<%= csrf_meta_tags %>
|
4
|
+
<%= csp_meta_tag %>
|
5
|
+
|
6
|
+
<% if defined?(Webpacker::Engine) %>
|
7
|
+
<%= javascript_pack_tag "rails-mini-profiler" %>
|
8
|
+
<%= stylesheet_pack_tag 'rails-mini-profiler' %>
|
9
|
+
<% else %>
|
10
|
+
<%= javascript_include_tag "rails_mini_profiler" %>
|
11
|
+
<%= stylesheet_link_tag "rails_mini_profiler/application", media: "all" %>
|
12
|
+
<%end %>
|
13
|
+
</head>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
<header class="header">
|
2
2
|
<nav class="nav">
|
3
3
|
<a class="home" href="<%= profiled_requests_path %>">
|
4
|
-
<%=
|
4
|
+
<%= inline_svg('logo.svg', class: 'home-logo') %>
|
5
5
|
<h1 class="home-title">Rails Mini Profiler </h1>
|
6
6
|
</a>
|
7
7
|
<ul class="header-links">
|
@@ -1,15 +1,33 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module RailsMiniProfiler
|
4
|
+
# Generators for Rails Mini Profiler
|
4
5
|
module Generators
|
6
|
+
# A basic installation generator to help set up users apps
|
5
7
|
class InstallGenerator < Rails::Generators::Base
|
6
8
|
source_root File.expand_path('templates', __dir__)
|
7
9
|
|
10
|
+
# Install Rails Mini Profiler to your Rails app
|
11
|
+
#
|
12
|
+
# Updates the routes file to mount the engine, adds an initializer and copies a migration.
|
8
13
|
desc 'Install rails-mini-profiler'
|
14
|
+
|
9
15
|
def install
|
10
16
|
route("mount RailsMiniProfiler::Engine => '/rails_mini_profiler'")
|
11
17
|
template 'rails_mini_profiler.rb.erb', 'config/initializers/rails_mini_profiler.rb'
|
12
18
|
system('rails rails_mini_profiler:install:migrations')
|
19
|
+
webpacker_install if defined?(Webpacker::Engine)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
|
24
|
+
def webpacker_install
|
25
|
+
run 'yarn add @rails-mini-profiler/assets'
|
26
|
+
webpack_config = YAML.load_file(Rails.root.join('config', 'webpacker.yml'))[Rails.env]
|
27
|
+
destination = Rails.root.join(webpack_config['source_path'],
|
28
|
+
webpack_config['source_entry_path'],
|
29
|
+
'rails-mini-profiler.js')
|
30
|
+
template('rails_mini_profiler.js.erb', destination)
|
13
31
|
end
|
14
32
|
end
|
15
33
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import "@rails-mini-profiler/assets"
|
2
|
+
|
3
|
+
// Import styles
|
4
|
+
import "@rails-mini-profiler/assets/dist/rails-mini-profiler.css";
|
5
|
+
|
6
|
+
// Import images
|
7
|
+
//
|
8
|
+
// You may simplify this when using a glob loader (e.g glob-import-loader)
|
9
|
+
<%- Dir.chdir(RailsMiniProfiler::Engine.root.join('app/javascript/images')) do -%>
|
10
|
+
<%- Dir.glob('**/*').each do |file| -%>
|
11
|
+
import "@rails-mini-profiler/assets/dist/images/<%= file %>";
|
12
|
+
<%- end -%>
|
13
|
+
<%- end -%>
|
@@ -1,13 +1,24 @@
|
|
1
1
|
RailsMiniProfiler.configure do |config|
|
2
2
|
# Customize when Rails Mini Profiler should run
|
3
|
-
|
3
|
+
config.enabled = proc { |env| Rails.env.development? || env['HTTP_RMP_ENABLED'].present? }
|
4
4
|
|
5
|
-
#
|
6
|
-
|
5
|
+
# Configure how hedgehog badge is rendered
|
6
|
+
config.badge_enabled = true
|
7
|
+
# config.badge_position = 'top-left'
|
7
8
|
|
8
|
-
#
|
9
|
-
config.
|
9
|
+
# Configure Flamegraph generation
|
10
|
+
config.flamegraph_enabled = true
|
11
|
+
# config.flamegraph_sample_rate = 0.5
|
10
12
|
|
11
|
-
#
|
12
|
-
|
13
|
+
# Configure endpoints to profile
|
14
|
+
config.skip_paths = []
|
15
|
+
|
16
|
+
# Configure how Rails Mini Profiler stores profiling information
|
17
|
+
# config.storage.database = :rmp_database
|
18
|
+
# config.storage.profiled_requests_table = :rmp_profiled_requests
|
19
|
+
# config.storage.traces_table = :rmp_traces
|
20
|
+
# config.storage.flamegraphs_table = :rmp_flamegraphs
|
21
|
+
|
22
|
+
# Customize how users are detected
|
23
|
+
config.user_provider = proc { |env| Rack::Request.new(env).ip }
|
13
24
|
end
|
data/lib/rails_mini_profiler.rb
CHANGED
@@ -6,8 +6,6 @@ require 'inline_svg'
|
|
6
6
|
require 'rails_mini_profiler/version'
|
7
7
|
require 'rails_mini_profiler/engine'
|
8
8
|
|
9
|
-
require 'rails_mini_profiler/errors'
|
10
|
-
|
11
9
|
require 'rails_mini_profiler/user'
|
12
10
|
require 'rails_mini_profiler/request_context'
|
13
11
|
|
@@ -26,28 +24,56 @@ require 'rails_mini_profiler/badge'
|
|
26
24
|
require 'rails_mini_profiler/tracers'
|
27
25
|
require 'rails_mini_profiler/middleware'
|
28
26
|
|
27
|
+
# Main namespace for Rails Mini Profiler
|
29
28
|
module RailsMiniProfiler
|
30
29
|
class << self
|
30
|
+
# Create a new configuration object
|
31
|
+
#
|
32
|
+
# @return [Configuration] a new configuration
|
31
33
|
def configuration
|
32
34
|
@configuration ||= Configuration.new
|
33
35
|
end
|
34
36
|
|
37
|
+
# Configure Rails Mini Profiler
|
38
|
+
#
|
39
|
+
# You may use this to configure where and how Rails Mini Profiler stores profiling and storage information.
|
40
|
+
#
|
41
|
+
# @see https://github.com/hschne/rails-mini-profiler#configuration
|
42
|
+
#
|
43
|
+
# @yieldreturn [Configuration] a new configuration
|
35
44
|
def configure
|
36
45
|
yield(configuration)
|
37
46
|
end
|
38
47
|
|
48
|
+
# Access storage configuration.
|
49
|
+
#
|
50
|
+
#
|
51
|
+
# @return [Storage] a new storage configuration
|
39
52
|
def storage_configuration
|
40
|
-
configuration.storage
|
53
|
+
configuration.storage
|
41
54
|
end
|
42
55
|
|
56
|
+
# Access the current logger
|
57
|
+
#
|
58
|
+
# @return [Logger] the logger instance
|
43
59
|
def logger
|
44
60
|
@logger ||= configuration.logger
|
45
61
|
end
|
46
62
|
|
63
|
+
# Authorize the current user for this request
|
64
|
+
#
|
65
|
+
# @param current_user [Object] the current user
|
66
|
+
#
|
67
|
+
# @see User#current_user
|
47
68
|
def authorize!(current_user)
|
48
69
|
RailsMiniProfiler::User.current_user = current_user
|
49
70
|
end
|
50
71
|
|
72
|
+
# Set the current user for this request
|
73
|
+
#
|
74
|
+
# @param current_user [Object] the current user
|
75
|
+
#
|
76
|
+
# @see User#current_user
|
51
77
|
def current_user=(current_user)
|
52
78
|
RailsMiniProfiler::User.current_user = current_user
|
53
79
|
end
|