indexmap 0.3.0 → 0.3.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: 52c07631052b8a72f3745d578239e22f97d047a517d7e1f9bdd8172a98cef453
4
- data.tar.gz: 6ee1835d41386d143dbea600f81e48eff7d147ddd29ad806797195ff8eb3b0e1
3
+ metadata.gz: ecbb344925e56757c840a508365932942f0344ce8fa38af6c3677e6eb6ec9bf3
4
+ data.tar.gz: 3facac318f7fb6553f672afc516910b176294b951d85ac61149cd665e00ded8f
5
5
  SHA512:
6
- metadata.gz: 6b66319af63650f80ac5139cc0502cac097ec93d9d0613f0d856db1b695aa7c6b28a7f0d525eb0513bbd2b5989becae575baf00933fcfcf2b4cceec9388a054b
7
- data.tar.gz: 01130bad021a01134530cbcd1e389e1d25c69637d40fa8f31b4023fbf4015b4caaf79c55895936e76cb54e493495aa35d75a7b86d3a5b77f452b7ba945d37059
6
+ metadata.gz: 57f1ef28f1339a5cd7afa18f01518a520463eea63087363e765467ffe57f7835b3464345e8a792450c7245c89dedb8338a14771261d99aa06da562ed50ca5e1c
7
+ data.tar.gz: 513b73b694d00775765fd8a7e86d52a4a77971cc67fee2b4bd6ca6c675a5ab1c2e5ecca4ef9e8bc77ca7ff2f55784640d0b58734f180e757b650d2ecf1e04b63
data/CHANGELOG.md CHANGED
@@ -5,9 +5,14 @@ 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.3.0] - 2026-04-22
8
+ ## [0.3.1] - 2026-04-22
9
+
10
+
11
+ ### Fixed
12
+
13
+ - fix changelog generation (#2)
14
+
15
+ - harden indexmap runtime defaults and test coverage (#3)
9
16
 
10
- ### <!-- 0 -->🚀 Features
11
- - expand indexmap with sitemap parsing, validation, and search engine pinging
12
17
 
13
18
 
data/README.md CHANGED
@@ -165,6 +165,12 @@ Run the full default task:
165
165
  bundle exec rake
166
166
  ```
167
167
 
168
+ Tests generate a coverage report automatically. You can run either:
169
+
170
+ ```bash
171
+ bundle exec rake test
172
+ ```
173
+
168
174
  Note: `Gemfile.lock` is intentionally not tracked for this gem, following normal Ruby library conventions.
169
175
 
170
176
  ### Git hooks
@@ -13,7 +13,8 @@ module Indexmap
13
13
  end
14
14
 
15
15
  def endpoint
16
- resolve(@endpoint).presence || DEFAULT_ENDPOINT
16
+ value = resolve(@endpoint)
17
+ value.to_s.strip.empty? ? DEFAULT_ENDPOINT : value
17
18
  end
18
19
 
19
20
  def key
@@ -22,7 +23,7 @@ module Indexmap
22
23
 
23
24
  def key_path(public_path:)
24
25
  configured_path = resolve(@key_path)
25
- return Pathname(configured_path) if configured_path.present?
26
+ return Pathname(configured_path) unless configured_path.to_s.strip.empty?
26
27
  return if key.to_s.strip.empty?
27
28
 
28
29
  Pathname(public_path).join("#{key}.txt")
data/lib/indexmap/path.rb CHANGED
@@ -26,7 +26,8 @@ module Indexmap
26
26
  end
27
27
 
28
28
  def default_index_filename
29
- Indexmap.configuration.index_filename.presence || INDEX_FILENAME
29
+ configured = Indexmap.configuration.index_filename
30
+ configured.to_s.strip.empty? ? INDEX_FILENAME : configured
30
31
  rescue
31
32
  INDEX_FILENAME
32
33
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require "active_support/tagged_logging"
3
+ require "logger"
4
4
  require "uri"
5
5
 
6
6
  module Indexmap
@@ -24,7 +24,9 @@ module Indexmap
24
24
  @logger ||= if defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger
25
25
  Rails.logger
26
26
  else
27
- ActiveSupport::TaggedLogging.new(Logger.new($stdout))
27
+ Logger.new($stderr).tap do |logger|
28
+ logger.level = Logger::WARN
29
+ end
28
30
  end
29
31
  end
30
32
 
@@ -50,7 +50,8 @@ module Indexmap
50
50
  end
51
51
 
52
52
  def property_identifier
53
- google_configuration.property.presence || "sc-domain:#{root_domain}"
53
+ property = google_configuration.property
54
+ property.to_s.strip.empty? ? "sc-domain:#{root_domain}" : property
54
55
  end
55
56
 
56
57
  def webmasters_service
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Indexmap
4
- VERSION = "0.3.0"
4
+ VERSION = "0.3.1"
5
5
  end
@@ -0,0 +1,48 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "test_helper"
4
+
5
+ class IndexmapTaskRunnerTest < Minitest::Test
6
+ def test_create_removes_existing_sitemap_files_writes_new_sitemap_and_key_file
7
+ Dir.mktmpdir do |dir|
8
+ public_path = Pathname(dir)
9
+ public_path.join("sitemap.xml").write("old")
10
+ public_path.join("sitemap-pages.xml.gz").write("old")
11
+
12
+ configuration = Indexmap::Configuration.new
13
+ configuration.base_url = "https://example.com"
14
+ configuration.public_path = public_path
15
+ configuration.sections = [
16
+ Indexmap::Section.new(
17
+ filename: "sitemap-pages.xml",
18
+ entries: [Indexmap::Entry.new(loc: "https://example.com/about")]
19
+ )
20
+ ]
21
+ configuration.index_now.key = "test-key"
22
+
23
+ Indexmap::TaskRunner.new(configuration: configuration).create
24
+
25
+ assert_equal false, public_path.join("sitemap-pages.xml.gz").exist?
26
+ assert_includes public_path.join("sitemap.xml").read, "<sitemapindex"
27
+ assert_equal "test-key\n", public_path.join("test-key.txt").read
28
+ end
29
+ end
30
+
31
+ def test_write_index_now_key_returns_nil_when_key_is_not_configured
32
+ Dir.mktmpdir do |dir|
33
+ configuration = Indexmap::Configuration.new
34
+ configuration.base_url = "https://example.com"
35
+ configuration.public_path = Pathname(dir)
36
+ configuration.sections = [
37
+ Indexmap::Section.new(
38
+ filename: "sitemap-pages.xml",
39
+ entries: [Indexmap::Entry.new(loc: "https://example.com/about")]
40
+ )
41
+ ]
42
+
43
+ result = Indexmap::TaskRunner.new(configuration: configuration).write_index_now_key
44
+
45
+ assert_nil result
46
+ end
47
+ end
48
+ end
@@ -3,6 +3,18 @@
3
3
  require "test_helper"
4
4
 
5
5
  class IndexmapValidatorTest < Minitest::Test
6
+ def test_validate_raises_for_missing_sitemap
7
+ Dir.mktmpdir do |directory|
8
+ path = Pathname(directory).join("missing.xml")
9
+
10
+ error = assert_raises(Indexmap::ValidationError) do
11
+ Indexmap::Validator.new(path: path).validate!
12
+ end
13
+
14
+ assert_equal "Missing sitemap file: #{path}", error.message
15
+ end
16
+ end
17
+
6
18
  def test_validate_raises_for_duplicate_urls
7
19
  Dir.mktmpdir do |directory|
8
20
  path = Pathname(directory).join("sitemap.xml")
data/test/test_helper.rb CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
4
4
 
5
+ require "simplecov"
6
+
7
+ SimpleCov.start do
8
+ enable_coverage :branch
9
+ add_filter "/test/"
10
+ end
11
+
5
12
  require "minitest/autorun"
6
13
  require "tmpdir"
7
14
  require "date"
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.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paulo Fidalgo
@@ -122,6 +122,20 @@ dependencies:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: '13.0'
125
+ - !ruby/object:Gem::Dependency
126
+ name: simplecov
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '0.22'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '0.22'
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: standard
127
141
  requirement: !ruby/object:Gem::Requirement
@@ -183,6 +197,7 @@ files:
183
197
  - test/indexmap/path_test.rb
184
198
  - test/indexmap/pinger/google_test.rb
185
199
  - test/indexmap/pinger/index_now_test.rb
200
+ - test/indexmap/task_runner_test.rb
186
201
  - test/indexmap/validator_test.rb
187
202
  - test/indexmap/writer_test.rb
188
203
  - test/test_helper.rb