Icarus-Mod-Tools 2.5.1 → 2.5.2

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: e7011bea56d03dd0edd74138d193a5ad4e5628c4c8d59e94abf6e8793b397051
4
- data.tar.gz: 4e9c054fe489ec2abb4aa36f7b8ea9b6d5621723a8ce0cf50563166b7ef002ee
3
+ metadata.gz: 791e5af8d7af9b24c8fe53d04fb97e39b14e7ac0773ce682783aeffebd4b2d85
4
+ data.tar.gz: 7ceede257ab9a52c15e708cf1e346c48b051a0c1c66dd781281eb3d1389ee627
5
5
  SHA512:
6
- metadata.gz: 15d5e90ecb8c7f91accfb3ded406374278ab53e8b3d3d6b997e44904f4d9425acd0bd4461cf5def41dfe502ead8df5f0c54b5002380c78e7da928a39da45db8c
7
- data.tar.gz: 0f9723a7821f213c70612c6510a2bc1c9508353cdf4e10ebf1568291f97e918325c12911e3621aaa4c82f7dd471c2236584d305532b40be32a84dcb0cafd90bf
6
+ metadata.gz: 705e7a9fb7037c1b2f36ea52e883832c56c9720c605c2d88f25c44d8483e500ef1a962d64b0774501a90b5d00495414f24acbac27eda58d4cf2e72d4024e0e61
7
+ data.tar.gz: 54b2d0f837368e87fc3de253a1bdfd6bb0af60da18b145158b47950a4c1b177fd0fdfab605c96cf1309d22e1f0d7f5a74f9f371d2e53b8cbaec6932343bade5b
data/CHANGELOG.md CHANGED
@@ -4,6 +4,14 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## History (reverse chronological order)
6
6
 
7
+ ### v2.5.2 - 2026-02-09
8
+
9
+ - Fix duplicate entries created during sync operations
10
+ - Update Firestore cache after creating new documents to prevent duplicate creation within the same sync run
11
+ - Deduplicate info arrays by name+author before processing (handles duplicate/equivalent modinfo URLs)
12
+ - Strip empty file entries (e.g., `pak: ""`) from database writes
13
+ - Fix `id=` setter on Baseinfo (was silently no-op via method_missing, now uses attr_accessor)
14
+
7
15
  ### v2.5.1 - 2026-01-31
8
16
 
9
17
  - Fix `imt remove repo` failing to find repositories stored as full URLs
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Icarus-Mod-Tools (2.5.0)
4
+ Icarus-Mod-Tools (2.5.2)
5
5
  google-cloud-firestore (~> 2.7)
6
6
  octokit (~> 6.0)
7
7
  paint (~> 2.3)
@@ -106,7 +106,15 @@ module Icarus
106
106
 
107
107
  return @client.doc("#{collections.send(type)}/#{doc_id}").set(payload.to_h, merge:) if doc_id
108
108
 
109
- @client.col(collections.send(type)).add(payload.to_h)
109
+ doc_ref = @client.col(collections.send(type)).add(payload.to_h)
110
+
111
+ # Update cache to prevent duplicate creation within the same sync run
112
+ payload.id = doc_ref.document_id
113
+ cache_var = :"@#{type}"
114
+ cached_collection = instance_variable_get(cache_var)
115
+ cached_collection&.push(payload)
116
+
117
+ doc_ref
110
118
  end
111
119
 
112
120
  def pluralize(type)
@@ -5,7 +5,8 @@ module Icarus
5
5
  module Tools
6
6
  # Base class for Modinfo and Toolinfo
7
7
  class Baseinfo
8
- attr_reader :data, :id, :created_at, :updated_at
8
+ attr_reader :data
9
+ attr_accessor :id, :created_at, :updated_at
9
10
 
10
11
  HASHKEYS = %i[name author version compatibility description files imageURL readmeURL].freeze
11
12
 
@@ -78,6 +79,7 @@ module Icarus
78
79
  db_hash = HASHKEYS.each_with_object({}) { |key, hash| hash[key] = @data[key] }
79
80
 
80
81
  db_hash[:version] = "1.0" if version.nil?
82
+ db_hash[:files] = db_hash[:files]&.reject { |_, url| url.nil? || url.to_s.strip.empty? }
81
83
 
82
84
  db_hash
83
85
  end
@@ -21,14 +21,14 @@ module Icarus
21
21
 
22
22
  def info_array
23
23
  @info_array ||= @firestore.modinfo.map do |url|
24
- retrieve_from_url(url)[:mods].map { |mod| Icarus::Mod::Tools::Modinfo.new(mod) if mod[:name].match?(/[a-z0-9]+/i) }
24
+ retrieve_from_url(url)[:mods].map { |mod| Icarus::Mod::Tools::Modinfo.new(mod) if /[a-z0-9]+/i.match?(mod[:name]) }
25
25
  rescue Icarus::Mod::Tools::Sync::RequestFailed
26
26
  warn "Skipped; Failed to retrieve #{url}"
27
27
  next
28
28
  rescue JSON::ParserError => e
29
29
  warn "Skipped; Invalid JSON in #{url}: #{e.message}"
30
30
  next
31
- end.flatten.compact
31
+ end.flatten.compact.uniq { |mod| [mod.name, mod.author] }
32
32
  end
33
33
 
34
34
  def find(modinfo)
@@ -30,7 +30,7 @@ module Icarus
30
30
  rescue JSON::ParserError => e
31
31
  warn "Skipped; Invalid JSON in #{url}: #{e.message}"
32
32
  next
33
- end.flatten.compact
33
+ end.flatten.compact.uniq { |tool| [tool.name, tool.author] }
34
34
  end
35
35
 
36
36
  def find(toolinfo)
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Icarus
4
4
  module Mod
5
- VERSION = "2.5.1"
5
+ VERSION = "2.5.2"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: Icarus-Mod-Tools
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.1
4
+ version: 2.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donovan Young