indexmap 0.7.1 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 64a9d1c671519fea6ba6a46b7f67daed2784ad5aaccf2594dc3aa0a374f55854
4
- data.tar.gz: 50f6bc13a8097194dec9736b96c8cc6baf0f76429edf0175372aee97991c63f0
3
+ metadata.gz: 7e1e66f1d2afc109e4475d63d4c24c4e66d4da6a50e729b1f67f325bf729b792
4
+ data.tar.gz: ce2d2d9f892c510b337e7c2155cc304044a9182722588172456c82b737e196d3
5
5
  SHA512:
6
- metadata.gz: 2ce92a1da076303265c03ff833585b069215c8417b134407850770c64ae04b3ab93fcf894484874e710e304c6b3c94f19247d70073aaa6ba5e170f70212e4992
7
- data.tar.gz: 991f39cd9db707dd79e7a404e636aaea8c8a1db07ce5b59d2daf9d73c33a55d39c252d6edef2adf8fc98ea22e153f8619aee4f67f9fd11c3fccf56b473bb1ffa
6
+ metadata.gz: 0ad6376f15ef8e5f734c952ae209b472cdefeeb195c641c05e84413f58a3f699f33a8dd6145d661df14c3603fa26268829fae0028da66496bc222f85a3a3c21b
7
+ data.tar.gz: 2a1c8520caabe2cd2650dda8fd62e77fb9a3a55f85d508b38eb2529d1a658701c15fb65a168e65d278587b55ecbeae15d6bba929b17a1d1855dace51e6d205cd
data/CHANGELOG.md CHANGED
@@ -5,6 +5,22 @@ 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
+
8
24
  ## [0.7.1] - 2026-05-31
9
25
 
10
26
 
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
@@ -68,6 +72,19 @@ Indexmap::Writer.new(
68
72
 
69
73
  ## Rails Usage
70
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
+
71
88
  In an initializer:
72
89
 
73
90
  ```ruby
@@ -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, keyword_init: true)
7
+ ValidationConfiguration = Struct.new(:base_url, :index_filename, :storage)
8
8
 
9
9
  def initialize(output:)
10
10
  @output = output
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Indexmap
4
- Entry = Struct.new(:loc, :lastmod, keyword_init: true)
4
+ Entry = Struct.new(:loc, :lastmod)
5
5
  end
@@ -6,7 +6,7 @@ require "uri"
6
6
 
7
7
  module Indexmap
8
8
  class Parser
9
- Entry = Struct.new(:loc, :lastmod, :source_sitemap, keyword_init: true)
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
@@ -3,7 +3,7 @@
3
3
  module Indexmap
4
4
  class Railtie < Rails::Railtie
5
5
  rake_tasks do
6
- load File.expand_path("../tasks/indexmap_tasks.rake", __dir__)
6
+ require "indexmap/tasks"
7
7
  end
8
8
  end
9
9
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Indexmap
4
- Section = Struct.new(:filename, :entries, keyword_init: true)
4
+ Section = Struct.new(:filename, :entries)
5
5
  end
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Indexmap
4
4
  module Storage
5
- File = Struct.new(:filename, :body, :content_type, keyword_init: true) do
5
+ File = Struct.new(:filename, :body, :content_type) do
6
6
  def basename
7
7
  ::File.basename(filename)
8
8
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "indexmap"
4
+ require "rake"
5
+
6
+ unless Rake::Task.task_defined?("indexmap:sitemap:create")
7
+ load File.expand_path("../tasks/indexmap_tasks.rake", __dir__)
8
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Indexmap
4
- VERSION = "0.7.1"
4
+ VERSION = "0.8.0"
5
5
  end
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
@@ -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
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.7.1
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
@@ -234,7 +236,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
234
236
  - !ruby/object:Gem::Version
235
237
  version: '0'
236
238
  requirements: []
237
- rubygems_version: 4.0.10
239
+ rubygems_version: 4.0.16
238
240
  specification_version: 4
239
241
  summary: Generate sitemap indexes and child sitemaps with plain Ruby
240
242
  test_files: []