no-cache 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 04c1697feaccfcaffc80f08e99dfdc43b26d2456da5ccbe093110f42115fdbd2
4
+ data.tar.gz: '090f10d0c4edd8f102e77a9b2d18436dc74a4adf99abc6496dc109e92315280f'
5
+ SHA512:
6
+ metadata.gz: 1ea829ccf98bf87fbd081583a7b9027c5b62c2cb1de5a3cc51da45183b06d995790bb7923bcaac1a5c20434385fe902e38a076b984847d8644b09b8c6a61f0b4
7
+ data.tar.gz: bbf5cd761ff819e174a608d4200e6a6b2bc15d506c35833a9beb74416bcad71cbd9a013eef35c5abdfd09b79ff66659f0421cf0277fd4bf79b6bb7d8328b05d3
data/.gitignore ADDED
@@ -0,0 +1,5 @@
1
+ *.gem
2
+ .bundle
3
+ pkg/
4
+ tmp/
5
+ /.idea
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.5.1
data/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Yaroslav Konoplov
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,17 @@
1
+ # no-cache
2
+
3
+ The gem provides easy way to fully disable HTTP cache in Rails controllers.
4
+
5
+ ## Usage
6
+
7
+ Please, see the code sample below.
8
+
9
+ ```ruby
10
+ class HelloController < ActionController::Metal
11
+ before_action { no_cache! if request.get? }
12
+
13
+ def index
14
+ self.response_body = "Hello World!"
15
+ end
16
+ end
17
+ ```
@@ -0,0 +1,6 @@
1
+ # encoding: UTF-8
2
+ # frozen_string_literal: true
3
+
4
+ module NoCache
5
+ VERSION = "1.0.0"
6
+ end
data/lib/no-cache.rb ADDED
@@ -0,0 +1,29 @@
1
+ # encoding: UTF-8
2
+ # frozen_string_literal: true
3
+
4
+ module NoCache
5
+ HEADERS = {
6
+ "Cache-Control" => "private, no-store, no-cache, max-age=0, must-revalidate, post-check=0, pre-check=0",
7
+ "Pragma" => "no-cache",
8
+ "Expires" => "Fri, 01 Jan 1970 00:00:00 GMT"
9
+ }.freeze
10
+
11
+ class << self
12
+ def headers
13
+ HEADERS
14
+ end
15
+ end
16
+
17
+ module Extension
18
+ def no_cache!
19
+ response.headers.merge!(NoCache.headers)
20
+ end
21
+ end
22
+ end
23
+
24
+ begin
25
+ require "action_controller/metal"
26
+ ActionController::Metal.send :include, NoCache::Extension
27
+ rescue LoadError
28
+ nil
29
+ end
data/no-cache.gemspec ADDED
@@ -0,0 +1,18 @@
1
+ # encoding: UTF-8
2
+ # frozen_string_literal: true
3
+
4
+ require File.expand_path("../lib/no-cache/version", __FILE__)
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "no-cache"
8
+ s.version = NoCache::VERSION
9
+ s.author = "Yaroslav Konoplov"
10
+ s.email = "eahome00@gmail.com"
11
+ s.summary = "A gem to fully disable HTTP cache."
12
+ s.description = "The gem provides easy way to fully disable HTTP cache in Rails controllers."
13
+ s.homepage = "https://github.com/yivo/no-cache"
14
+ s.license = "MIT"
15
+ s.files = `git ls-files -z`.split("\x0")
16
+ s.test_files = `git ls-files -z -- {test,spec,features}/*`.split("\x0")
17
+ s.require_paths = ["lib"]
18
+ end
metadata ADDED
@@ -0,0 +1,50 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: no-cache
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Yaroslav Konoplov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-10-05 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: The gem provides easy way to fully disable HTTP cache in Rails controllers.
14
+ email: eahome00@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - ".gitignore"
20
+ - ".ruby-version"
21
+ - LICENSE
22
+ - README.md
23
+ - lib/no-cache.rb
24
+ - lib/no-cache/version.rb
25
+ - no-cache.gemspec
26
+ homepage: https://github.com/yivo/no-cache
27
+ licenses:
28
+ - MIT
29
+ metadata: {}
30
+ post_install_message:
31
+ rdoc_options: []
32
+ require_paths:
33
+ - lib
34
+ required_ruby_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ required_rubygems_version: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: '0'
44
+ requirements: []
45
+ rubyforge_project:
46
+ rubygems_version: 2.7.6
47
+ signing_key:
48
+ specification_version: 4
49
+ summary: A gem to fully disable HTTP cache.
50
+ test_files: []