rails-cache-inspector 1.0.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 +7 -0
- data/.gitignore +15 -0
- data/.ruby-version +1 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +42 -0
- data/Rakefile +2 -0
- data/lib/rails-cache-inspector.rb +10 -0
- data/lib/rails-cache-inspector/configuration.rb +9 -0
- data/lib/rails-cache-inspector/fragment_for_patch.rb +15 -0
- data/lib/rails-cache-inspector/railtie.rb +9 -0
- data/lib/rails-cache-inspector/version.rb +3 -0
- data/rails-cache-inspector.gemspec +23 -0
- data/visual-debugging.gif +0 -0
- metadata +71 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 4b92f48e54fff086fabd13c4888863667ed2361f71ede21eaa390a6fba0bca98
|
4
|
+
data.tar.gz: cb1afe3f6424666d956f573ac956aa0c91076dbb5b20ff37e5fe0429de3fc0e4
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b7d2d0033021a7701f35cf246a1614ceed2d5cf7e3c824c8161bcab194990aac9b6302fc3d9345357c27303f32601c4219e28793070307cc8e8b1049cec8dbcc
|
7
|
+
data.tar.gz: af694c9d03222d524ebe78a7bed9980d3f051321cbaa5923a89e1d380c3d5b1ad6a8319c70a93c48ce4c5253b6dcbbec48126709778a3e969b50aa8452cef55d
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.5.1
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Vilius Luneckas
|
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
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# Rails cache inspector
|
2
|
+
|
3
|
+
Dead simple tool for visual debugging of fragment cache.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'rails-cache-inspector', group: :development
|
11
|
+
```
|
12
|
+
|
13
|
+
## Usage
|
14
|
+
|
15
|
+
### Configure highlighting
|
16
|
+
|
17
|
+
```Ruby
|
18
|
+
# config/initializers/rails_cache_inspector.rb
|
19
|
+
|
20
|
+
RailsCacheInspector.configuration.highlight_with = {
|
21
|
+
style: 'filter: sepia(1)', # default – 'filter: sepia(1)'
|
22
|
+
class_name: 'is-cached' # default - ''
|
23
|
+
}
|
24
|
+
|
25
|
+
```
|
26
|
+
|
27
|
+
### Configure rails application
|
28
|
+
|
29
|
+
Make sure caching is turned on in development environment
|
30
|
+
|
31
|
+
```ruby
|
32
|
+
# config/environments/development.rb
|
33
|
+
|
34
|
+
config.action_controller.perform_caching = true
|
35
|
+
```
|
36
|
+
|
37
|
+
### In action
|
38
|
+
|
39
|
+
Cached fragments have blur filter in the demonstration below. It's easy to identify potentially slow parts of the page
|
40
|
+
and make it fast again.
|
41
|
+
|
42
|
+

|
data/Rakefile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require_relative 'rails-cache-inspector/configuration'
|
2
|
+
require_relative 'rails-cache-inspector/fragment_for_patch'
|
3
|
+
require_relative 'rails-cache-inspector/railtie'
|
4
|
+
require_relative 'rails-cache-inspector/version'
|
5
|
+
|
6
|
+
module RailsCacheInspector
|
7
|
+
def self.configuration
|
8
|
+
@configuration ||= Configuration.new(highlight_with: { style: 'filter: sepia(1)' })
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module RailsCacheInspector
|
2
|
+
module FragmentForPatch
|
3
|
+
def fragment_for(name = {}, options = nil, &block)
|
4
|
+
fragment = super(name, options, &block)
|
5
|
+
style = RailsCacheInspector.configuration.highlight_with[:style]
|
6
|
+
class_name = RailsCacheInspector.configuration.highlight_with[:class_name]
|
7
|
+
|
8
|
+
<<-HTML.strip_heredoc
|
9
|
+
<div style="#{style}" class="#{class_name}">
|
10
|
+
#{fragment}
|
11
|
+
</div>
|
12
|
+
HTML
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
|
5
|
+
require 'rails-cache-inspector/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = 'rails-cache-inspector'
|
9
|
+
spec.version = RailsCacheInspector::VERSION
|
10
|
+
spec.authors = ['Vilius Luneckas']
|
11
|
+
spec.email = ['vilius.luneckas@gmail.com']
|
12
|
+
spec.summary = %q{Dead simple tool for visual debugging of fragment cache.}
|
13
|
+
spec.description = spec.summary
|
14
|
+
spec.homepage = 'https://github.com/ViliusLuneckas/rails-cache-inspector'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ['lib']
|
21
|
+
|
22
|
+
spec.add_dependency 'rails'
|
23
|
+
end
|
Binary file
|
metadata
ADDED
@@ -0,0 +1,71 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: rails-cache-inspector
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Vilius Luneckas
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-06-03 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: rails
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: Dead simple tool for visual debugging of fragment cache.
|
28
|
+
email:
|
29
|
+
- vilius.luneckas@gmail.com
|
30
|
+
executables: []
|
31
|
+
extensions: []
|
32
|
+
extra_rdoc_files: []
|
33
|
+
files:
|
34
|
+
- ".gitignore"
|
35
|
+
- ".ruby-version"
|
36
|
+
- Gemfile
|
37
|
+
- LICENSE.txt
|
38
|
+
- README.md
|
39
|
+
- Rakefile
|
40
|
+
- lib/rails-cache-inspector.rb
|
41
|
+
- lib/rails-cache-inspector/configuration.rb
|
42
|
+
- lib/rails-cache-inspector/fragment_for_patch.rb
|
43
|
+
- lib/rails-cache-inspector/railtie.rb
|
44
|
+
- lib/rails-cache-inspector/version.rb
|
45
|
+
- rails-cache-inspector.gemspec
|
46
|
+
- visual-debugging.gif
|
47
|
+
homepage: https://github.com/ViliusLuneckas/rails-cache-inspector
|
48
|
+
licenses:
|
49
|
+
- MIT
|
50
|
+
metadata: {}
|
51
|
+
post_install_message:
|
52
|
+
rdoc_options: []
|
53
|
+
require_paths:
|
54
|
+
- lib
|
55
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
56
|
+
requirements:
|
57
|
+
- - ">="
|
58
|
+
- !ruby/object:Gem::Version
|
59
|
+
version: '0'
|
60
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '0'
|
65
|
+
requirements: []
|
66
|
+
rubyforge_project:
|
67
|
+
rubygems_version: 2.7.6
|
68
|
+
signing_key:
|
69
|
+
specification_version: 4
|
70
|
+
summary: Dead simple tool for visual debugging of fragment cache.
|
71
|
+
test_files: []
|