indexmap 0.7.0 → 0.8.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 +4 -4
- data/CHANGELOG.md +129 -1
- data/README.md +47 -78
- data/lib/indexmap/creator.rb +1 -1
- data/lib/indexmap/entry.rb +1 -1
- data/lib/indexmap/parser.rb +1 -1
- data/lib/indexmap/railtie.rb +1 -1
- data/lib/indexmap/section.rb +1 -1
- data/lib/indexmap/storage/file.rb +1 -1
- data/lib/indexmap/task_runner.rb +28 -1
- data/lib/indexmap/tasks.rb +8 -0
- data/lib/indexmap/version.rb +1 -1
- data/lib/indexmap.rb +5 -2
- data/lib/tasks/indexmap_tasks.rake +9 -1
- data/test/indexmap/lazy_loading_test.rb +42 -0
- data/test/indexmap/task_runner_test.rb +13 -1
- data/test/release_task_test.rb +86 -0
- metadata +5 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7e1e66f1d2afc109e4475d63d4c24c4e66d4da6a50e729b1f67f325bf729b792
|
|
4
|
+
data.tar.gz: ce2d2d9f892c510b337e7c2155cc304044a9182722588172456c82b737e196d3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0ad6376f15ef8e5f734c952ae209b472cdefeeb195c641c05e84413f58a3f699f33a8dd6145d661df14c3603fa26268829fae0028da66496bc222f85a3a3c21b
|
|
7
|
+
data.tar.gz: 2a1c8520caabe2cd2650dda8fd62e77fb9a3a55f85d508b38eb2529d1a658701c15fb65a168e65d278587b55ecbeae15d6bba929b17a1d1855dace51e6d205cd
|
data/CHANGELOG.md
CHANGED
|
@@ -5,12 +5,140 @@ 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
|
+
## [0.8.0] - 2026-07-21
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Added
|
|
12
|
+
|
|
13
|
+
- harden git commit ([#15](https://github.com/ethos-link/indexmap/pull/15))
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### Changed
|
|
19
|
+
|
|
20
|
+
- lazy load search console dependencies ([#16](https://github.com/ethos-link/indexmap/pull/16))
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
## [0.7.1] - 2026-05-31
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
### Documentation
|
|
28
|
+
|
|
29
|
+
- document google search console credentials
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
### Fixed
|
|
35
|
+
|
|
36
|
+
- preserve release changelog history ([#13](https://github.com/ethos-link/indexmap/pull/13))
|
|
37
|
+
|
|
38
|
+
- improve sitemap create output ([#14](https://github.com/ethos-link/indexmap/pull/14))
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
8
42
|
## [0.7.0] - 2026-05-08
|
|
9
43
|
|
|
10
44
|
|
|
11
45
|
### Fixed
|
|
12
46
|
|
|
13
|
-
- avoid rewriting existing IndexNow key files (#11)
|
|
47
|
+
- avoid rewriting existing IndexNow key files ([#11](https://github.com/ethos-link/indexmap/pull/11))
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
## [0.6.0] - 2026-05-01
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- add the url count to google ping output ([#9](https://github.com/ethos-link/indexmap/pull/9))
|
|
57
|
+
|
|
58
|
+
- support named sitemap outputs ([#10](https://github.com/ethos-link/indexmap/pull/10))
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
## [0.5.0] - 2026-04-24
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
### Fixed
|
|
66
|
+
|
|
67
|
+
- namespace rake tasks and harden sitemap validation ([#8](https://github.com/ethos-link/indexmap/pull/8))
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
## [0.4.2] - 2026-04-23
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
### Fixed
|
|
75
|
+
|
|
76
|
+
- harden sitemap pinging and indexnow key handling ([#7](https://github.com/ethos-link/indexmap/pull/7))
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
## [0.4.1] - 2026-04-22
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
### Added
|
|
84
|
+
|
|
85
|
+
- add output to ping tasks ([#6](https://github.com/ethos-link/indexmap/pull/6))
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
## [0.4.0] - 2026-04-22
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
### Documentation
|
|
93
|
+
|
|
94
|
+
- improve the task messages ([#4](https://github.com/ethos-link/indexmap/pull/4))
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
## [0.3.1] - 2026-04-22
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
### Fixed
|
|
102
|
+
|
|
103
|
+
- fix changelog generation ([#2](https://github.com/ethos-link/indexmap/pull/2))
|
|
104
|
+
|
|
105
|
+
- harden indexmap runtime defaults and test coverage ([#3](https://github.com/ethos-link/indexmap/pull/3))
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
## [0.3.0] - 2026-04-22
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
### Added
|
|
113
|
+
|
|
114
|
+
- expand indexmap with sitemap parsing, validation, and search engine pinging
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
## [0.2.1] - 2026-04-21
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
### Fixed
|
|
122
|
+
|
|
123
|
+
- publish built gem in release workflow
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
## [0.2.0] - 2026-04-21
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
### Added
|
|
131
|
+
|
|
132
|
+
- add single-file sitemap mode
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
## [0.1.0] - 2026-04-21
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
### Added
|
|
140
|
+
|
|
141
|
+
- bootstrap indexmap gem
|
|
14
142
|
|
|
15
143
|
|
|
16
144
|
|
data/README.md
CHANGED
|
@@ -19,9 +19,13 @@ By default, `indexmap` writes a sitemap index plus one or more child sitemap fil
|
|
|
19
19
|
Add this line to your application's Gemfile:
|
|
20
20
|
|
|
21
21
|
```ruby
|
|
22
|
-
gem "indexmap"
|
|
22
|
+
gem "indexmap", require: false
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
`require: false` keeps sitemap generation and search-engine clients out of web
|
|
26
|
+
process boot. Require `indexmap` at the application boundary that generates a
|
|
27
|
+
sitemap, or use the task setup below.
|
|
28
|
+
|
|
25
29
|
And then execute:
|
|
26
30
|
|
|
27
31
|
```bash
|
|
@@ -38,6 +42,13 @@ Upgrading an existing app? Read [UPGRADE.md](UPGRADE.md) before deploying,
|
|
|
38
42
|
especially if the app uses custom storage or stores sitemap files under a
|
|
39
43
|
directory prefix such as `sitemaps/`.
|
|
40
44
|
|
|
45
|
+
## Documentation
|
|
46
|
+
|
|
47
|
+
- [Search engine ping](docs/search-engine-ping.md): Google Search Console
|
|
48
|
+
credentials, Google property configuration, and IndexNow key setup.
|
|
49
|
+
- [UPGRADE.md](UPGRADE.md): host-app migration steps for public contract
|
|
50
|
+
changes.
|
|
51
|
+
|
|
41
52
|
## Ruby Usage
|
|
42
53
|
|
|
43
54
|
```ruby
|
|
@@ -61,6 +72,19 @@ Indexmap::Writer.new(
|
|
|
61
72
|
|
|
62
73
|
## Rails Usage
|
|
63
74
|
|
|
75
|
+
For an app that uses Indexmap through rake tasks, load the task entrypoint only
|
|
76
|
+
when an Indexmap task is requested. In the application's `Rakefile`, before
|
|
77
|
+
`require_relative "config/application"`:
|
|
78
|
+
|
|
79
|
+
```ruby
|
|
80
|
+
list_tasks = Rake.application.options.show_tasks || ARGV.any? { |argument| ["-T", "--tasks"].include?(argument) }
|
|
81
|
+
require "indexmap/tasks" if list_tasks || ARGV.any? { |argument| argument.start_with?("indexmap:") }
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
This preserves `bin/rails --tasks` and the `indexmap:*` tasks without loading
|
|
85
|
+
Indexmap during normal Rails boot. Runtime callers and jobs should explicitly
|
|
86
|
+
`require "indexmap"` immediately before configuring or using the gem.
|
|
87
|
+
|
|
64
88
|
In an initializer:
|
|
65
89
|
|
|
66
90
|
```ruby
|
|
@@ -276,6 +300,8 @@ The built-in validator checks for:
|
|
|
276
300
|
## Search Engine Ping
|
|
277
301
|
|
|
278
302
|
`indexmap` can ping Google Search Console and IndexNow after sitemap generation.
|
|
303
|
+
See [Search engine ping](docs/search-engine-ping.md) for Google credential
|
|
304
|
+
setup, Search Console property configuration, and IndexNow key provisioning.
|
|
279
305
|
|
|
280
306
|
Available rake tasks:
|
|
281
307
|
|
|
@@ -287,77 +313,9 @@ bin/rails indexmap:index_now:write_key
|
|
|
287
313
|
bin/rails indexmap:ping
|
|
288
314
|
```
|
|
289
315
|
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
```ruby
|
|
295
|
-
Indexmap.configure do |config|
|
|
296
|
-
config.google.credentials = -> { ENV["GOOGLE_SITEMAP"] }
|
|
297
|
-
end
|
|
298
|
-
```
|
|
299
|
-
|
|
300
|
-
If `config.google.credentials` is blank, `indexmap:google:ping` skips Google submission.
|
|
301
|
-
|
|
302
|
-
You can optionally override the Search Console property identifier:
|
|
303
|
-
|
|
304
|
-
```ruby
|
|
305
|
-
Indexmap.configure do |config|
|
|
306
|
-
config.google.credentials = -> { ENV["GOOGLE_SITEMAP"] }
|
|
307
|
-
config.google.property = -> { "sc-domain:example.com" }
|
|
308
|
-
end
|
|
309
|
-
```
|
|
310
|
-
|
|
311
|
-
If `config.google.property` is not set, `indexmap` defaults to `sc-domain:<host>`.
|
|
312
|
-
|
|
313
|
-
### IndexNow
|
|
314
|
-
|
|
315
|
-
IndexNow submission requires a key. `indexmap` supports two ways to provide it:
|
|
316
|
-
|
|
317
|
-
- set `config.index_now.key`
|
|
318
|
-
- or keep a valid verification file in the configured storage as `<key>.txt`
|
|
319
|
-
|
|
320
|
-
Configured-key example:
|
|
321
|
-
|
|
322
|
-
```ruby
|
|
323
|
-
Indexmap.configure do |config|
|
|
324
|
-
config.index_now.key = -> { ENV["INDEXNOW_KEY"] }
|
|
325
|
-
end
|
|
326
|
-
```
|
|
327
|
-
|
|
328
|
-
If `config.index_now.key` is set, `indexmap:sitemap:create` also ensures the matching `<key>.txt` verification file exists in storage. It leaves an existing valid key file unchanged.
|
|
329
|
-
|
|
330
|
-
If you need a non-standard verification filename, configure it explicitly:
|
|
331
|
-
|
|
332
|
-
```ruby
|
|
333
|
-
Indexmap.configure do |config|
|
|
334
|
-
config.index_now.key = -> { ENV["INDEXNOW_KEY"] }
|
|
335
|
-
config.index_now.key_filename = -> { "#{ENV.fetch("INDEXNOW_KEY")}.txt" }
|
|
336
|
-
end
|
|
337
|
-
```
|
|
338
|
-
|
|
339
|
-
You can also disable automatic key-file writes entirely:
|
|
340
|
-
|
|
341
|
-
```ruby
|
|
342
|
-
Indexmap.configure do |config|
|
|
343
|
-
config.index_now.key = -> { ENV["INDEXNOW_KEY"] }
|
|
344
|
-
config.index_now.write_key_file = false
|
|
345
|
-
end
|
|
346
|
-
```
|
|
347
|
-
|
|
348
|
-
If you prefer the file-based flow, run:
|
|
349
|
-
|
|
350
|
-
```bash
|
|
351
|
-
bin/rails indexmap:index_now:write_key
|
|
352
|
-
```
|
|
353
|
-
|
|
354
|
-
That task:
|
|
355
|
-
|
|
356
|
-
- reuses an existing valid key file when present
|
|
357
|
-
- otherwise generates a new key in `<key>.txt`
|
|
358
|
-
- makes that key available to `indexmap:index_now:ping` without adding `config.index_now.key`
|
|
359
|
-
|
|
360
|
-
If neither a configured key nor a valid key file is present, `indexmap:index_now:ping` skips IndexNow submission.
|
|
316
|
+
If Google credentials are blank, `indexmap:google:ping` skips Google
|
|
317
|
+
submission. If neither a configured IndexNow key nor a valid key file is
|
|
318
|
+
present, `indexmap:index_now:ping` skips IndexNow submission.
|
|
361
319
|
|
|
362
320
|
## Development
|
|
363
321
|
|
|
@@ -385,7 +343,12 @@ Note: `Gemfile.lock` is intentionally not tracked for this gem, following normal
|
|
|
385
343
|
|
|
386
344
|
### Git hooks
|
|
387
345
|
|
|
388
|
-
We use [lefthook](https://lefthook.dev/) with the Ruby
|
|
346
|
+
We use [lefthook](https://lefthook.dev/) with the Ruby
|
|
347
|
+
[commitlint](https://github.com/arandilopez/commitlint) gem to enforce
|
|
348
|
+
Conventional Commits on every commit. We also use
|
|
349
|
+
[Standard Ruby](https://standardrb.com/) to keep code style consistent. CI
|
|
350
|
+
validates commit messages, Standard Ruby, tests, and git-cliff changelog
|
|
351
|
+
generation on pull requests and pushes to main/master.
|
|
389
352
|
|
|
390
353
|
Run the hook installer once per clone:
|
|
391
354
|
|
|
@@ -395,11 +358,16 @@ bundle exec lefthook install
|
|
|
395
358
|
|
|
396
359
|
## Release
|
|
397
360
|
|
|
398
|
-
Releases are tag-driven and published by GitHub Actions to RubyGems.
|
|
361
|
+
Releases are tag-driven and published by GitHub Actions to RubyGems.
|
|
362
|
+
Local release commands never publish directly.
|
|
399
363
|
|
|
400
|
-
Install [git-cliff](https://git-cliff.org/) locally before preparing a
|
|
364
|
+
Install [git-cliff](https://git-cliff.org/) locally before preparing a
|
|
365
|
+
release. The release task prepends the next `CHANGELOG.md` section from
|
|
366
|
+
Conventional Commits.
|
|
401
367
|
|
|
402
|
-
Before preparing a release, make sure you are on `main` or `master` with a
|
|
368
|
+
Before preparing a release, make sure you are on `main` or `master` with a
|
|
369
|
+
clean worktree. If the release contains a breaking public-contract change,
|
|
370
|
+
update `UPGRADE.md` with the host-app migration steps first.
|
|
403
371
|
|
|
404
372
|
Then run one of:
|
|
405
373
|
|
|
@@ -412,12 +380,13 @@ bundle exec rake 'release:prepare[0.1.0]'
|
|
|
412
380
|
|
|
413
381
|
The task will:
|
|
414
382
|
|
|
415
|
-
1.
|
|
383
|
+
1. Prepend the next `CHANGELOG.md` section with `git-cliff`.
|
|
416
384
|
1. Update `lib/indexmap/version.rb`.
|
|
417
385
|
1. Commit the release changes.
|
|
418
386
|
1. Create and push the `vX.Y.Z` tag.
|
|
419
387
|
|
|
420
|
-
The `Release` workflow then runs tests, publishes the gem to RubyGems,
|
|
388
|
+
The `Release` workflow then runs tests, publishes the gem to RubyGems,
|
|
389
|
+
and creates the GitHub release from the changelog entry.
|
|
421
390
|
|
|
422
391
|
## License
|
|
423
392
|
|
data/lib/indexmap/creator.rb
CHANGED
|
@@ -4,7 +4,7 @@ require "nokogiri"
|
|
|
4
4
|
|
|
5
5
|
module Indexmap
|
|
6
6
|
class Creator
|
|
7
|
-
ValidationConfiguration = Struct.new(:base_url, :index_filename, :storage
|
|
7
|
+
ValidationConfiguration = Struct.new(:base_url, :index_filename, :storage)
|
|
8
8
|
|
|
9
9
|
def initialize(output:)
|
|
10
10
|
@output = output
|
data/lib/indexmap/entry.rb
CHANGED
data/lib/indexmap/parser.rb
CHANGED
|
@@ -6,7 +6,7 @@ require "uri"
|
|
|
6
6
|
|
|
7
7
|
module Indexmap
|
|
8
8
|
class Parser
|
|
9
|
-
Entry = Struct.new(:loc, :lastmod, :source_sitemap
|
|
9
|
+
Entry = Struct.new(:loc, :lastmod, :source_sitemap)
|
|
10
10
|
|
|
11
11
|
def initialize(source: nil, rebase_remote_children: false, index_filename: Indexmap.configuration.index_filename, storage: Indexmap.configuration.storage)
|
|
12
12
|
@source = (source || index_filename).to_s
|
data/lib/indexmap/railtie.rb
CHANGED
data/lib/indexmap/section.rb
CHANGED
data/lib/indexmap/task_runner.rb
CHANGED
|
@@ -13,7 +13,12 @@ module Indexmap
|
|
|
13
13
|
index_now_key_filename = write_index_now_key if configuration.index_now.write_key_file?
|
|
14
14
|
configuration.run_after_create_callbacks
|
|
15
15
|
|
|
16
|
-
{
|
|
16
|
+
{
|
|
17
|
+
files: written_files.map(&:to_s),
|
|
18
|
+
written_files: written_files,
|
|
19
|
+
sitemaps: sitemap_details(written_files),
|
|
20
|
+
index_now_key_filename: index_now_key_filename
|
|
21
|
+
}
|
|
17
22
|
end
|
|
18
23
|
|
|
19
24
|
def format
|
|
@@ -60,5 +65,27 @@ module Indexmap
|
|
|
60
65
|
def sitemap_files
|
|
61
66
|
storage.list(prefix: "sitemap", suffix: ".xml")
|
|
62
67
|
end
|
|
68
|
+
|
|
69
|
+
def sitemap_details(files)
|
|
70
|
+
files.map do |filename|
|
|
71
|
+
{
|
|
72
|
+
filename: filename.to_s,
|
|
73
|
+
location: sitemap_location(filename),
|
|
74
|
+
link_count: sitemap_link_count(filename)
|
|
75
|
+
}
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
def sitemap_location(filename)
|
|
80
|
+
return storage.public_url(filename) if storage.respond_to?(:public_url)
|
|
81
|
+
|
|
82
|
+
filename.to_s
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def sitemap_link_count(filename)
|
|
86
|
+
document = Nokogiri::XML(storage.read(filename.to_s))
|
|
87
|
+
document.remove_namespaces!
|
|
88
|
+
document.xpath("//loc").count
|
|
89
|
+
end
|
|
63
90
|
end
|
|
64
91
|
end
|
data/lib/indexmap/version.rb
CHANGED
data/lib/indexmap.rb
CHANGED
|
@@ -18,14 +18,17 @@ require_relative "indexmap/entry"
|
|
|
18
18
|
require_relative "indexmap/output"
|
|
19
19
|
require_relative "indexmap/parser"
|
|
20
20
|
require_relative "indexmap/pinger/base"
|
|
21
|
-
require_relative "indexmap/pinger/google"
|
|
22
|
-
require_relative "indexmap/pinger/index_now"
|
|
23
21
|
require_relative "indexmap/section"
|
|
24
22
|
require_relative "indexmap/task_runner"
|
|
25
23
|
require_relative "indexmap/validator"
|
|
26
24
|
require_relative "indexmap/writer"
|
|
27
25
|
|
|
28
26
|
module Indexmap
|
|
27
|
+
module Pinger
|
|
28
|
+
autoload :Google, File.expand_path("indexmap/pinger/google", __dir__)
|
|
29
|
+
autoload :IndexNow, File.expand_path("indexmap/pinger/index_now", __dir__)
|
|
30
|
+
end
|
|
31
|
+
|
|
29
32
|
class Error < StandardError; end
|
|
30
33
|
|
|
31
34
|
class ConfigurationError < Error; end
|
|
@@ -5,7 +5,11 @@ namespace :indexmap do
|
|
|
5
5
|
runner = Indexmap::TaskRunner.new
|
|
6
6
|
create_result = runner.create
|
|
7
7
|
|
|
8
|
-
puts "Created, formatted, and validated #{file_count(create_result[:files])}
|
|
8
|
+
puts "Created, formatted, and validated #{file_count(create_result[:files])}."
|
|
9
|
+
puts "Files created:"
|
|
10
|
+
create_result[:sitemaps].each do |sitemap|
|
|
11
|
+
puts " - #{sitemap[:location]} (#{link_count(sitemap[:link_count])})"
|
|
12
|
+
end
|
|
9
13
|
puts "IndexNow key file: #{create_result[:index_now_key_filename]}" if create_result[:index_now_key_filename]
|
|
10
14
|
end
|
|
11
15
|
|
|
@@ -91,6 +95,10 @@ namespace :indexmap do
|
|
|
91
95
|
runner.storage
|
|
92
96
|
end
|
|
93
97
|
|
|
98
|
+
def link_count(count)
|
|
99
|
+
"#{count} #{(count == 1) ? "link" : "links"}"
|
|
100
|
+
end
|
|
101
|
+
|
|
94
102
|
def format_google_ping_failure(failure)
|
|
95
103
|
case failure[:reason]
|
|
96
104
|
when :unauthorized
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
require "open3"
|
|
5
|
+
require "rbconfig"
|
|
6
|
+
|
|
7
|
+
class IndexmapLazyLoadingTest < Minitest::Test
|
|
8
|
+
def test_entrypoint_does_not_load_search_console_dependencies
|
|
9
|
+
script = <<~RUBY
|
|
10
|
+
require "indexmap"
|
|
11
|
+
|
|
12
|
+
loaded = $LOADED_FEATURES.grep(%r{/(?:google/apis|googleauth)(?:/|\\.rb)})
|
|
13
|
+
abort loaded.join("\\n") unless loaded.empty?
|
|
14
|
+
RUBY
|
|
15
|
+
|
|
16
|
+
_stdout, stderr, status = Open3.capture3(
|
|
17
|
+
RbConfig.ruby,
|
|
18
|
+
"-I#{File.expand_path("../../lib", __dir__)}",
|
|
19
|
+
"-e",
|
|
20
|
+
script
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
assert status.success?, stderr
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def test_task_entrypoint_registers_tasks
|
|
27
|
+
script = <<~RUBY
|
|
28
|
+
require "indexmap/tasks"
|
|
29
|
+
|
|
30
|
+
abort "task missing" unless Rake::Task.task_defined?("indexmap:sitemap:create")
|
|
31
|
+
RUBY
|
|
32
|
+
|
|
33
|
+
_stdout, stderr, status = Open3.capture3(
|
|
34
|
+
RbConfig.ruby,
|
|
35
|
+
"-I#{File.expand_path("../../lib", __dir__)}",
|
|
36
|
+
"-e",
|
|
37
|
+
script
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
assert status.success?, stderr
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -16,7 +16,7 @@ class IndexmapTaskRunnerTest < Minitest::Test
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def test_create_writes_new_sitemap_and_key_file_without_deleting_unrelated_files
|
|
19
|
-
storage = Indexmap::Storage::Memory.new
|
|
19
|
+
storage = Indexmap::Storage::Memory.new(public_url: "https://cdn.example.com/sitemaps")
|
|
20
20
|
storage.write("sitemap-pages.xml.gz", "old")
|
|
21
21
|
storage.write("sitemap-extra.xml", "existing")
|
|
22
22
|
|
|
@@ -31,6 +31,18 @@ class IndexmapTaskRunnerTest < Minitest::Test
|
|
|
31
31
|
assert_equal VALID_KEY, storage.read("#{VALID_KEY}.txt")
|
|
32
32
|
assert_equal ["sitemap-pages.xml", "sitemap.xml"], result[:files]
|
|
33
33
|
assert_equal ["sitemap-pages.xml", "sitemap.xml"], result[:written_files]
|
|
34
|
+
assert_equal [
|
|
35
|
+
{
|
|
36
|
+
filename: "sitemap-pages.xml",
|
|
37
|
+
location: "https://cdn.example.com/sitemaps/sitemap-pages.xml",
|
|
38
|
+
link_count: 1
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
filename: "sitemap.xml",
|
|
42
|
+
location: "https://cdn.example.com/sitemaps/sitemap.xml",
|
|
43
|
+
link_count: 1
|
|
44
|
+
}
|
|
45
|
+
], result[:sitemaps]
|
|
34
46
|
assert_equal "#{VALID_KEY}.txt", result[:index_now_key_filename]
|
|
35
47
|
end
|
|
36
48
|
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require "test_helper"
|
|
4
|
+
require "rake"
|
|
5
|
+
|
|
6
|
+
unless respond_to?(:release_version, true)
|
|
7
|
+
load File.expand_path("../Rakefile", __dir__)
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
class ReleaseTaskTest < Minitest::Test
|
|
11
|
+
def test_release_version_increments_patch_from_current_version
|
|
12
|
+
major, minor, patch = Indexmap::VERSION.split(".").map(&:to_i)
|
|
13
|
+
|
|
14
|
+
assert_equal "#{major}.#{minor}.#{patch + 1}", release_version("patch")
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def test_release_version_accepts_explicit_semantic_version
|
|
18
|
+
assert_equal "0.3.0", release_version("0.3.0")
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def test_validate_release_version_rejects_current_version
|
|
22
|
+
error = assert_raises(ArgumentError) do
|
|
23
|
+
validate_release_version!("0.2.7", "0.2.7")
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
assert_equal(
|
|
27
|
+
"Release version 0.2.7 must be newer than current version 0.2.7.",
|
|
28
|
+
error.message
|
|
29
|
+
)
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def test_validate_release_version_rejects_existing_local_tag
|
|
33
|
+
@local_release_tag_exists = true
|
|
34
|
+
@remote_release_tag_exists = false
|
|
35
|
+
|
|
36
|
+
error = assert_raises(ArgumentError) do
|
|
37
|
+
validate_release_version!("0.2.8", "0.2.7")
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
assert_equal "Release tag v0.2.8 already exists locally.", error.message
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
def test_validate_release_version_rejects_existing_remote_tag
|
|
44
|
+
@local_release_tag_exists = false
|
|
45
|
+
@remote_release_tag_exists = true
|
|
46
|
+
|
|
47
|
+
error = assert_raises(ArgumentError) do
|
|
48
|
+
validate_release_version!("0.2.8", "0.2.7")
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
assert_equal "Release tag v0.2.8 already exists on origin.", error.message
|
|
52
|
+
end
|
|
53
|
+
|
|
54
|
+
def test_remote_release_tag_command_asks_git_to_fail_when_no_tag_matches
|
|
55
|
+
assert_equal(
|
|
56
|
+
"git ls-remote --exit-code --tags origin refs/tags/v0.2.8",
|
|
57
|
+
remote_release_tag_command("v0.2.8")
|
|
58
|
+
)
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def test_changelog_command_prepends_the_next_release
|
|
62
|
+
assert_equal(
|
|
63
|
+
[
|
|
64
|
+
"git-cliff",
|
|
65
|
+
"-c",
|
|
66
|
+
"cliff.toml",
|
|
67
|
+
"--unreleased",
|
|
68
|
+
"--tag",
|
|
69
|
+
"v0.2.8",
|
|
70
|
+
"--prepend",
|
|
71
|
+
"CHANGELOG.md"
|
|
72
|
+
],
|
|
73
|
+
changelog_command("0.2.8")
|
|
74
|
+
)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
private
|
|
78
|
+
|
|
79
|
+
def local_release_tag_exists?(_tag)
|
|
80
|
+
@local_release_tag_exists || false
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
def remote_release_tag_exists?(_tag)
|
|
84
|
+
@remote_release_tag_exists || false
|
|
85
|
+
end
|
|
86
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: indexmap
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.8.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Paulo Fidalgo
|
|
@@ -193,11 +193,13 @@ files:
|
|
|
193
193
|
- lib/indexmap/storage/filesystem.rb
|
|
194
194
|
- lib/indexmap/storage/memory.rb
|
|
195
195
|
- lib/indexmap/task_runner.rb
|
|
196
|
+
- lib/indexmap/tasks.rb
|
|
196
197
|
- lib/indexmap/validator.rb
|
|
197
198
|
- lib/indexmap/version.rb
|
|
198
199
|
- lib/indexmap/writer.rb
|
|
199
200
|
- lib/tasks/indexmap_tasks.rake
|
|
200
201
|
- test/indexmap/configuration_test.rb
|
|
202
|
+
- test/indexmap/lazy_loading_test.rb
|
|
201
203
|
- test/indexmap/parser_test.rb
|
|
202
204
|
- test/indexmap/pinger/google_test.rb
|
|
203
205
|
- test/indexmap/pinger/index_now_test.rb
|
|
@@ -205,6 +207,7 @@ files:
|
|
|
205
207
|
- test/indexmap/task_runner_test.rb
|
|
206
208
|
- test/indexmap/validator_test.rb
|
|
207
209
|
- test/indexmap/writer_test.rb
|
|
210
|
+
- test/release_task_test.rb
|
|
208
211
|
- test/test_helper.rb
|
|
209
212
|
homepage: https://www.ethos-link.com/opensource/indexmap
|
|
210
213
|
licenses:
|
|
@@ -233,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
233
236
|
- !ruby/object:Gem::Version
|
|
234
237
|
version: '0'
|
|
235
238
|
requirements: []
|
|
236
|
-
rubygems_version: 4.0.
|
|
239
|
+
rubygems_version: 4.0.16
|
|
237
240
|
specification_version: 4
|
|
238
241
|
summary: Generate sitemap indexes and child sitemaps with plain Ruby
|
|
239
242
|
test_files: []
|