docs-kit 1.2.1 → 1.4.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.
@@ -14,14 +14,19 @@ module DocsKit
14
14
  # and hands back strings for whatever needs a human. A `nil` return means
15
15
  # "nothing to warn about".
16
16
  class Migration
17
- attr_reader :to, :description
17
+ attr_reader :description
18
18
 
19
+ # Keeps `to` as a frozen String, so a migration list can be made
20
+ # Ractor-shareable without freezing Gem::Version's process-wide cached
21
+ # instances; #to hands back the Gem::Version.
19
22
  def initialize(to:, description:, &block)
20
- @to = Gem::Version.new(to.to_s)
23
+ @to = -to.to_s
21
24
  @description = description
22
25
  @block = block
23
26
  end
24
27
 
28
+ def to = Gem::Version.new(@to)
29
+
25
30
  # Run the transform against the site. Returns the (possibly empty) list of
26
31
  # manual-cleanup warnings — never nil, so callers can flat-map safely.
27
32
  def call(root, generator)
@@ -1,5 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require_relative "../../../docs_kit/shareable"
3
4
  require_relative "migration"
4
5
  require_relative "migrations/v1_2_0"
5
6
  require_relative "../../../docs_kit/version"
@@ -24,21 +25,25 @@ module DocsKit
24
25
  # its transform in migrations/vX_Y_Z.rb.
25
26
  class MigrationRegistry
26
27
  def initialize(migrations = [])
27
- @migrations = migrations.sort_by(&:to)
28
+ @migrations = migrations.sort_by(&:to).freeze
28
29
  end
29
30
 
30
- # The registry the install generator runs during `--sync`.
31
- def self.default
32
- @default ||= new(MIGRATIONS)
33
- end
31
+ # The registry the install generator runs during `--sync` (DEFAULT, below).
32
+ def self.default = DEFAULT
34
33
 
35
34
  # Ordered `Migration.new(to: "1.x.0", description: "...") { ... }` entries, one
36
35
  # per release that changes config knobs, routes, templates, or toolchain.
37
- MIGRATIONS = [
38
- Migration.new(to: "1.2.0", description: Migrations::V1_2_0::DESCRIPTION) do |root, _generator|
39
- Migrations::V1_2_0.call(root)
40
- end
41
- ].freeze
36
+ # Shareable: each block is capture-free (its self is this class).
37
+ MIGRATIONS = DocsKit::Shareable.make(
38
+ [
39
+ Migration.new(to: "1.2.0", description: Migrations::V1_2_0::DESCRIPTION) do |root, _generator|
40
+ Migrations::V1_2_0.call(root)
41
+ end
42
+ ]
43
+ )
44
+
45
+ # Built at load from MIGRATIONS, never lazily (no first-call race).
46
+ DEFAULT = DocsKit::Shareable.make(new(MIGRATIONS))
42
47
 
43
48
  # The migrations a site last synced at `from_version` still needs, ascending
44
49
  # by version — those in `(from_version, upto]`. `upto` defaults to the
@@ -12,12 +12,14 @@ module DocsKit
12
12
  # handed back as a warning, and a newer value is left alone.
13
13
  module V1_2_0 # rubocop:disable Naming/ClassAndModuleCamelCase -- named after the release
14
14
  DESCRIPTION = "docs-kit 1.2: Ruby >= 3.3, Bun 1.4.2, Tailwind 4.3 / daisyUI 5.7 floors, Node 24 deploy"
15
- MIN_RUBY = Gem::Version.new("3.3")
15
+ # A String: Gem::Version.new hands out process-wide cached instances,
16
+ # which a constant must not freeze. Compared via Gem::Version below.
17
+ MIN_RUBY = "3.3"
16
18
  BUN = { from: "1.3.2", to: "1.4.2" }.freeze
17
19
  PACKAGE_FLOORS = {
18
- "tailwindcss" => { from: "^4.1.18", to: "^4.3.3" },
19
- "@tailwindcss/cli" => { from: "^4.1.18", to: "^4.3.3" },
20
- "daisyui" => { from: "^5.6.0", to: "^5.7.47" }
20
+ "tailwindcss" => { from: "^4.1.18", to: "^4.3.3" }.freeze,
21
+ "@tailwindcss/cli" => { from: "^4.1.18", to: "^4.3.3" }.freeze,
22
+ "daisyui" => { from: "^5.6.0", to: "^5.7.47" }.freeze
21
23
  }.freeze
22
24
  DEPLOY_CALL = %r{zoolutions/docs-kit/\.github/workflows/deploy\.yml@(\S+)}
23
25
 
@@ -112,7 +114,7 @@ module DocsKit
112
114
 
113
115
  def below_min_ruby?(value)
114
116
  version = version_of(value)
115
- version ? version < MIN_RUBY : false
117
+ version ? version < Gem::Version.new(MIN_RUBY) : false
116
118
  end
117
119
  end
118
120
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docs-kit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikael Henriksson
@@ -179,6 +179,7 @@ files:
179
179
  - app/components/docs_ui/logo.rb
180
180
  - app/components/docs_ui/markdown.rb
181
181
  - app/components/docs_ui/markdown_action.rb
182
+ - app/components/docs_ui/markdown_images.rb
182
183
  - app/components/docs_ui/meta_tags.rb
183
184
  - app/components/docs_ui/on_this_page.rb
184
185
  - app/components/docs_ui/open_api_operation.rb
@@ -234,9 +235,11 @@ files:
234
235
  - lib/docs_kit/search_index.rb
235
236
  - lib/docs_kit/search_index/snippet.rb
236
237
  - lib/docs_kit/seo_config.rb
238
+ - lib/docs_kit/shareable.rb
237
239
  - lib/docs_kit/shortcut.rb
238
240
  - lib/docs_kit/snapshot.rb
239
241
  - lib/docs_kit/snapshot/entry.rb
242
+ - lib/docs_kit/store.rb
240
243
  - lib/docs_kit/templates/new_site.rb
241
244
  - lib/docs_kit/topbar_link.rb
242
245
  - lib/docs_kit/version.rb