redirect-rails 0.3.1 → 0.3.4
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/.rubocop.yml +1 -1
- data/Gemfile +0 -2
- data/Gemfile.lock +198 -29
- data/lib/redirect/engine.rb +1 -0
- data/lib/redirect/middleware.rb +5 -5
- data/lib/redirect/rails/version.rb +1 -1
- data/lib/redirect/rails.rb +6 -3
- data/lib/redirect/tasks/redirect/tasks.rake +1 -1
- data/redirect-rails.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f8daaae55ea15a53bea6dac7a5699f7167414e6eec3ed0b64314f4aeac2e272
|
4
|
+
data.tar.gz: 48a60747d0a970f3e05d7e2bf445d62ebcd18b61baed41c43ea50ddec4a447a4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 79d86e2e879d8cd790df0e9e3cfdf8a593203f9c7981b73ac09b8e9ea11b4de466cb70a7ce0cb881287769d95b126d3e0990bf3b54189a933f9ceb1c2a283aa8
|
7
|
+
data.tar.gz: 65c91d8c654d2ee7ef3c13828280d921ff4ce29e83b6239dcd76f71389425d2e14a9c493f237eac921191a885f2bfd4b63a77dfdce99af7682dd8396d51625b9
|
data/.rubocop.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,48 +1,217 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
redirect-rails (0.
|
4
|
+
redirect-rails (0.3.3)
|
5
|
+
rails
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
8
9
|
specs:
|
10
|
+
actioncable (7.2.1.1)
|
11
|
+
actionpack (= 7.2.1.1)
|
12
|
+
activesupport (= 7.2.1.1)
|
13
|
+
nio4r (~> 2.0)
|
14
|
+
websocket-driver (>= 0.6.1)
|
15
|
+
zeitwerk (~> 2.6)
|
16
|
+
actionmailbox (7.2.1.1)
|
17
|
+
actionpack (= 7.2.1.1)
|
18
|
+
activejob (= 7.2.1.1)
|
19
|
+
activerecord (= 7.2.1.1)
|
20
|
+
activestorage (= 7.2.1.1)
|
21
|
+
activesupport (= 7.2.1.1)
|
22
|
+
mail (>= 2.8.0)
|
23
|
+
actionmailer (7.2.1.1)
|
24
|
+
actionpack (= 7.2.1.1)
|
25
|
+
actionview (= 7.2.1.1)
|
26
|
+
activejob (= 7.2.1.1)
|
27
|
+
activesupport (= 7.2.1.1)
|
28
|
+
mail (>= 2.8.0)
|
29
|
+
rails-dom-testing (~> 2.2)
|
30
|
+
actionpack (7.2.1.1)
|
31
|
+
actionview (= 7.2.1.1)
|
32
|
+
activesupport (= 7.2.1.1)
|
33
|
+
nokogiri (>= 1.8.5)
|
34
|
+
racc
|
35
|
+
rack (>= 2.2.4, < 3.2)
|
36
|
+
rack-session (>= 1.0.1)
|
37
|
+
rack-test (>= 0.6.3)
|
38
|
+
rails-dom-testing (~> 2.2)
|
39
|
+
rails-html-sanitizer (~> 1.6)
|
40
|
+
useragent (~> 0.16)
|
41
|
+
actiontext (7.2.1.1)
|
42
|
+
actionpack (= 7.2.1.1)
|
43
|
+
activerecord (= 7.2.1.1)
|
44
|
+
activestorage (= 7.2.1.1)
|
45
|
+
activesupport (= 7.2.1.1)
|
46
|
+
globalid (>= 0.6.0)
|
47
|
+
nokogiri (>= 1.8.5)
|
48
|
+
actionview (7.2.1.1)
|
49
|
+
activesupport (= 7.2.1.1)
|
50
|
+
builder (~> 3.1)
|
51
|
+
erubi (~> 1.11)
|
52
|
+
rails-dom-testing (~> 2.2)
|
53
|
+
rails-html-sanitizer (~> 1.6)
|
54
|
+
activejob (7.2.1.1)
|
55
|
+
activesupport (= 7.2.1.1)
|
56
|
+
globalid (>= 0.3.6)
|
57
|
+
activemodel (7.2.1.1)
|
58
|
+
activesupport (= 7.2.1.1)
|
59
|
+
activerecord (7.2.1.1)
|
60
|
+
activemodel (= 7.2.1.1)
|
61
|
+
activesupport (= 7.2.1.1)
|
62
|
+
timeout (>= 0.4.0)
|
63
|
+
activestorage (7.2.1.1)
|
64
|
+
actionpack (= 7.2.1.1)
|
65
|
+
activejob (= 7.2.1.1)
|
66
|
+
activerecord (= 7.2.1.1)
|
67
|
+
activesupport (= 7.2.1.1)
|
68
|
+
marcel (~> 1.0)
|
69
|
+
activesupport (7.2.1.1)
|
70
|
+
base64
|
71
|
+
bigdecimal
|
72
|
+
concurrent-ruby (~> 1.0, >= 1.3.1)
|
73
|
+
connection_pool (>= 2.2.5)
|
74
|
+
drb
|
75
|
+
i18n (>= 1.6, < 2)
|
76
|
+
logger (>= 1.4.2)
|
77
|
+
minitest (>= 5.1)
|
78
|
+
securerandom (>= 0.3)
|
79
|
+
tzinfo (~> 2.0, >= 2.0.5)
|
9
80
|
ast (2.4.2)
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
81
|
+
base64 (0.2.0)
|
82
|
+
bigdecimal (3.1.8)
|
83
|
+
builder (3.3.0)
|
84
|
+
concurrent-ruby (1.3.4)
|
85
|
+
connection_pool (2.4.1)
|
86
|
+
crass (1.0.6)
|
87
|
+
date (3.3.4)
|
88
|
+
diff-lcs (1.5.1)
|
89
|
+
drb (2.2.1)
|
90
|
+
erubi (1.13.0)
|
91
|
+
globalid (1.2.1)
|
92
|
+
activesupport (>= 6.1)
|
93
|
+
i18n (1.14.6)
|
94
|
+
concurrent-ruby (~> 1.0)
|
95
|
+
io-console (0.7.2)
|
96
|
+
irb (1.14.1)
|
97
|
+
rdoc (>= 4.0.0)
|
98
|
+
reline (>= 0.4.2)
|
99
|
+
json (2.7.2)
|
100
|
+
language_server-protocol (3.17.0.3)
|
101
|
+
logger (1.6.1)
|
102
|
+
loofah (2.22.0)
|
103
|
+
crass (~> 1.0.2)
|
104
|
+
nokogiri (>= 1.12.0)
|
105
|
+
mail (2.8.1)
|
106
|
+
mini_mime (>= 0.1.1)
|
107
|
+
net-imap
|
108
|
+
net-pop
|
109
|
+
net-smtp
|
110
|
+
marcel (1.0.4)
|
111
|
+
mini_mime (1.1.5)
|
112
|
+
minitest (5.25.1)
|
113
|
+
net-imap (0.5.0)
|
114
|
+
date
|
115
|
+
net-protocol
|
116
|
+
net-pop (0.1.2)
|
117
|
+
net-protocol
|
118
|
+
net-protocol (0.2.2)
|
119
|
+
timeout
|
120
|
+
net-smtp (0.5.0)
|
121
|
+
net-protocol
|
122
|
+
nio4r (2.7.3)
|
123
|
+
nokogiri (1.16.7-x86_64-linux)
|
124
|
+
racc (~> 1.4)
|
125
|
+
parallel (1.26.3)
|
126
|
+
parser (3.3.5.0)
|
14
127
|
ast (~> 2.4.1)
|
128
|
+
racc
|
129
|
+
psych (5.1.2)
|
130
|
+
stringio
|
131
|
+
racc (1.8.1)
|
132
|
+
rack (3.1.8)
|
133
|
+
rack-session (2.0.0)
|
134
|
+
rack (>= 3.0.0)
|
135
|
+
rack-test (2.1.0)
|
136
|
+
rack (>= 1.3)
|
137
|
+
rackup (2.1.0)
|
138
|
+
rack (>= 3)
|
139
|
+
webrick (~> 1.8)
|
140
|
+
rails (7.2.1.1)
|
141
|
+
actioncable (= 7.2.1.1)
|
142
|
+
actionmailbox (= 7.2.1.1)
|
143
|
+
actionmailer (= 7.2.1.1)
|
144
|
+
actionpack (= 7.2.1.1)
|
145
|
+
actiontext (= 7.2.1.1)
|
146
|
+
actionview (= 7.2.1.1)
|
147
|
+
activejob (= 7.2.1.1)
|
148
|
+
activemodel (= 7.2.1.1)
|
149
|
+
activerecord (= 7.2.1.1)
|
150
|
+
activestorage (= 7.2.1.1)
|
151
|
+
activesupport (= 7.2.1.1)
|
152
|
+
bundler (>= 1.15.0)
|
153
|
+
railties (= 7.2.1.1)
|
154
|
+
rails-dom-testing (2.2.0)
|
155
|
+
activesupport (>= 5.0.0)
|
156
|
+
minitest
|
157
|
+
nokogiri (>= 1.6)
|
158
|
+
rails-html-sanitizer (1.6.0)
|
159
|
+
loofah (~> 2.21)
|
160
|
+
nokogiri (~> 1.14)
|
161
|
+
railties (7.2.1.1)
|
162
|
+
actionpack (= 7.2.1.1)
|
163
|
+
activesupport (= 7.2.1.1)
|
164
|
+
irb (~> 1.13)
|
165
|
+
rackup (>= 1.0.0)
|
166
|
+
rake (>= 12.2)
|
167
|
+
thor (~> 1.0, >= 1.2.2)
|
168
|
+
zeitwerk (~> 2.6)
|
15
169
|
rainbow (3.1.1)
|
16
|
-
rake (13.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
rspec-
|
25
|
-
|
170
|
+
rake (13.2.1)
|
171
|
+
rdoc (6.7.0)
|
172
|
+
psych (>= 4.0.0)
|
173
|
+
regexp_parser (2.9.2)
|
174
|
+
reline (0.5.10)
|
175
|
+
io-console (~> 0.5)
|
176
|
+
rspec (3.13.0)
|
177
|
+
rspec-core (~> 3.13.0)
|
178
|
+
rspec-expectations (~> 3.13.0)
|
179
|
+
rspec-mocks (~> 3.13.0)
|
180
|
+
rspec-core (3.13.2)
|
181
|
+
rspec-support (~> 3.13.0)
|
182
|
+
rspec-expectations (3.13.3)
|
26
183
|
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
-
rspec-support (~> 3.
|
28
|
-
rspec-mocks (3.
|
184
|
+
rspec-support (~> 3.13.0)
|
185
|
+
rspec-mocks (3.13.2)
|
29
186
|
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
-
rspec-support (~> 3.
|
31
|
-
rspec-support (3.
|
32
|
-
rubocop (1.
|
187
|
+
rspec-support (~> 3.13.0)
|
188
|
+
rspec-support (3.13.1)
|
189
|
+
rubocop (1.67.0)
|
33
190
|
json (~> 2.3)
|
191
|
+
language_server-protocol (>= 3.17.0)
|
34
192
|
parallel (~> 1.10)
|
35
|
-
parser (>= 3.
|
193
|
+
parser (>= 3.3.0.2)
|
36
194
|
rainbow (>= 2.2.2, < 4.0)
|
37
|
-
regexp_parser (>=
|
38
|
-
|
39
|
-
rubocop-ast (>= 1.23.0, < 2.0)
|
195
|
+
regexp_parser (>= 2.4, < 3.0)
|
196
|
+
rubocop-ast (>= 1.32.2, < 2.0)
|
40
197
|
ruby-progressbar (~> 1.7)
|
41
|
-
unicode-display_width (>=
|
42
|
-
rubocop-ast (1.
|
43
|
-
parser (>= 3.
|
44
|
-
ruby-progressbar (1.
|
45
|
-
|
198
|
+
unicode-display_width (>= 2.4.0, < 3.0)
|
199
|
+
rubocop-ast (1.32.3)
|
200
|
+
parser (>= 3.3.1.0)
|
201
|
+
ruby-progressbar (1.13.0)
|
202
|
+
securerandom (0.3.1)
|
203
|
+
stringio (3.1.1)
|
204
|
+
thor (1.3.2)
|
205
|
+
timeout (0.4.1)
|
206
|
+
tzinfo (2.0.6)
|
207
|
+
concurrent-ruby (~> 1.0)
|
208
|
+
unicode-display_width (2.6.0)
|
209
|
+
useragent (0.16.10)
|
210
|
+
webrick (1.8.2)
|
211
|
+
websocket-driver (0.7.6)
|
212
|
+
websocket-extensions (>= 0.1.0)
|
213
|
+
websocket-extensions (0.1.5)
|
214
|
+
zeitwerk (2.7.1)
|
46
215
|
|
47
216
|
PLATFORMS
|
48
217
|
x86_64-linux
|
data/lib/redirect/engine.rb
CHANGED
data/lib/redirect/middleware.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module Redirect
|
4
|
+
# Redirect::Middleware
|
4
5
|
class Middleware
|
5
6
|
def initialize(app)
|
6
7
|
@app = app
|
@@ -8,7 +9,7 @@ module Redirect
|
|
8
9
|
|
9
10
|
def call(env)
|
10
11
|
@request = Rack::Request.new(env)
|
11
|
-
if url = redirect_url(@request.path) ||
|
12
|
+
if (url = redirect_url(@request.path) || redirect_host(@request.host))
|
12
13
|
redirect_to(url)
|
13
14
|
else
|
14
15
|
@app.call(env)
|
@@ -35,15 +36,14 @@ module Redirect
|
|
35
36
|
|
36
37
|
def redirect_to(uri)
|
37
38
|
headers = { "Location": uri,
|
38
|
-
"Content-Type": @request["Content-Type"],
|
39
39
|
"Pragma": "no-cache",
|
40
|
-
"Cache-Control": "no-cache; max-age=0"
|
41
|
-
|
40
|
+
"Cache-Control": "no-cache; max-age=0" }
|
41
|
+
headers["Content-Type"] = @request["Content-Type"] if @request.has_key?("Content-Type")
|
42
42
|
[302, headers, [redirect_message(uri)]]
|
43
43
|
end
|
44
44
|
|
45
45
|
def redirect_message(location)
|
46
|
-
%
|
46
|
+
%(Redirecting to <a href="#{location}">#{location}</a>)
|
47
47
|
end
|
48
48
|
end
|
49
49
|
end
|
data/lib/redirect/rails.rb
CHANGED
@@ -7,8 +7,11 @@ require_relative "engine"
|
|
7
7
|
require_relative "middleware"
|
8
8
|
|
9
9
|
module Redirect
|
10
|
+
# Redirect::Rails
|
10
11
|
module Rails
|
11
12
|
class Error < StandardError; end
|
13
|
+
|
14
|
+
# For rails task
|
12
15
|
class Railtie < ::Rails::Railtie
|
13
16
|
rake_tasks do
|
14
17
|
load "redirect/tasks/redirect/tasks.rake"
|
@@ -17,15 +20,15 @@ module Redirect
|
|
17
20
|
|
18
21
|
class << self
|
19
22
|
def root
|
20
|
-
File.expand_path
|
23
|
+
File.expand_path "../..", __dir__
|
21
24
|
end
|
22
25
|
|
23
26
|
def paths
|
24
|
-
YAML.safe_load(File.read(yaml_name))[
|
27
|
+
YAML.safe_load(File.read(yaml_name))["paths"]
|
25
28
|
end
|
26
29
|
|
27
30
|
def hosts
|
28
|
-
YAML.safe_load(File.read(yaml_name))[
|
31
|
+
YAML.safe_load(File.read(yaml_name))["hosts"]
|
29
32
|
end
|
30
33
|
|
31
34
|
def original_yaml_name
|
data/redirect-rails.gemspec
CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
|
|
12
12
|
spec.description = "List the correspondence of the paths you want to redirect in config/redirect.yml."
|
13
13
|
spec.homepage = "https://github.com/slidict/redirect-rails"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2.
|
15
|
+
spec.required_ruby_version = ">= 3.2.0"
|
16
16
|
|
17
17
|
spec.metadata["homepage_uri"] = spec.homepage
|
18
18
|
spec.metadata["source_code_uri"] = "https://github.com/slidict/redirect-rails"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redirect-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Yusuke
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -54,7 +54,7 @@ metadata:
|
|
54
54
|
homepage_uri: https://github.com/slidict/redirect-rails
|
55
55
|
source_code_uri: https://github.com/slidict/redirect-rails
|
56
56
|
changelog_uri: https://github.com/slidict/redirect-rails/releases
|
57
|
-
post_install_message:
|
57
|
+
post_install_message:
|
58
58
|
rdoc_options: []
|
59
59
|
require_paths:
|
60
60
|
- lib
|
@@ -62,15 +62,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
62
62
|
requirements:
|
63
63
|
- - ">="
|
64
64
|
- !ruby/object:Gem::Version
|
65
|
-
version: 2.
|
65
|
+
version: 3.2.0
|
66
66
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
67
67
|
requirements:
|
68
68
|
- - ">="
|
69
69
|
- !ruby/object:Gem::Version
|
70
70
|
version: '0'
|
71
71
|
requirements: []
|
72
|
-
rubygems_version: 3.5.
|
73
|
-
signing_key:
|
72
|
+
rubygems_version: 3.5.11
|
73
|
+
signing_key:
|
74
74
|
specification_version: 4
|
75
75
|
summary: Provide a routing table dedicated to redirect in rails.
|
76
76
|
test_files: []
|