cache-friendly 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fb2bae3c5f65980c2ab4455a7f3c49515202682c
4
+ data.tar.gz: 791847c04c5323938f58f1f59a4bfc67d4ba66b1
5
+ SHA512:
6
+ metadata.gz: 381dde4a8e40c2438302f64ec189f805bb9ab7dbfec28ed3fe10303471ffa6299b2d806129f956f1f98e03690bcb87fbc0acca1a19d7be4d2c7a0a6cd491ee33
7
+ data.tar.gz: acd06201491c8f8268a0bd64175dbf56cc972083a13fcc7f8002a14c17c3ea87346c9ad4db32848498c25297379e01b04778fd58ce505d5d30f25d9846afe671
@@ -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
+ /.idea
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in cache-friendly.gemspec
4
+ gemspec
@@ -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.
@@ -0,0 +1,28 @@
1
+ # Cache::Friendly
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 'cache-friendly', group: :development
11
+ ```
12
+
13
+ And make sure caching is on in development environment:
14
+ ```ruby
15
+ config.action_controller.perform_caching = true
16
+ ```
17
+
18
+ ## Usage
19
+
20
+ TODO: Write usage instructions here
21
+
22
+ ## Contributing
23
+
24
+ 1. Fork it ( https://github.com/[my-github-username]/cache-friendly/fork )
25
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
26
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
27
+ 4. Push to the branch (`git push origin my-new-feature`)
28
+ 5. Create a new Pull Request
@@ -0,0 +1,2 @@
1
+ require 'bundler/gem_tasks'
2
+
@@ -0,0 +1,22 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'cache/friendly/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'cache-friendly'
8
+ spec.version = Cache::Friendly::VERSION
9
+ spec.authors = ['Vilius Luneckas']
10
+ spec.email = ['vilius.luneckas@gmail.com']
11
+ spec.summary = %q{Dead simple tool for visual debugging of fragment cache.}
12
+ spec.description = spec.summary
13
+ spec.homepage = 'https://github.com/ViliusLuneckas/cache-friendly'
14
+ spec.license = 'MIT'
15
+
16
+ spec.files = `git ls-files -z`.split("\x0")
17
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
+ spec.require_paths = ['lib']
20
+
21
+ spec.add_dependency 'rails'
22
+ end
@@ -0,0 +1,8 @@
1
+ require 'cache/friendly/version'
2
+ require 'cache/friendly/fragment_for_patch'
3
+ require 'cache/friendly/railtie'
4
+
5
+ module Cache
6
+ module Friendly
7
+ end
8
+ end
@@ -0,0 +1,19 @@
1
+ module Cache
2
+ module Friendly
3
+ module FragmentForPatch
4
+ def self.included(base)
5
+ base.send :alias_method_chain, :fragment_for, :cache_friendly
6
+ end
7
+
8
+ def fragment_for_with_cache_friendly(name = {}, options = nil, &block)
9
+ fragment = fragment_for_without_cache_friendly(name, options, &block)
10
+
11
+ <<-HTML.strip_heredoc
12
+ <div style="background-color: rgba(0, 255, 23, 0.22) !important" data-cache-friendly=true>
13
+ #{fragment}
14
+ </div>
15
+ HTML
16
+ end
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,11 @@
1
+ module Cache
2
+ module Friendly
3
+ class Railtie < Rails::Railtie
4
+ config.to_prepare do
5
+ return unless Rails.env.development? && Rails.application.config.action_controller.perform_caching
6
+
7
+ ActionView::Helpers::CacheHelper.send(:include, FragmentForPatch)
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,5 @@
1
+ module Cache
2
+ module Friendly
3
+ VERSION = '0.0.1'
4
+ end
5
+ end
metadata ADDED
@@ -0,0 +1,68 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cache-friendly
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Vilius Luneckas
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-11-30 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
+ - Gemfile
36
+ - LICENSE.txt
37
+ - README.md
38
+ - Rakefile
39
+ - cache-friendly.gemspec
40
+ - lib/cache/friendly.rb
41
+ - lib/cache/friendly/fragment_for_patch.rb
42
+ - lib/cache/friendly/railtie.rb
43
+ - lib/cache/friendly/version.rb
44
+ homepage: https://github.com/ViliusLuneckas/cache-friendly
45
+ licenses:
46
+ - MIT
47
+ metadata: {}
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ requirements:
54
+ - - ">="
55
+ - !ruby/object:Gem::Version
56
+ version: '0'
57
+ required_rubygems_version: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ">="
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
62
+ requirements: []
63
+ rubyforge_project:
64
+ rubygems_version: 2.2.2
65
+ signing_key:
66
+ specification_version: 4
67
+ summary: Dead simple tool for visual debugging of fragment cache.
68
+ test_files: []