sitemap_generator-cache_adapter 1.0.0 → 1.1.0

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: febec451f961b8b328763defdc44cb4b1cc9c2d294ef2f9979f479c04b5b0d40
4
- data.tar.gz: 85f82fd0768b2f4e1d86c8304f50ab2b529c2aea9901bf52981f970102255eef
3
+ metadata.gz: 46eb1cee35957f7b3adee339003753db7b8249ffbd72fa9edf05d19d1f7cfb7a
4
+ data.tar.gz: d197c7707631130dcb7768e29288e8243b57b65c2ea9b4a0f494127b5c418c52
5
5
  SHA512:
6
- metadata.gz: 9bc7e95fad17474e16acb7975c1e5a1ed4d2298ac5af25609e05b677aea4476a2b8975b42b61d8a8faba8408d7e57f6df2fd681933a3757f97701b777fbc569c
7
- data.tar.gz: 5290c796fc45b8a71a9a6828d5da2b6985fed371b903f43f8754f90db91121741f49098b5be3c166ac190e2388ed175ce9c8526c7e4df9985811091631bc842f
6
+ metadata.gz: 87accb0207d2d2b23f285f5a290b620164906b9a20096a8ccffa586ed138121dfdec59e3a61e41d0a45a5ab128bcf3d5cb79261708ccf874e9ba894bfe48ee4d
7
+ data.tar.gz: c759901e01c9b84c05e29bfea435493f38abde4048c63d912a621f1bf0211575a2bac750c534d3df784d0744b642f241e607d235b49aa7e01d552cbe8822a5fa
data/CHANGELOG.md CHANGED
@@ -5,7 +5,21 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
- ## [1.0.0] - 2026-01-09
8
+ ## [1.1.0] - 2026-09-22
9
+
10
+ ### Changed
11
+
12
+ - Allow sitemap_generator 7.x (`>= 6.0, < 8`). The `~> 6.0` constraint forced apps using this adapter back to sitemap_generator 6.3.0. The adapter's `write(location, raw_data)` interface is unchanged in 7.x, and the specs plus an end-to-end `LinkSet#create` pass against 7.1.1.
13
+ - Run CI on Ruby 4.0 as well.
14
+
15
+ ## [1.0.1] - 2026-01-10
16
+
17
+ ### Fixed
18
+
19
+ - Use pessimistic version constraint (`~> 6.0`) for sitemap_generator dependency
20
+ - Remove duplicate homepage_uri metadata
21
+
22
+ ## [1.0.0] - 2026-01-10
9
23
 
10
24
  ### Added
11
25
 
data/README.md CHANGED
@@ -50,7 +50,9 @@ SitemapGenerator::Sitemap.create do
50
50
  end
51
51
  ```
52
52
 
53
- ### Serving Sitemaps
53
+ ### Serving Sitemaps (Single File)
54
+
55
+ For most sites, a single sitemap file is sufficient (up to 50,000 URLs).
54
56
 
55
57
  Create a controller to serve sitemaps from the cache:
56
58
 
@@ -59,8 +61,9 @@ Create a controller to serve sitemaps from the cache:
59
61
  class SitemapsController < ApplicationController
60
62
  def show
61
63
  xml = SitemapGenerator::CacheAdapter.fetch("sitemap.xml") do
62
- # This block runs on cache miss - generates and caches the sitemap
63
- SitemapGenerator::Sitemap.create
64
+ # Load the sitemap config, which runs create and caches the result
65
+ load Rails.root.join("config", "sitemap.rb")
66
+ SitemapGenerator::Sitemap.ping_search_engines # Optional
64
67
  end
65
68
 
66
69
  if xml.present?
@@ -79,6 +82,62 @@ Add the route:
79
82
  get "sitemap.xml", to: "sitemaps#show", defaults: { format: :xml }
80
83
  ```
81
84
 
85
+ **Note**: Loading `config/sitemap.rb` executes the entire file, including the `create` block. This is how sitemap_generator is designed to work.
86
+
87
+ ### Serving Sitemaps (Multiple Files)
88
+
89
+ For large sites with more than 50,000 URLs, sitemap_generator creates multiple files with an index:
90
+
91
+ ```ruby
92
+ # config/sitemap.rb
93
+ SitemapGenerator::Sitemap.default_host = "https://example.com"
94
+ SitemapGenerator::Sitemap.adapter = SitemapGenerator::CacheAdapter.new
95
+ SitemapGenerator::Sitemap.compress = false
96
+ # Don't set create_index = false
97
+
98
+ SitemapGenerator::Sitemap.create do
99
+ # Your URLs here - will be split across multiple files if needed
100
+ end
101
+ ```
102
+
103
+ Update the controller to serve any sitemap file:
104
+
105
+ ```ruby
106
+ # app/controllers/sitemaps_controller.rb
107
+ class SitemapsController < ApplicationController
108
+ def show
109
+ filename = if params[:id].present?
110
+ "sitemap#{params[:id]}.xml"
111
+ else
112
+ "sitemap.xml"
113
+ end
114
+
115
+ xml = SitemapGenerator::CacheAdapter.fetch(filename) do
116
+ load Rails.root.join("config", "sitemap.rb")
117
+ SitemapGenerator::Sitemap.ping_search_engines
118
+ end
119
+
120
+ if xml.present?
121
+ render xml: xml
122
+ else
123
+ head :not_found
124
+ end
125
+ end
126
+ end
127
+ ```
128
+
129
+ Update the routes:
130
+
131
+ ```ruby
132
+ # config/routes.rb
133
+ get "sitemap.xml", to: "sitemaps#show", defaults: { format: :xml }
134
+ get "sitemap:id.xml", to: "sitemaps#show", defaults: { format: :xml }, constraints: { id: /[0-9]+/ }
135
+ ```
136
+
137
+ This serves:
138
+ - `/sitemap.xml` - The sitemap index
139
+ - `/sitemap1.xml`, `/sitemap2.xml`, etc. - Individual sitemap files
140
+
82
141
  ### Configuration Options
83
142
 
84
143
  ```ruby
@@ -2,6 +2,6 @@
2
2
 
3
3
  module SitemapGenerator
4
4
  class CacheAdapter
5
- VERSION = "1.0.0"
5
+ VERSION = "1.1.0"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sitemap_generator-cache_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steve Hill
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-01-10 00:00:00.000000000 Z
11
+ date: 2026-09-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sitemap_generator
@@ -17,6 +17,9 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '6.0'
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '8'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -24,6 +27,9 @@ dependencies:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
29
  version: '6.0'
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '8'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rake
29
35
  requirement: !ruby/object:Gem::Requirement
@@ -88,7 +94,6 @@ homepage: https://github.com/stevehill1981/sitemap_generator-cache_adapter
88
94
  licenses:
89
95
  - MIT
90
96
  metadata:
91
- homepage_uri: https://github.com/stevehill1981/sitemap_generator-cache_adapter
92
97
  source_code_uri: https://github.com/stevehill1981/sitemap_generator-cache_adapter
93
98
  changelog_uri: https://github.com/stevehill1981/sitemap_generator-cache_adapter/blob/main/CHANGELOG.md
94
99
  rubygems_mfa_required: 'true'