sitemap_generator 7.0.1 → 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 +4 -4
- data/CHANGES.md +10 -0
- data/VERSION +1 -1
- data/lib/sitemap_generator/adapters/aws_sdk_adapter.rb +19 -6
- data/lib/sitemap_generator/builder/sitemap_file.rb +7 -3
- data/lib/sitemap_generator/builder/sitemap_index_file.rb +4 -1
- data/lib/sitemap_generator/tasks.rb +8 -22
- data/lib/sitemap_generator/utilities.rb +3 -3
- data/lib/sitemap_generator.rb +11 -8
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 76768fc3383e6ec38752dd3373955432282793e507cc4683cb8ed0f8676d9861
|
|
4
|
+
data.tar.gz: a40040f7f4d6e7bf362c962bf243285aa6b72d3f20faef9ac031350d1369a9cc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7252276ae78c1dc17ca8f9ec6605d29ffe8f9cc8aceb03c63240bc50a3f333b79da197465ca0632a8c10de1c02fcf290ff745dc6496bbdb19a5afb3f0e84c65e
|
|
7
|
+
data.tar.gz: a04d88fc32364ca8eb84e6d33ea960da53c21260ce65e2ac3ab907fcc196a685691ea84416e82813dfc03cb53d84440f9046cd364ffbc63d6fa0baf24ff2d0f1
|
data/CHANGES.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
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
|
+
|
|
7
|
+
### 7.0.2
|
|
8
|
+
|
|
9
|
+
* Reduce string copies and improve compatibility with `frozen_string_literal`. [#456](https://github.com/kjvarga/sitemap_generator/pull/456)
|
|
10
|
+
|
|
1
11
|
### 7.0.1
|
|
2
12
|
|
|
3
13
|
* **Breaking:** Default search engines list is empty. `rake sitemap:refresh` and `ping_search_engines` perform no HTTP pings unless you configure engine URLs on `search_engines` or pass them into `ping_search_engines` (Google’s ping endpoint is deprecated upstream). [#444](https://github.com/kjvarga/sitemap_generator/pull/444)
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
7.0.
|
|
1
|
+
7.0.3
|
|
@@ -44,12 +44,25 @@ module SitemapGenerator
|
|
|
44
44
|
# Call with a SitemapLocation and string data
|
|
45
45
|
def write(location, raw_data)
|
|
46
46
|
SitemapGenerator::FileAdapter.new.write(location, raw_data)
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
47
|
+
|
|
48
|
+
if defined?(Aws::S3::TransferManager)
|
|
49
|
+
client = Aws::S3::Client.new(@options)
|
|
50
|
+
transfer_manager = Aws::S3::TransferManager.new(client: client)
|
|
51
|
+
transfer_manager.upload_file(location.path,
|
|
52
|
+
bucket: @bucket,
|
|
53
|
+
key: location.path_in_public,
|
|
54
|
+
acl: @acl,
|
|
55
|
+
cache_control: @cache_control,
|
|
56
|
+
content_type: location[:compress] ? 'application/x-gzip' : 'application/xml'
|
|
57
|
+
)
|
|
58
|
+
else
|
|
59
|
+
s3_object = s3_resource.bucket(@bucket).object(location.path_in_public)
|
|
60
|
+
s3_object.upload_file(location.path, {
|
|
61
|
+
acl: @acl,
|
|
62
|
+
cache_control: @cache_control,
|
|
63
|
+
content_type: location[:compress] ? 'application/x-gzip' : 'application/xml'
|
|
64
|
+
}.compact)
|
|
65
|
+
end
|
|
53
66
|
end
|
|
54
67
|
|
|
55
68
|
private
|
|
@@ -26,7 +26,9 @@ 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
|
-
|
|
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.
|
|
30
32
|
@xml_wrapper_start = +<<-HTML
|
|
31
33
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
32
34
|
<urlset
|
|
@@ -45,6 +47,7 @@ module SitemapGenerator
|
|
|
45
47
|
@xml_wrapper_start.gsub!(/\s+/, ' ').gsub!(/ *> */, '>').strip!
|
|
46
48
|
@xml_wrapper_end = '</urlset>'
|
|
47
49
|
@filesize = SitemapGenerator::Utilities.bytesize(@xml_wrapper_start) + SitemapGenerator::Utilities.bytesize(@xml_wrapper_end)
|
|
50
|
+
@xml_content = @xml_wrapper_start
|
|
48
51
|
@written = false
|
|
49
52
|
@reserved_name = nil # holds the name reserved from the namer
|
|
50
53
|
@frozen = false # rather than actually freeze, use this boolean
|
|
@@ -141,8 +144,9 @@ module SitemapGenerator
|
|
|
141
144
|
|
|
142
145
|
finalize! unless finalized?
|
|
143
146
|
reserve_name
|
|
144
|
-
@
|
|
145
|
-
@xml_content
|
|
147
|
+
@xml_content << @xml_wrapper_end
|
|
148
|
+
@location.write(@xml_content, link_count)
|
|
149
|
+
@xml_content = @xml_wrapper_end = ''
|
|
146
150
|
@written = true
|
|
147
151
|
end
|
|
148
152
|
|
|
@@ -12,7 +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
|
-
|
|
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.
|
|
16
18
|
@xml_wrapper_start = +<<-HTML
|
|
17
19
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
18
20
|
<sitemapindex
|
|
@@ -25,6 +27,7 @@ module SitemapGenerator
|
|
|
25
27
|
@xml_wrapper_start.gsub!(/\s+/, ' ').gsub!(/ *> */, '>').strip!
|
|
26
28
|
@xml_wrapper_end = '</sitemapindex>'
|
|
27
29
|
@filesize = SitemapGenerator::Utilities.bytesize(@xml_wrapper_start) + SitemapGenerator::Utilities.bytesize(@xml_wrapper_end)
|
|
30
|
+
@xml_content = @xml_wrapper_start
|
|
28
31
|
@written = false
|
|
29
32
|
@reserved_name = nil # holds the name reserved from the namer
|
|
30
33
|
@frozen = false # rather than actually freeze, use this boolean
|
|
@@ -10,46 +10,32 @@ namespace :sitemap do
|
|
|
10
10
|
# Require sitemap_generator only. When installed as a plugin the require will fail, so in
|
|
11
11
|
# that case, load the environment first.
|
|
12
12
|
task :require do
|
|
13
|
-
begin
|
|
14
|
-
require 'sitemap_generator'
|
|
15
|
-
rescue LoadError => e
|
|
16
|
-
if defined?(Rails::VERSION)
|
|
17
|
-
Rake::Task['sitemap:require_environment'].invoke
|
|
18
|
-
else
|
|
19
|
-
raise e
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
|
|
24
|
-
# Require sitemap_generator after loading the Rails environment. We still need the require
|
|
25
|
-
# in case we are installed as a gem and are setup to not automatically be required.
|
|
26
|
-
task :require_environment do
|
|
27
|
-
if defined?(Rails::VERSION)
|
|
28
|
-
Rake::Task['environment'].invoke
|
|
29
|
-
end
|
|
30
13
|
require 'sitemap_generator'
|
|
31
14
|
end
|
|
15
|
+
# In a Rails app, we need to boot Rails.
|
|
16
|
+
# Ensure gem is required in case it wasn't automatically loaded.
|
|
17
|
+
Rake::Task[:require].enhance([:environment]) if defined?(Rails)
|
|
32
18
|
|
|
33
19
|
desc 'Install a default config/sitemap.rb file'
|
|
34
|
-
task install:
|
|
20
|
+
task install: :require do
|
|
35
21
|
SitemapGenerator::Utilities.install_sitemap_rb(verbose)
|
|
36
22
|
end
|
|
37
23
|
|
|
38
24
|
desc 'Delete all Sitemap files in public/ directory'
|
|
39
|
-
task clean:
|
|
25
|
+
task clean: :require do
|
|
40
26
|
SitemapGenerator::Utilities.clean_files
|
|
41
27
|
end
|
|
42
28
|
|
|
43
29
|
desc 'Generate sitemaps and ping search engines.'
|
|
44
|
-
task refresh:
|
|
30
|
+
task refresh: :create do
|
|
45
31
|
SitemapGenerator::Sitemap.ping_search_engines
|
|
46
32
|
end
|
|
47
33
|
|
|
48
34
|
desc "Generate sitemaps but don't ping search engines."
|
|
49
|
-
task 'refresh:no_ping' =>
|
|
35
|
+
task 'refresh:no_ping' => :create
|
|
50
36
|
|
|
51
37
|
desc "Generate sitemaps but don't ping search engines. Alias for refresh:no_ping."
|
|
52
|
-
task create:
|
|
38
|
+
task create: :require do
|
|
53
39
|
SitemapGenerator::Interpreter.run(config_file: ENV['CONFIG_FILE'], verbose: verbose)
|
|
54
40
|
end
|
|
55
41
|
end
|
|
@@ -142,9 +142,9 @@ module SitemapGenerator
|
|
|
142
142
|
end
|
|
143
143
|
|
|
144
144
|
def titleize(string)
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
145
|
+
result = string.tr('_', ' ')
|
|
146
|
+
result.gsub!(/\b\w/) { |match| match.upcase }
|
|
147
|
+
result
|
|
148
148
|
end
|
|
149
149
|
|
|
150
150
|
def truthy?(value)
|
data/lib/sitemap_generator.rb
CHANGED
|
@@ -40,18 +40,21 @@ module SitemapGenerator
|
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
# Lazy-initialize the LinkSet instance
|
|
43
|
-
Sitemap = (Class.new do
|
|
44
|
-
|
|
45
|
-
|
|
43
|
+
Sitemap = (Config = Class.new do
|
|
44
|
+
# Use a new LinkSet instance
|
|
45
|
+
def reset!
|
|
46
|
+
@link_set = LinkSet.new
|
|
46
47
|
end
|
|
47
48
|
|
|
48
|
-
|
|
49
|
-
|
|
49
|
+
private
|
|
50
|
+
|
|
51
|
+
def method_missing(name, *args, &block)
|
|
52
|
+
@link_set ||= reset!
|
|
53
|
+
@link_set.respond_to?(name, true) ? @link_set.__send__(name, *args, &block) : super
|
|
50
54
|
end
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
@link_set = LinkSet.new
|
|
56
|
+
def respond_to_missing?(name, include_private = false)
|
|
57
|
+
(@link_set ||= reset!).respond_to?(name, include_private) || super
|
|
55
58
|
end
|
|
56
59
|
end).new
|
|
57
60
|
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.
|
|
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-
|
|
11
|
+
date: 2026-07-02 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: builder
|
|
@@ -82,7 +82,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
82
82
|
requirements:
|
|
83
83
|
- - ">="
|
|
84
84
|
- !ruby/object:Gem::Version
|
|
85
|
-
version: '
|
|
85
|
+
version: '2.6'
|
|
86
86
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
87
|
requirements:
|
|
88
88
|
- - ">="
|