actionpack-page_caching 1.2.3 → 1.2.5
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/.github/workflows/ci.yml +85 -0
- data/.rubocop.yml +41 -41
- data/CHANGELOG.md +69 -21
- data/README.md +1 -1
- data/actionpack-page_caching.gemspec +3 -3
- data/gemfiles/Gemfile-6-1-stable +5 -0
- data/gemfiles/Gemfile-7-0-stable +5 -0
- data/gemfiles/Gemfile-7-1-stable +5 -0
- data/gemfiles/Gemfile-7-2-stable +5 -0
- data/gemfiles/Gemfile-8-0-stable +5 -0
- data/gemfiles/Gemfile-8-1-stable +5 -0
- data/gemfiles/Gemfile-edge +1 -2
- data/lib/action_controller/caching/pages.rb +4 -3
- data/test/caching_test.rb +30 -6
- data/test/instrumentation_test.rb +63 -0
- metadata +15 -16
- data/.travis.yml +0 -43
- data/gemfiles/Gemfile-5-0-stable +0 -5
- data/gemfiles/Gemfile-5-1-stable +0 -5
- data/gemfiles/Gemfile-5-2-stable +0 -5
- data/gemfiles/Gemfile-6-0-stable +0 -5
- data/test/log_subscriber_test.rb +0 -57
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ddc94d6e16fd7d3cb21aa0d63a1ade832a271077ea5d9b1e42e769490f05f102
|
|
4
|
+
data.tar.gz: 0bc6935d09e011c00c437ddb6ee5aee424ebde5452a801cb582be7f5c977f940
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 4319580bee3b3fe4f9ced4d73c180d623e625b4ae885a4cc7b66d2fb2e831aba3bdd630d8a2a3298f38186fc40602b799ec342772540cfe96c1636ab536a9e7b
|
|
7
|
+
data.tar.gz: a81007b1ebd1b0c06b5b836b0951ecba336ef182375ad8705ef6a057193941545a09b0642cd6cc651325c9222402d7ef4da3085dac75015edfcd923af49db1bf
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches:
|
|
6
|
+
- 'master'
|
|
7
|
+
pull_request:
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
strategy:
|
|
12
|
+
matrix:
|
|
13
|
+
gemfile:
|
|
14
|
+
- '6-1-stable'
|
|
15
|
+
- '7-0-stable'
|
|
16
|
+
- '7-1-stable'
|
|
17
|
+
- '7-2-stable'
|
|
18
|
+
- '8-0-stable'
|
|
19
|
+
- '8-1-stable'
|
|
20
|
+
- 'edge'
|
|
21
|
+
ruby:
|
|
22
|
+
- '2.7'
|
|
23
|
+
- '3.0'
|
|
24
|
+
- '3.1'
|
|
25
|
+
- '3.2'
|
|
26
|
+
- '3.3'
|
|
27
|
+
- '3.4'
|
|
28
|
+
exclude:
|
|
29
|
+
- gemfile: '6-1-stable'
|
|
30
|
+
ruby: '3.1'
|
|
31
|
+
- gemfile: '6-1-stable'
|
|
32
|
+
ruby: '3.2'
|
|
33
|
+
- gemfile: '6-1-stable'
|
|
34
|
+
ruby: '3.3'
|
|
35
|
+
- gemfile: '6-1-stable'
|
|
36
|
+
ruby: '3.4'
|
|
37
|
+
- gemfile: '7-0-stable'
|
|
38
|
+
ruby: '3.3'
|
|
39
|
+
- gemfile: '7-0-stable'
|
|
40
|
+
ruby: '3.4'
|
|
41
|
+
- gemfile: '7-1-stable'
|
|
42
|
+
ruby: '3.4'
|
|
43
|
+
- gemfile: '7-2-stable'
|
|
44
|
+
ruby: '2.7'
|
|
45
|
+
- gemfile: '7-2-stable'
|
|
46
|
+
ruby: '3.0'
|
|
47
|
+
- gemfile: '8-0-stable'
|
|
48
|
+
ruby: '2.7'
|
|
49
|
+
- gemfile: '8-0-stable'
|
|
50
|
+
ruby: '3.0'
|
|
51
|
+
- gemfile: '8-0-stable'
|
|
52
|
+
ruby: '3.1'
|
|
53
|
+
- gemfile: '8-1-stable'
|
|
54
|
+
ruby: '2.7'
|
|
55
|
+
- gemfile: '8-1-stable'
|
|
56
|
+
ruby: '3.0'
|
|
57
|
+
- gemfile: '8-1-stable'
|
|
58
|
+
ruby: '3.1'
|
|
59
|
+
- gemfile: 'edge'
|
|
60
|
+
ruby: '2.7'
|
|
61
|
+
- gemfile: 'edge'
|
|
62
|
+
ruby: '3.0'
|
|
63
|
+
- gemfile: 'edge'
|
|
64
|
+
ruby: '3.1'
|
|
65
|
+
- gemfile: 'edge'
|
|
66
|
+
ruby: '3.2'
|
|
67
|
+
fail-fast: false
|
|
68
|
+
|
|
69
|
+
runs-on: ubuntu-latest
|
|
70
|
+
name: ${{ matrix.ruby }} rails-${{ matrix.gemfile }}
|
|
71
|
+
|
|
72
|
+
steps:
|
|
73
|
+
- uses: actions/checkout@v4
|
|
74
|
+
|
|
75
|
+
- uses: ruby/setup-ruby@v1
|
|
76
|
+
with:
|
|
77
|
+
ruby-version: ${{ matrix.ruby }}
|
|
78
|
+
bundler-cache: true
|
|
79
|
+
|
|
80
|
+
- run: bundle exec rake test
|
|
81
|
+
|
|
82
|
+
env:
|
|
83
|
+
BUNDLE_GEMFILE: gemfiles/Gemfile-${{ matrix.gemfile }}
|
|
84
|
+
BUNDLE_JOBS: 4
|
|
85
|
+
BUNDLE_RETRY: 3
|
data/.rubocop.yml
CHANGED
|
@@ -4,10 +4,6 @@ AllCops:
|
|
|
4
4
|
# to ignore them, so only the ones explicitly set in this file are enabled.
|
|
5
5
|
DisabledByDefault: true
|
|
6
6
|
|
|
7
|
-
# Prefer &&/|| over and/or.
|
|
8
|
-
Style/AndOr:
|
|
9
|
-
Enabled: true
|
|
10
|
-
|
|
11
7
|
# Align `when` with `case`.
|
|
12
8
|
Layout/CaseIndentation:
|
|
13
9
|
Enabled: true
|
|
@@ -22,13 +18,6 @@ Layout/CommentIndentation:
|
|
|
22
18
|
Layout/ElseAlignment:
|
|
23
19
|
Enabled: true
|
|
24
20
|
|
|
25
|
-
# Align `end` with the matching keyword or starting expression except for
|
|
26
|
-
# assignments, where it should be aligned with the LHS.
|
|
27
|
-
Layout/EndAlignment:
|
|
28
|
-
Enabled: true
|
|
29
|
-
EnforcedStyleAlignWith: variable
|
|
30
|
-
AutoCorrect: true
|
|
31
|
-
|
|
32
21
|
Layout/EmptyLineAfterMagicComment:
|
|
33
22
|
Enabled: true
|
|
34
23
|
|
|
@@ -51,9 +40,12 @@ Layout/EmptyLinesAroundMethodBody:
|
|
|
51
40
|
Layout/EmptyLinesAroundModuleBody:
|
|
52
41
|
Enabled: true
|
|
53
42
|
|
|
54
|
-
#
|
|
55
|
-
|
|
43
|
+
# Align `end` with the matching keyword or starting expression except for
|
|
44
|
+
# assignments, where it should be aligned with the LHS.
|
|
45
|
+
Layout/EndAlignment:
|
|
56
46
|
Enabled: true
|
|
47
|
+
EnforcedStyleAlignWith: variable
|
|
48
|
+
AutoCorrect: true
|
|
57
49
|
|
|
58
50
|
Layout/FirstArgumentIndentation:
|
|
59
51
|
Enabled: true
|
|
@@ -86,6 +78,10 @@ Layout/SpaceAroundEqualsInParameterDefault:
|
|
|
86
78
|
Layout/SpaceAroundKeyword:
|
|
87
79
|
Enabled: true
|
|
88
80
|
|
|
81
|
+
# Use `foo {}` not `foo{}`.
|
|
82
|
+
Layout/SpaceBeforeBlockBraces:
|
|
83
|
+
Enabled: true
|
|
84
|
+
|
|
89
85
|
Layout/SpaceBeforeComma:
|
|
90
86
|
Enabled: true
|
|
91
87
|
|
|
@@ -95,20 +91,6 @@ Layout/SpaceBeforeComment:
|
|
|
95
91
|
Layout/SpaceBeforeFirstArg:
|
|
96
92
|
Enabled: true
|
|
97
93
|
|
|
98
|
-
Style/DefWithParentheses:
|
|
99
|
-
Enabled: true
|
|
100
|
-
|
|
101
|
-
# Defining a method with parameters needs parentheses.
|
|
102
|
-
Style/MethodDefParentheses:
|
|
103
|
-
Enabled: true
|
|
104
|
-
|
|
105
|
-
Style/RedundantFreeze:
|
|
106
|
-
Enabled: true
|
|
107
|
-
|
|
108
|
-
# Use `foo {}` not `foo{}`.
|
|
109
|
-
Layout/SpaceBeforeBlockBraces:
|
|
110
|
-
Enabled: true
|
|
111
|
-
|
|
112
94
|
# Use `foo { bar }` not `foo {bar}`.
|
|
113
95
|
Layout/SpaceInsideBlockBraces:
|
|
114
96
|
Enabled: true
|
|
@@ -121,11 +103,6 @@ Layout/SpaceInsideHashLiteralBraces:
|
|
|
121
103
|
Layout/SpaceInsideParens:
|
|
122
104
|
Enabled: true
|
|
123
105
|
|
|
124
|
-
# Check quotes usage according to lint rule below.
|
|
125
|
-
Style/StringLiterals:
|
|
126
|
-
Enabled: true
|
|
127
|
-
EnforcedStyle: double_quotes
|
|
128
|
-
|
|
129
106
|
# Detect hard tabs, no hard tabs.
|
|
130
107
|
Layout/Tab:
|
|
131
108
|
Enabled: true
|
|
@@ -138,19 +115,21 @@ Layout/TrailingEmptyLines:
|
|
|
138
115
|
Layout/TrailingWhitespace:
|
|
139
116
|
Enabled: true
|
|
140
117
|
|
|
141
|
-
# Use quotes for string literals when they are enough.
|
|
142
|
-
Style/RedundantPercentQ:
|
|
143
|
-
Enabled: true
|
|
144
|
-
|
|
145
118
|
Lint/AmbiguousOperator:
|
|
146
119
|
Enabled: true
|
|
147
120
|
|
|
148
121
|
Lint/AmbiguousRegexpLiteral:
|
|
149
122
|
Enabled: true
|
|
150
123
|
|
|
124
|
+
Lint/DeprecatedClassMethods:
|
|
125
|
+
Enabled: true
|
|
126
|
+
|
|
151
127
|
Lint/ErbNewArguments:
|
|
152
128
|
Enabled: true
|
|
153
129
|
|
|
130
|
+
Lint/RedundantStringCoercion:
|
|
131
|
+
Enabled: true
|
|
132
|
+
|
|
154
133
|
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
|
155
134
|
Lint/RequireParentheses:
|
|
156
135
|
Enabled: true
|
|
@@ -158,16 +137,29 @@ Lint/RequireParentheses:
|
|
|
158
137
|
Lint/ShadowingOuterLocalVariable:
|
|
159
138
|
Enabled: true
|
|
160
139
|
|
|
161
|
-
Lint/
|
|
140
|
+
Lint/UselessAssignment:
|
|
162
141
|
Enabled: true
|
|
163
142
|
|
|
164
143
|
Lint/UriEscapeUnescape:
|
|
165
144
|
Enabled: true
|
|
166
145
|
|
|
167
|
-
|
|
146
|
+
# Prefer &&/|| over and/or.
|
|
147
|
+
Style/AndOr:
|
|
168
148
|
Enabled: true
|
|
169
149
|
|
|
170
|
-
|
|
150
|
+
# Prefer Foo.method over Foo::method
|
|
151
|
+
Style/ColonMethodCall:
|
|
152
|
+
Enabled: true
|
|
153
|
+
|
|
154
|
+
Style/DefWithParentheses:
|
|
155
|
+
Enabled: true
|
|
156
|
+
|
|
157
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
|
158
|
+
Style/HashSyntax:
|
|
159
|
+
Enabled: true
|
|
160
|
+
|
|
161
|
+
# Defining a method with parameters needs parentheses.
|
|
162
|
+
Style/MethodDefParentheses:
|
|
171
163
|
Enabled: true
|
|
172
164
|
|
|
173
165
|
Style/ParenthesesAroundCondition:
|
|
@@ -176,6 +168,13 @@ Style/ParenthesesAroundCondition:
|
|
|
176
168
|
Style/RedundantBegin:
|
|
177
169
|
Enabled: true
|
|
178
170
|
|
|
171
|
+
Style/RedundantFreeze:
|
|
172
|
+
Enabled: true
|
|
173
|
+
|
|
174
|
+
# Use quotes for string literals when they are enough.
|
|
175
|
+
Style/RedundantPercentQ:
|
|
176
|
+
Enabled: true
|
|
177
|
+
|
|
179
178
|
Style/RedundantReturn:
|
|
180
179
|
Enabled: true
|
|
181
180
|
AllowMultipleReturnValues: true
|
|
@@ -184,9 +183,10 @@ Style/Semicolon:
|
|
|
184
183
|
Enabled: true
|
|
185
184
|
AllowAsExpressionSeparator: true
|
|
186
185
|
|
|
187
|
-
#
|
|
188
|
-
Style/
|
|
186
|
+
# Check quotes usage according to lint rule below.
|
|
187
|
+
Style/StringLiterals:
|
|
189
188
|
Enabled: true
|
|
189
|
+
EnforcedStyle: double_quotes
|
|
190
190
|
|
|
191
191
|
Style/TrivialAccessors:
|
|
192
192
|
Enabled: true
|
data/CHANGELOG.md
CHANGED
|
@@ -1,47 +1,95 @@
|
|
|
1
|
-
## 1.
|
|
1
|
+
## 1.2.5 (September 21, 2026)
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
- Fix directory check for directory with shared prefix
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
_John Hawthorn_
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
## 1.2.4 (May 15, 2021)
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- Fix `URI.parser` deprecation warning in Rails 6.1
|
|
10
10
|
|
|
11
|
+
_Andrew White_
|
|
11
12
|
|
|
12
|
-
## 1.
|
|
13
|
+
## 1.2.3 (June 12, 2020)
|
|
13
14
|
|
|
14
|
-
|
|
15
|
+
- Simplifies code in `page_caching.rb`
|
|
15
16
|
|
|
16
|
-
|
|
17
|
+
_Xavier Noria_
|
|
17
18
|
|
|
18
|
-
|
|
19
|
+
## 1.2.2 (May 6, 2020)
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
- Fix variable name
|
|
21
22
|
|
|
22
|
-
|
|
23
|
+
_Jack McCracken_
|
|
23
24
|
|
|
24
|
-
|
|
25
|
+
## 1.2.1 (May 6, 2020)
|
|
25
26
|
|
|
27
|
+
- Only write relative URIs when their normalized path begins with the normalized cache directory path
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
_Jack McCracken_
|
|
28
30
|
|
|
29
|
-
|
|
31
|
+
## 1.2.0 (December 11, 2019)
|
|
30
32
|
|
|
31
|
-
|
|
33
|
+
- Update RuboCop config
|
|
32
34
|
|
|
35
|
+
_Rafael Mendonça França_
|
|
33
36
|
|
|
34
|
-
|
|
37
|
+
- Fix for Rails 6 MIME lookups
|
|
38
|
+
|
|
39
|
+
_Rob Zolkos_
|
|
40
|
+
|
|
41
|
+
- Remove Rails 4.2 from testing matrix
|
|
42
|
+
|
|
43
|
+
_Rob Zolkos_
|
|
44
|
+
|
|
45
|
+
- Minimum of Ruby 2.4 required
|
|
46
|
+
|
|
47
|
+
_Rob Zolkos_
|
|
48
|
+
|
|
49
|
+
- Remove upper dependency for `actionpack`
|
|
50
|
+
|
|
51
|
+
_Anton Kolodii_
|
|
52
|
+
|
|
53
|
+
## 1.1.1 (September 25, 2018)
|
|
54
|
+
|
|
55
|
+
- Fixes handling of several forward slashes as root path
|
|
56
|
+
|
|
57
|
+
_Xavier Noria_
|
|
35
58
|
|
|
36
|
-
|
|
59
|
+
- Documentation overhaul
|
|
60
|
+
|
|
61
|
+
_Xavier Noria_
|
|
62
|
+
|
|
63
|
+
## 1.1.0 (January 23, 2017)
|
|
64
|
+
|
|
65
|
+
- Support dynamic `page_cache_directory` using a Proc, Symbol or callable
|
|
66
|
+
|
|
67
|
+
_Andrew White_
|
|
68
|
+
|
|
69
|
+
- Support instance level setting of `page_cache_directory`
|
|
70
|
+
|
|
71
|
+
_Andrew White_
|
|
72
|
+
|
|
73
|
+
- Add support for Rails 5.0 and master
|
|
74
|
+
|
|
75
|
+
_Andrew White_
|
|
76
|
+
|
|
77
|
+
## 1.0.2 (November 15, 2013)
|
|
78
|
+
|
|
79
|
+
- Fix load order problem with other gems.
|
|
80
|
+
|
|
81
|
+
_Rafael Mendonça França_
|
|
82
|
+
|
|
83
|
+
## 1.0.1 (October 24, 2013)
|
|
37
84
|
|
|
38
|
-
|
|
85
|
+
- Add Railtie to set `page_cache_directory` by default to `public` folder.
|
|
39
86
|
|
|
40
|
-
|
|
87
|
+
Fixes #5.
|
|
41
88
|
|
|
89
|
+
_Žiga Vidic_
|
|
42
90
|
|
|
43
91
|
## 1.0.0 (February 27, 2013)
|
|
44
92
|
|
|
45
|
-
|
|
93
|
+
- Extract Action Pack - Action Caching from Rails core.
|
|
46
94
|
|
|
47
|
-
|
|
95
|
+
_Francesco Rodriguez_, _Rafael Mendonça França_, _Michiel Sikkes_
|
data/README.md
CHANGED
|
@@ -212,4 +212,4 @@ Contributing
|
|
|
212
212
|
Code Status
|
|
213
213
|
-----------
|
|
214
214
|
|
|
215
|
-
* [](https://github.com/rails/actionpack-page_caching/actions/workflows/ci.yml)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Gem::Specification.new do |gem|
|
|
2
2
|
gem.name = "actionpack-page_caching"
|
|
3
|
-
gem.version = "1.2.
|
|
3
|
+
gem.version = "1.2.5"
|
|
4
4
|
gem.author = "David Heinemeier Hansson"
|
|
5
5
|
gem.email = "david@loudthinking.com"
|
|
6
6
|
gem.description = "Static page caching for Action Pack (removed from core in Rails 4.0)"
|
|
@@ -8,14 +8,14 @@ Gem::Specification.new do |gem|
|
|
|
8
8
|
gem.homepage = "https://github.com/rails/actionpack-page_caching"
|
|
9
9
|
gem.license = "MIT"
|
|
10
10
|
|
|
11
|
-
gem.required_ruby_version = ">=
|
|
11
|
+
gem.required_ruby_version = ">= 1.9.3"
|
|
12
12
|
gem.files = `git ls-files`.split($/)
|
|
13
13
|
gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
|
|
14
14
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
|
15
15
|
gem.require_paths = ["lib"]
|
|
16
16
|
gem.license = "MIT"
|
|
17
17
|
|
|
18
|
-
gem.add_dependency "actionpack", ">=
|
|
18
|
+
gem.add_dependency "actionpack", ">= 4.0.0"
|
|
19
19
|
|
|
20
20
|
gem.add_development_dependency "mocha"
|
|
21
21
|
end
|
data/gemfiles/Gemfile-edge
CHANGED
|
@@ -146,7 +146,7 @@ module ActionController
|
|
|
146
146
|
if path.empty? || path =~ %r{\A/+\z}
|
|
147
147
|
name = "/index"
|
|
148
148
|
else
|
|
149
|
-
name = URI.
|
|
149
|
+
name = URI::DEFAULT_PARSER.unescape(path.chomp("/"))
|
|
150
150
|
end
|
|
151
151
|
|
|
152
152
|
if File.extname(name).empty?
|
|
@@ -157,10 +157,11 @@ module ActionController
|
|
|
157
157
|
end
|
|
158
158
|
|
|
159
159
|
def cache_path(path, extension = nil)
|
|
160
|
-
|
|
160
|
+
cache_directory = normalized_cache_directory
|
|
161
|
+
unnormalized_path = File.join(cache_directory, cache_file(path, extension))
|
|
161
162
|
normalized_path = File.expand_path(unnormalized_path)
|
|
162
163
|
|
|
163
|
-
normalized_path if normalized_path.start_with?(
|
|
164
|
+
normalized_path if normalized_path.start_with?(File.join(cache_directory, ""))
|
|
164
165
|
end
|
|
165
166
|
|
|
166
167
|
def delete(path)
|
data/test/caching_test.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
require "rails/version"
|
|
1
2
|
require "abstract_unit"
|
|
2
|
-
require "mocha/
|
|
3
|
+
require "mocha/minitest"
|
|
3
4
|
require "find"
|
|
4
5
|
|
|
5
6
|
CACHE_DIR = "test_cache"
|
|
@@ -184,18 +185,38 @@ class PageCachingTest < ActionController::TestCase
|
|
|
184
185
|
|
|
185
186
|
project_root = File.expand_path("../../", __FILE__)
|
|
186
187
|
|
|
187
|
-
|
|
188
188
|
# Make a path that escapes the cache directory
|
|
189
189
|
get_to_root = "../../../"
|
|
190
190
|
|
|
191
191
|
# Make sure this relative path points at the project root
|
|
192
192
|
assert_equal project_root, File.expand_path(File.join(FILE_STORE_PATH, get_to_root))
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
if Rails.version =~ /^4\./
|
|
195
|
+
get :ok, id: "#{get_to_root}../pwnd"
|
|
196
|
+
else
|
|
197
|
+
get :ok, params: { id: "#{get_to_root}../pwnd" }
|
|
198
|
+
end
|
|
195
199
|
|
|
196
200
|
assert_predicate Find.find(File.join(project_root, "test")).grep(/pwnd/), :empty?
|
|
197
201
|
end
|
|
198
202
|
|
|
203
|
+
def test_cache_does_not_escape_into_sibling_sharing_name_prefix
|
|
204
|
+
draw do
|
|
205
|
+
get "/page_caching_test/ok/:id", to: "page_caching_test#ok"
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Relative to the cache directory, "../../../" is the directory holding it.
|
|
209
|
+
["../../../#{CACHE_DIR}_sibling/page", "../../../#{CACHE_DIR}_sibling"].each do |id|
|
|
210
|
+
if Rails.version =~ /^4\./
|
|
211
|
+
get :ok, id: id
|
|
212
|
+
else
|
|
213
|
+
get :ok, params: { id: id }
|
|
214
|
+
end
|
|
215
|
+
end
|
|
216
|
+
|
|
217
|
+
assert_equal [CACHE_DIR], Dir.entries(TEST_TMP_DIR) - [".", ".."]
|
|
218
|
+
end
|
|
219
|
+
|
|
199
220
|
def test_page_caching_resources_saves_to_correct_path_with_extension_even_if_default_route
|
|
200
221
|
draw do
|
|
201
222
|
get "posts.:format", to: "posts#index", as: :formatted_posts
|
|
@@ -422,9 +443,10 @@ class ProcPageCachingTest < ActionController::TestCase
|
|
|
422
443
|
end
|
|
423
444
|
|
|
424
445
|
def test_class_level_cache_page_raise_error
|
|
425
|
-
assert_raises(RuntimeError
|
|
446
|
+
error = assert_raises(RuntimeError) do
|
|
426
447
|
@controller.class.cache_page "cached content", "/proc_page_caching_test/ok"
|
|
427
448
|
end
|
|
449
|
+
assert_match(/class-level cache_page method/, error.message)
|
|
428
450
|
end
|
|
429
451
|
end
|
|
430
452
|
|
|
@@ -478,9 +500,10 @@ class SymbolPageCachingTest < ActionController::TestCase
|
|
|
478
500
|
end
|
|
479
501
|
|
|
480
502
|
def test_class_level_cache_page_raise_error
|
|
481
|
-
assert_raises(RuntimeError
|
|
503
|
+
error = assert_raises(RuntimeError) do
|
|
482
504
|
@controller.class.cache_page "cached content", "/symbol_page_caching_test/ok"
|
|
483
505
|
end
|
|
506
|
+
assert_match(/class-level cache_page method/, error.message)
|
|
484
507
|
end
|
|
485
508
|
end
|
|
486
509
|
|
|
@@ -535,8 +558,9 @@ class CallablePageCachingTest < ActionController::TestCase
|
|
|
535
558
|
end
|
|
536
559
|
|
|
537
560
|
def test_class_level_cache_page_raise_error
|
|
538
|
-
assert_raises(RuntimeError
|
|
561
|
+
error = assert_raises(RuntimeError) do
|
|
539
562
|
@controller.class.cache_page "cached content", "/callable_page_caching_test/ok"
|
|
540
563
|
end
|
|
564
|
+
assert_match(/class-level cache_page method/, error.message)
|
|
541
565
|
end
|
|
542
566
|
end
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
require "abstract_unit"
|
|
2
|
+
|
|
3
|
+
module Another
|
|
4
|
+
class InstrumentationController < ActionController::Base
|
|
5
|
+
self.perform_caching = true
|
|
6
|
+
|
|
7
|
+
def with_page_cache
|
|
8
|
+
cache_page("Super soaker", "/index.html")
|
|
9
|
+
head :ok
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
class InstrumentationTest < ActionController::TestCase
|
|
15
|
+
tests Another::InstrumentationController
|
|
16
|
+
|
|
17
|
+
def setup
|
|
18
|
+
super
|
|
19
|
+
|
|
20
|
+
@routes = ActionDispatch::Routing::RouteSet.new
|
|
21
|
+
|
|
22
|
+
@cache_path = File.expand_path("../tmp/test_cache", __FILE__)
|
|
23
|
+
ActionController::Base.page_cache_directory = @cache_path
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def teardown
|
|
27
|
+
FileUtils.rm_rf(@cache_path)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def test_write_page_is_instrumented
|
|
31
|
+
events = []
|
|
32
|
+
subscriber = ActiveSupport::Notifications.subscribe("write_page.action_controller") do |*args|
|
|
33
|
+
events << ActiveSupport::Notifications::Event.new(*args)
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
with_routing do |set|
|
|
37
|
+
set.draw do
|
|
38
|
+
get "/with_page_cache", to: "another/instrumentation#with_page_cache"
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
get :with_page_cache
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
assert_equal 1, events.size
|
|
45
|
+
assert_equal "/index.html", events.first.payload[:path]
|
|
46
|
+
ensure
|
|
47
|
+
ActiveSupport::Notifications.unsubscribe(subscriber)
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
def test_expire_page_is_instrumented
|
|
51
|
+
events = []
|
|
52
|
+
subscriber = ActiveSupport::Notifications.subscribe("expire_page.action_controller") do |*args|
|
|
53
|
+
events << ActiveSupport::Notifications::Event.new(*args)
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
@controller.class.expire_page("/index.html")
|
|
57
|
+
|
|
58
|
+
assert_equal 1, events.size
|
|
59
|
+
assert_equal "/index.html", events.first.payload[:path]
|
|
60
|
+
ensure
|
|
61
|
+
ActiveSupport::Notifications.unsubscribe(subscriber)
|
|
62
|
+
end
|
|
63
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: actionpack-page_caching
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.2.
|
|
4
|
+
version: 1.2.5
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: bin
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: actionpack
|
|
@@ -16,14 +15,14 @@ dependencies:
|
|
|
16
15
|
requirements:
|
|
17
16
|
- - ">="
|
|
18
17
|
- !ruby/object:Gem::Version
|
|
19
|
-
version:
|
|
18
|
+
version: 4.0.0
|
|
20
19
|
type: :runtime
|
|
21
20
|
prerelease: false
|
|
22
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
23
22
|
requirements:
|
|
24
23
|
- - ">="
|
|
25
24
|
- !ruby/object:Gem::Version
|
|
26
|
-
version:
|
|
25
|
+
version: 4.0.0
|
|
27
26
|
- !ruby/object:Gem::Dependency
|
|
28
27
|
name: mocha
|
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -45,19 +44,21 @@ extensions: []
|
|
|
45
44
|
extra_rdoc_files: []
|
|
46
45
|
files:
|
|
47
46
|
- ".codeclimate.yml"
|
|
47
|
+
- ".github/workflows/ci.yml"
|
|
48
48
|
- ".gitignore"
|
|
49
49
|
- ".rubocop.yml"
|
|
50
|
-
- ".travis.yml"
|
|
51
50
|
- CHANGELOG.md
|
|
52
51
|
- Gemfile
|
|
53
52
|
- LICENSE.txt
|
|
54
53
|
- README.md
|
|
55
54
|
- Rakefile
|
|
56
55
|
- actionpack-page_caching.gemspec
|
|
57
|
-
- gemfiles/Gemfile-
|
|
58
|
-
- gemfiles/Gemfile-
|
|
59
|
-
- gemfiles/Gemfile-
|
|
60
|
-
- gemfiles/Gemfile-
|
|
56
|
+
- gemfiles/Gemfile-6-1-stable
|
|
57
|
+
- gemfiles/Gemfile-7-0-stable
|
|
58
|
+
- gemfiles/Gemfile-7-1-stable
|
|
59
|
+
- gemfiles/Gemfile-7-2-stable
|
|
60
|
+
- gemfiles/Gemfile-8-0-stable
|
|
61
|
+
- gemfiles/Gemfile-8-1-stable
|
|
61
62
|
- gemfiles/Gemfile-edge
|
|
62
63
|
- lib/action_controller/caching/pages.rb
|
|
63
64
|
- lib/action_controller/page_caching.rb
|
|
@@ -65,12 +66,11 @@ files:
|
|
|
65
66
|
- lib/actionpack/page_caching/railtie.rb
|
|
66
67
|
- test/abstract_unit.rb
|
|
67
68
|
- test/caching_test.rb
|
|
68
|
-
- test/
|
|
69
|
+
- test/instrumentation_test.rb
|
|
69
70
|
homepage: https://github.com/rails/actionpack-page_caching
|
|
70
71
|
licenses:
|
|
71
72
|
- MIT
|
|
72
73
|
metadata: {}
|
|
73
|
-
post_install_message:
|
|
74
74
|
rdoc_options: []
|
|
75
75
|
require_paths:
|
|
76
76
|
- lib
|
|
@@ -78,18 +78,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
78
78
|
requirements:
|
|
79
79
|
- - ">="
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
|
-
version:
|
|
81
|
+
version: 1.9.3
|
|
82
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
83
83
|
requirements:
|
|
84
84
|
- - ">="
|
|
85
85
|
- !ruby/object:Gem::Version
|
|
86
86
|
version: '0'
|
|
87
87
|
requirements: []
|
|
88
|
-
rubygems_version:
|
|
89
|
-
signing_key:
|
|
88
|
+
rubygems_version: 4.0.16
|
|
90
89
|
specification_version: 4
|
|
91
90
|
summary: Static page caching for Action Pack (removed from core in Rails 4.0)
|
|
92
91
|
test_files:
|
|
93
92
|
- test/abstract_unit.rb
|
|
94
93
|
- test/caching_test.rb
|
|
95
|
-
- test/
|
|
94
|
+
- test/instrumentation_test.rb
|
data/.travis.yml
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
sudo: false
|
|
3
|
-
|
|
4
|
-
cache:
|
|
5
|
-
bundler: true
|
|
6
|
-
|
|
7
|
-
before_install:
|
|
8
|
-
- gem install bundler
|
|
9
|
-
|
|
10
|
-
rvm:
|
|
11
|
-
- 2.4.6
|
|
12
|
-
- 2.5.5
|
|
13
|
-
- 2.6.3
|
|
14
|
-
|
|
15
|
-
gemfile:
|
|
16
|
-
- Gemfile
|
|
17
|
-
- gemfiles/Gemfile-5-0-stable
|
|
18
|
-
- gemfiles/Gemfile-5-1-stable
|
|
19
|
-
- gemfiles/Gemfile-5-2-stable
|
|
20
|
-
- gemfiles/Gemfile-6-0-stable
|
|
21
|
-
- gemfiles/Gemfile-edge
|
|
22
|
-
|
|
23
|
-
matrix:
|
|
24
|
-
allow_failures:
|
|
25
|
-
- gemfile: gemfiles/Gemfile-edge
|
|
26
|
-
exclude:
|
|
27
|
-
- rvm: 2.4.6
|
|
28
|
-
gemfile: gemfiles/Gemfile-6-0-stable
|
|
29
|
-
- rvm: 2.4.6
|
|
30
|
-
gemfile: gemfiles/Gemfile-edge
|
|
31
|
-
|
|
32
|
-
notifications:
|
|
33
|
-
email: false
|
|
34
|
-
irc:
|
|
35
|
-
on_success: change
|
|
36
|
-
on_failure: always
|
|
37
|
-
channels:
|
|
38
|
-
- "irc.freenode.org#rails-contrib"
|
|
39
|
-
campfire:
|
|
40
|
-
on_success: change
|
|
41
|
-
on_failure: always
|
|
42
|
-
rooms:
|
|
43
|
-
- secure: "eRCx+FMvH50pmLu0GZTF7NN+2X+CesgodYUlHvCr5EXQ0ZO/YUmeW8vAh/N8\njSrLWYpk/4P/JA63JGWsvFor/zpkTnfwzX3LWgw04GV0V3T9jsn9CD2Coiu6\nFll5u4fUCUwpfbB4RlCkjvFdQmW+F9mmbRGMCDO5CmuPHOyyPH0="
|
data/gemfiles/Gemfile-5-0-stable
DELETED
data/gemfiles/Gemfile-5-1-stable
DELETED
data/gemfiles/Gemfile-5-2-stable
DELETED
data/gemfiles/Gemfile-6-0-stable
DELETED
data/test/log_subscriber_test.rb
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
require "abstract_unit"
|
|
2
|
-
require "active_support/log_subscriber/test_helper"
|
|
3
|
-
require "action_controller/log_subscriber"
|
|
4
|
-
|
|
5
|
-
module Another
|
|
6
|
-
class LogSubscribersController < ActionController::Base
|
|
7
|
-
abstract!
|
|
8
|
-
|
|
9
|
-
self.perform_caching = true
|
|
10
|
-
|
|
11
|
-
def with_page_cache
|
|
12
|
-
cache_page("Super soaker", "/index.html")
|
|
13
|
-
head :ok
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
class ACLogSubscriberTest < ActionController::TestCase
|
|
19
|
-
tests Another::LogSubscribersController
|
|
20
|
-
include ActiveSupport::LogSubscriber::TestHelper
|
|
21
|
-
|
|
22
|
-
def setup
|
|
23
|
-
super
|
|
24
|
-
|
|
25
|
-
@routes = ActionDispatch::Routing::RouteSet.new
|
|
26
|
-
|
|
27
|
-
@cache_path = File.expand_path("../tmp/test_cache", __FILE__)
|
|
28
|
-
ActionController::Base.page_cache_directory = @cache_path
|
|
29
|
-
@controller.cache_store = :file_store, @cache_path
|
|
30
|
-
ActionController::LogSubscriber.attach_to :action_controller
|
|
31
|
-
end
|
|
32
|
-
|
|
33
|
-
def teardown
|
|
34
|
-
ActiveSupport::LogSubscriber.log_subscribers.clear
|
|
35
|
-
FileUtils.rm_rf(@cache_path)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def set_logger(logger)
|
|
39
|
-
ActionController::Base.logger = logger
|
|
40
|
-
end
|
|
41
|
-
|
|
42
|
-
def test_with_page_cache
|
|
43
|
-
with_routing do |set|
|
|
44
|
-
set.draw do
|
|
45
|
-
get "/with_page_cache", to: "another/log_subscribers#with_page_cache"
|
|
46
|
-
end
|
|
47
|
-
|
|
48
|
-
get :with_page_cache
|
|
49
|
-
wait
|
|
50
|
-
|
|
51
|
-
logs = @logger.logged(:info)
|
|
52
|
-
assert_equal 3, logs.size
|
|
53
|
-
assert_match(/Write page/, logs[1])
|
|
54
|
-
assert_match(/\/index\.html/, logs[1])
|
|
55
|
-
end
|
|
56
|
-
end
|
|
57
|
-
end
|