sitemap_generator 7.0.2 → 7.0.3

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: 64e5f8cba69093d945ae1e54d6c89fb8da86367ce4bb08a55e19e3652da25cc4
4
- data.tar.gz: bc7f1dcf2f220d5ed0b8a53062df1411864fecf47fbaf5ed5de3743b099db65c
3
+ metadata.gz: 76768fc3383e6ec38752dd3373955432282793e507cc4683cb8ed0f8676d9861
4
+ data.tar.gz: a40040f7f4d6e7bf362c962bf243285aa6b72d3f20faef9ac031350d1369a9cc
5
5
  SHA512:
6
- metadata.gz: 10a915440acdf9c713f2ba8f5acf0306f88cf2ed898c5b213b6001dadf674e78e950c62aa54d84db91d7b292ccfac8df22b393f98749ed3af4acb6e78767c32e
7
- data.tar.gz: 1a0fa9ad0f5d374f423db19334498054b45d26e17696bb978ce42442ad7bdcf394305396e8a6252681cfe34ac543bcce92e76f1044b55206acbf565991e0015c
6
+ metadata.gz: 7252276ae78c1dc17ca8f9ec6605d29ffe8f9cc8aceb03c63240bc50a3f333b79da197465ca0632a8c10de1c02fcf290ff745dc6496bbdb19a5afb3f0e84c65e
7
+ data.tar.gz: a04d88fc32364ca8eb84e6d33ea960da53c21260ce65e2ac3ab907fcc196a685691ea84416e82813dfc03cb53d84440f9046cd364ffbc63d6fa0baf24ff2d0f1
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ ### 7.0.3
2
+
3
+ * **Regression fix:** Revert railtie enhancements (#478) that were unintentionally included in 7.0.2. Those changes introduced an `ArgumentError: Missing host to link to!` during `assets:precompile` and other Rails boot contexts where no host is configured (reported in [#488](https://github.com/kjvarga/sitemap_generator/issues/488)). The railtie is restored to its 7.0.1 behaviour: it loads rake tasks only. The enhancements will return in a future release with proper documentation and test coverage. [#489](https://github.com/kjvarga/sitemap_generator/pull/489)
4
+ * **Bugfix:** Restore sitemap generation on Ruby 2.x when `--enable=frozen-string-literal` is set globally. Ruby 2.6/2.7 freezes interpolated heredocs under that flag, causing `gsub!` to raise `FrozenError`. [#486](https://github.com/kjvarga/sitemap_generator/pull/486)
5
+ * Internal: skip duplicate git tag creation in the release task if the tag already points at HEAD.
6
+
1
7
  ### 7.0.2
2
8
 
3
9
  * Reduce string copies and improve compatibility with `frozen_string_literal`. [#456](https://github.com/kjvarga/sitemap_generator/pull/456)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 7.0.2
1
+ 7.0.3
@@ -26,7 +26,10 @@ module SitemapGenerator
26
26
  @location = opts.is_a?(Hash) ? SitemapGenerator::SitemapLocation.new(opts) : opts
27
27
  @link_count = 0
28
28
  @news_count = 0
29
- @xml_wrapper_start = <<-HTML
29
+ # The + prefix makes this string explicitly mutable. Ruby 2.x with
30
+ # --enable=frozen-string-literal freezes interpolated heredocs, and
31
+ # gsub! below requires a mutable string.
32
+ @xml_wrapper_start = +<<-HTML
30
33
  <?xml version="1.0" encoding="UTF-8"?>
31
34
  <urlset
32
35
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
@@ -12,6 +12,9 @@ module SitemapGenerator
12
12
  @location = opts.is_a?(Hash) ? SitemapGenerator::SitemapIndexLocation.new(opts) : opts
13
13
  @link_count = 0
14
14
  @sitemaps_link_count = 0
15
+ # The + prefix makes this string explicitly mutable. Ruby 2.x with
16
+ # --enable=frozen-string-literal freezes interpolated heredocs, and
17
+ # gsub! below requires a mutable string.
15
18
  @xml_wrapper_start = +<<-HTML
16
19
  <?xml version="1.0" encoding="UTF-8"?>
17
20
  <sitemapindex
@@ -2,60 +2,8 @@
2
2
 
3
3
  module SitemapGenerator
4
4
  class Railtie < Rails::Railtie
5
- # Top level options object to namespace all settings
6
- config.sitemap = ActiveSupport::OrderedOptions.new
7
-
8
5
  rake_tasks do
9
6
  load 'tasks/sitemap_generator_tasks.rake'
10
7
  end
11
-
12
- # Recognize existing Rails options as defaults for config.sitemap.*
13
- initializer 'sitemap_generator.set_configs' do |app|
14
- # routes.default_url_options takes precedence, falling back to configs
15
- url_opts = (app.default_url_options || {})
16
- .with_defaults(config.try(:action_controller).try(:default_url_options) || {})
17
- .with_defaults(config.try(:action_mailer).try(:default_url_options) || {})
18
- .with_defaults(config.try(:active_job).try(:default_url_options) || {})
19
-
20
- config.sitemap.default_host ||= ActionDispatch::Http::URL.full_url_for(url_opts) if url_opts.key?(:host)
21
-
22
- # Rails defaults action_controller.asset_host and action_mailer.asset_host
23
- # to the top-level config.asset_host so we get that for free here.
24
- config.sitemap.sitemaps_host ||= [
25
- config.try(:action_controller).try(:asset_host),
26
- config.try(:action_mailer).try(:asset_host)
27
- ].grep(String).first
28
-
29
- config.sitemap.compress = config.try(:assets).try(:gzip) if config.sitemap.compress.nil?
30
-
31
- config.sitemap.public_path ||= app.paths['public'].first
32
-
33
- # "Compile" config.sitemap options onto the Sitemap class.
34
- config.after_initialize do
35
- ActiveSupport.on_load(:sitemap_generator, yield: true) do |sitemap|
36
- config.sitemap.except(:adapter).each { |k, v| sitemap.public_send("#{k}=", v) }
37
- end
38
- end
39
- end
40
-
41
- # Allow setting the CONFIG_FILE without relying on env var;
42
- # (e.g in config/application or environments/*.rb)
43
- initializer 'sitemap_generator.config_file' do
44
- if (config_file = config.sitemap.delete(:config_file).presence) && ENV['CONFIG_FILE'].blank?
45
- ENV['CONFIG_FILE'] = config_file
46
- end
47
- end
48
-
49
- # Allow lazily setting the adapter class without forcing an autoload.
50
- # (ie. string or symbol name; or Callable (proc/lambda/etc))
51
- initializer 'sitemap_generator.adapter' do |app|
52
- config.to_prepare do
53
- ActiveSupport.on_load(:sitemap_generator) do
54
- self.adapter = Utilities.find_adapter app.config.sitemap.adapter
55
- end
56
- end
57
- end
58
8
  end
59
-
60
- ActiveSupport.run_load_hooks(:sitemap_generator, Sitemap)
61
9
  end
@@ -180,29 +180,5 @@ module SitemapGenerator
180
180
  def bytesize(string)
181
181
  string.respond_to?(:bytesize) ? string.bytesize : string.length
182
182
  end
183
-
184
- # Looks up an adapter from various sources:
185
- # 1. symbol/string names are camelized and constantized
186
- # - :fog becomes SitemapGenerator::FogAdapter
187
- # - 'external/adapter_class' becomes External::AdapterClass
188
- # 2. classes are instantiated
189
- # 3. callables (procs, lambdas, #call) are "called"
190
- # All steps recurse, so a proc could return a string that names a class that is instantiated.
191
- #
192
- # This method is used by the Rails railtie and as such,
193
- # safely depends on ActiveSupport::Inflector.
194
- def find_adapter(candidate)
195
- if candidate.is_a?(Symbol) || candidate.is_a?(String)
196
- candidate.to_s.camelize.then { |name|
197
- "SitemapGenerator::#{name}Adapter".safe_constantize || name.safe_constantize
198
- }.then { |c| find_adapter(c) }
199
- elsif candidate.respond_to?(:new)
200
- find_adapter candidate.new
201
- elsif candidate.respond_to?(:call)
202
- find_adapter candidate.call
203
- else
204
- candidate
205
- end
206
- end
207
183
  end
208
184
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitemap_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.2
4
+ version: 7.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Karl Varga
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-06-29 00:00:00.000000000 Z
11
+ date: 2026-07-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: builder