tanshuku 4.0.0 → 4.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60ef893ce52de6a2a3e9c76b217ec13fc11faa6aac8ddac739205dcf9336fdde
4
- data.tar.gz: e764fe77479fb67ebd3a592525a442654c1ffe0e57e01f46a28710989c7a4fd7
3
+ metadata.gz: ceb5303a7a452e3b70b9d8c1873b627096804691a11388d59a7e79ed19192111
4
+ data.tar.gz: 52d0b5ecb461972537aaa8998d60306a76f85327a8fa72f400fa7376e9fa2877
5
5
  SHA512:
6
- metadata.gz: c4e7d22a8d8572a6ed2473f94eb1e659cb853b1b204c6aa6f199710228bafe190ff20761b60c2d27547dfae291ffe55c7f4e38ecd56678d3984e2f82a1590f4f
7
- data.tar.gz: b373b1c24e1f6746de4003f394d583c9ed4a91256f90e34237a1db8ea1a590a63041c639e34f90b155cc36568e755dd1c3be773999283af2c52ae15a48940722
6
+ metadata.gz: 5e1906a0852e7e982473a38fce39d49fc0ca8673e39ba17b906afe0bec0e27691f0e62e7f4a755507c4431d0baf9862cca089134ffab8cd3dca714df02af5b9e
7
+ data.tar.gz: 9971952c5f6f59e62a8b0a1773297b224447fcf52abdd55ba28a1b64b8a3396bf01e848bf30107e5a1e4f24e1d808ffb06f421ea08acf1d673667dd42ae59d13
@@ -167,6 +167,10 @@ module Tanshuku
167
167
  # @param url_options [Hash] An option for Rails’ +url_for+.
168
168
  #
169
169
  # @return [String] A shortened URL.
170
+ #
171
+ # @note
172
+ # In Rails 8.0 or later, this method loads the routes before calling +url_for+ as Tanshuku depends on them.
173
+ # cf. https://github.com/rails/rails/pull/52353
170
174
  def shortened_url(url_options = {})
171
175
  url_options = url_options.symbolize_keys
172
176
  url_options[:controller] = "tanshuku/urls"
@@ -175,6 +179,25 @@ module Tanshuku
175
179
 
176
180
  Tanshuku::Engine.routes.url_for(url_options)
177
181
  end
182
+
183
+ case Gem::Version.new(Rails.version)
184
+ when "7.0"..."8.0"
185
+ # Don’t define `#shortened_url` in this branch because YARD doesn’t recognize the method.
186
+ else
187
+ # Overwrite the `#shortened_url` in Rails 8.0 or later.
188
+ # rubocop:disable Lint/DuplicateMethods
189
+ def shortened_url(url_options = {})
190
+ Rails.application.reload_routes_unless_loaded
191
+
192
+ url_options = url_options.symbolize_keys
193
+ url_options[:controller] = "tanshuku/urls"
194
+ url_options[:action] = :show
195
+ url_options[:key] = key
196
+
197
+ Tanshuku::Engine.routes.url_for(url_options)
198
+ end
199
+ # rubocop:enable Lint/DuplicateMethods
200
+ end
178
201
  end
179
202
  # rubocop:enable Rails/ApplicationRecord
180
203
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Tanshuku
4
- VERSION = "4.0.0"
4
+ VERSION = "4.0.1"
5
5
  end
@@ -33,7 +33,7 @@ class CheckAll
33
33
  lambda do |taskname|
34
34
  command = "bundle exec rake #{taskname}"
35
35
 
36
- outputs = []
36
+ outputs = [] #: Array[String]
37
37
  outputs << format(TITLE_TEMPLATE, command:)
38
38
 
39
39
  # Use `PTY.spawn` to get colorized outputs of each command.
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tanshuku
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0
4
+ version: 4.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kg8m
8
- autorequire:
9
8
  bindir: bin
10
9
  cert_chain: []
11
- date: 2024-11-16 00:00:00.000000000 Z
10
+ date: 2024-12-28 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: addressable
@@ -16,28 +15,28 @@ dependencies:
16
15
  requirements:
17
16
  - - ">="
18
17
  - !ruby/object:Gem::Version
19
- version: 2.4.0
18
+ version: '2.4'
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: 2.4.0
25
+ version: '2.4'
27
26
  - !ruby/object:Gem::Dependency
28
27
  name: rails
29
28
  requirement: !ruby/object:Gem::Requirement
30
29
  requirements:
31
30
  - - ">="
32
31
  - !ruby/object:Gem::Version
33
- version: 7.0.0
32
+ version: '7.0'
34
33
  type: :runtime
35
34
  prerelease: false
36
35
  version_requirements: !ruby/object:Gem::Requirement
37
36
  requirements:
38
37
  - - ">="
39
38
  - !ruby/object:Gem::Version
40
- version: 7.0.0
39
+ version: '7.0'
41
40
  description: Tanshuku is a simple and performance aware Rails engine for shortening
42
41
  URLs. Tanshuku generates a shortened URL per a normalized original URL. Tanshuku
43
42
  redirects from a shortened URL to its corresponding original URL.
@@ -80,7 +79,6 @@ metadata:
80
79
  changelog_uri: https://github.com/kg8m/tanshuku/releases
81
80
  documentation_uri: https://kg8m.github.io/tanshuku/
82
81
  rubygems_mfa_required: 'true'
83
- post_install_message:
84
82
  rdoc_options: []
85
83
  require_paths:
86
84
  - lib
@@ -95,8 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
95
93
  - !ruby/object:Gem::Version
96
94
  version: '0'
97
95
  requirements: []
98
- rubygems_version: 3.5.22
99
- signing_key:
96
+ rubygems_version: 3.6.2
100
97
  specification_version: 4
101
98
  summary: Tanshuku is a simple and performance aware Rails engine for shortening URLs.
102
99
  test_files: []