rorvswild 1.5.10 → 1.5.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f1e098cc5c0d18dcb26f720fc2be0927cf5cd06dad63098f7fd81a7ddd5a552c
4
- data.tar.gz: 44eec8c8b452579850a97ce36c1365f75259cf2d29b407b5fb25a239ba46d58b
3
+ metadata.gz: 35897aa29faf0bcc0fe63db30ef4e837ce9a29fea2527b830bdd81c22f28b3b5
4
+ data.tar.gz: 8c2f951e47e9a4834ed97068651077d5672b2cc909799c240ab41e4eb7f6145d
5
5
  SHA512:
6
- metadata.gz: b2b869f3ebee5a12e17e75d90c4ed26a1dd212b5fe414b3214895e4746e173f2bc72ac397af315bc0cc7445e0a4346db9b1f98aab5c4fa4a821b4f66e7e038e1
7
- data.tar.gz: bde1938595d5353f9fb686fa7c6955f55ee4d4349184e4574da0f85e434ff363d52041323be8a5452064b4887ad8c600f44cc7c9e7e28e77afc5f35f4ad9c72c
6
+ metadata.gz: f94a20f60b6967ded361bc37a695fe9cef4f2b79d5d63d7a4ff658189eadd351dd9e587a25950bb9fe2a3dd353a55dbf9b095cdd96ba43a276796abad589e2cb
7
+ data.tar.gz: f89fb8baf1d6db2d7d1d6af631740423402df53112c60474061fd1514744bc727f79cd4e8c07c7ddd3a98ea236723b74cffcf175593f829b022e7ac442ce4e45
data/README.md CHANGED
@@ -58,6 +58,20 @@ It shows most of the requests performances insights *RoRvsWild.com* displays. **
58
58
 
59
59
  *RoRvsWild Local* renders a small button in the bottom left corner of your page showing the runtime of the current request. If you click on it, you get all the profiled sections ordered by impact, which is depending on the sections average runtime and the calls count. As on RoRvsWild.com, the bottleneck is always on the top of the list.
60
60
 
61
+ Sometimes the widget displayed in the bottom left corner can be annoying depending on your site layout. You can change its position like in the example below with the `widget` option :
62
+
63
+
64
+ ```yaml
65
+ # config/rorvswild.yml
66
+
67
+ development:
68
+ widget: top-right # Default is bottom-left
69
+ # All possition values :
70
+ # top-left, top-right, bottom-right, bottom-left, hidden
71
+ ```
72
+
73
+ If you choose to hide the widget, you can still see request profilings via the following URL http://localhost:3000/rorvswild.
74
+
61
75
  Be aware that the performances on your development machine may vary from the production server. Obviously because of the different hardware and database size. Also, Rails is reloading all the code in development environment and this takes quite a lot of time.
62
76
  To prevent this behaviour and better match the production, turn on cache_classes in your config/environments/development.rb:
63
77
 
@@ -3,9 +3,9 @@ require "rorvswild/local/queue"
3
3
 
4
4
  module RorVsWild
5
5
  module Local
6
- def self.start
6
+ def self.start(config = {})
7
7
  Rails.application.config.middleware.unshift(RorVsWild::Local::Middleware, nil)
8
- RorVsWild.start(queue: RorVsWild::Local::Queue.new)
8
+ RorVsWild.start(config.merge(queue: RorVsWild::Local::Queue.new))
9
9
  end
10
10
  end
11
11
  end
@@ -1,4 +1,4 @@
1
- <div id="RorVsWild.Local">
1
+ <div id="RorVsWild.Local" class="<%= widget_css %>">
2
2
  <div data-barber="RorVsWild.Local">
3
3
  </div>
4
4
  </div>
@@ -56,9 +56,15 @@ module RorVsWild
56
56
 
57
57
  private
58
58
 
59
+ def widget_css
60
+ config = RorVsWild.agent.config
61
+ config && config[:widget] && "is-#{config[:widget]}"
62
+ end
63
+
59
64
  def inject_into(html)
60
65
  if index = html.index("</body>")
61
- markup = File.read(File.join(LOCAL_FOLDER, "local.html"))
66
+ markup = File.read(File.join(LOCAL_FOLDER, "local.html.erb"))
67
+ markup = ERB.new(markup).result(binding)
62
68
  markup = markup.html_safe if markup.respond_to?(:html_safe)
63
69
  html.insert(index, markup)
64
70
  end
@@ -25,6 +25,30 @@
25
25
  display: inline-block !important;
26
26
  }
27
27
 
28
+ /************* TOGGLER POSITION OPTION(default bottom-left)**********************/
29
+
30
+ .is-top-right .rorvswild-local-toggler {
31
+ bottom: auto !important;
32
+ left: auto !important;
33
+ right: 12px !important;
34
+ top: 12px !important;
35
+ }
36
+
37
+ .is-top-left .rorvswild-local-toggler {
38
+ bottom: auto !important;
39
+ top: 12px !important;
40
+ }
41
+
42
+ .is-bottom-right .rorvswild-local-toggler {
43
+ bottom: 12px !important;
44
+ left: auto !important;
45
+ right: 12px !important;
46
+ }
47
+
48
+ .is-hidden .rorvswild-local-toggler {
49
+ display: none;
50
+ }
51
+
28
52
  /********************************************/
29
53
  /*************** PANEL **********************/
30
54
  /********************************************/
@@ -10,20 +10,19 @@ module RorVsWild
10
10
  def self.start
11
11
  return if RorVsWild.agent
12
12
 
13
- if (path = Rails.root.join("config/rorvswild.yml")).exist?
14
- if config = RorVsWild::RailsLoader.load_config_file(path)[Rails.env]
15
- RorVsWild.start(config.symbolize_keys)
16
- end
17
- end
18
-
19
- if !RorVsWild.agent && Rails.env.development?
13
+ if (config = load_config) && config["api_key"]
14
+ RorVsWild.start(config)
15
+ elsif Rails.env.development?
20
16
  require "rorvswild/local"
21
- RorVsWild::Local.start
17
+ RorVsWild::Local.start(config || {})
22
18
  end
23
19
  end
24
20
 
25
- def self.load_config_file(path)
26
- YAML.load(ERB.new(path.read).result)
21
+ def self.load_config
22
+ if (path = Rails.root.join("config/rorvswild.yml")).exist?
23
+ hash = YAML.load(ERB.new(path.read).result)[Rails.env]
24
+ hash && hash.deep_symbolize_keys
25
+ end
27
26
  end
28
27
  end
29
28
  end
@@ -1,3 +1,3 @@
1
1
  module RorVsWild
2
- VERSION = "1.5.10".freeze
2
+ VERSION = "1.5.11".freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rorvswild
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.10
4
+ version: 1.5.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexis Bernard
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-03-30 00:00:00.000000000 Z
12
+ date: 2021-05-21 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: Performances and errors insights for rails developers.
15
15
  email:
@@ -34,7 +34,7 @@ files:
34
34
  - lib/rorvswild/local/javascript/vendor/barber.js
35
35
  - lib/rorvswild/local/javascript/vendor/mustache.js
36
36
  - lib/rorvswild/local/javascript/vendor/prism.js
37
- - lib/rorvswild/local/local.html
37
+ - lib/rorvswild/local/local.html.erb
38
38
  - lib/rorvswild/local/middleware.rb
39
39
  - lib/rorvswild/local/queue.rb
40
40
  - lib/rorvswild/local/stylesheet/local.css