Icarus-Mod-Tools 3.2.0 → 3.2.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: de06ee7fa7b4384bd296cd428c7946edc03c9dde4d8313f8cc1b9550095d89a0
4
- data.tar.gz: cc5488cad0c60bc7c52eb535ae241d4ee3457446802affb70f2adf60d368829e
3
+ metadata.gz: f71d742763b16a7a6cb096f6decf06568f415909ee0830f392315523b7ab307d
4
+ data.tar.gz: f5afb462e86cc8452508dad64b319d4c2246cad20a5963741efa43f2b76d873a
5
5
  SHA512:
6
- metadata.gz: f3ad937f990a1b765c033af08dbef572c0e02db86138c95400ebf06b38c07c94ef41e3bd2bc692c816a906b302d2ad64da9b6a39cbdeb4f167afea315a8dcc9b
7
- data.tar.gz: e2a1a5ede7f1733ef712d24e0c62f119757e382c27dbb31a5ef39a5ab85fdf582723c7578f5940894d42cf02d1ce9750efb37e22591152216f4eff772974970c
6
+ metadata.gz: 96c885457a5b1e1998eea60852d62474a48c4b1b66ec4ccd4aede80f8300314bde8eb2e9cca637cdae7d6630e00d83fa33b0157af899ef50283e3a97760c25ee
7
+ data.tar.gz: deac9280f7a685695dbe3704ae48b990298a4559b3dd1d5cd5277bb51fef6fe92ab71f0fc8bfb05dda43a6a170c430729c4fac7b5e5f0f291d29f627ead1dba9
data/CHANGELOG.md CHANGED
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## History (reverse chronological order)
6
6
 
7
+ ### v3.2.1 - 2026-10-31
8
+
9
+ - Fix `imt add repos owner/repo` storing a bare `owner/repo`, which stage 1 of sync never searched (it only looked at entries containing "github"); it now stores the canonical `https://github.com/owner/repo` for any GitHub form, refuses non-GitHub repositories, and does nothing when the repository is already listed under any spelling
10
+ - Stage 1 of sync (`imt sync modinfo`/`toolinfo`) now also searches bare `owner/repo` entries already in `meta/repos`
11
+
7
12
  ### v3.2.0 - 2026-10-30
8
13
 
9
14
  - Add `imt validate repo OWNER/REPO [--json]`, a read-only pre-check for a repo before it is added to `meta/repos` (repo state, info files, entry validation and link checks; exits 0/1/2)
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- Icarus-Mod-Tools (3.2.0)
4
+ Icarus-Mod-Tools (3.2.1)
5
5
  google-cloud-firestore (~> 3.3)
6
6
  octokit (~> 10.0)
7
7
  ostruct (~> 0.6)
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require "firestore"
4
+ require "github"
4
5
  require "tools/modinfo"
5
6
 
6
7
  module Icarus
@@ -22,7 +23,16 @@ module Icarus
22
23
 
23
24
  desc "repos", "Adds an entry to 'meta/repos/list'"
24
25
  def repos(item)
25
- add_to_list(:repositories, :repositories, item)
26
+ # Stage 1 of sync searches entries in the canonical URL form, so store that whatever form we were given
27
+ url = Github.canonical_url(item)
28
+ unless url
29
+ warn Paint["#{item} is not a GitHub repository (use owner/repo or a github.com URL)", :red]
30
+ exit 1
31
+ end
32
+
33
+ add_to_list(:repositories, :repositories, url) do |existing|
34
+ existing.any? { |entry| Github.canonical_url(entry)&.casecmp?(url) }
35
+ end
26
36
  end
27
37
 
28
38
  desc "mod", "Adds an entry to 'mods'"
@@ -78,7 +88,13 @@ module Icarus
78
88
  end
79
89
 
80
90
  firestore = Firestore.new
81
- payload = [firestore.send(collection), item].flatten.compact
91
+ existing = firestore.send(collection)
92
+ if block_given? && yield(existing)
93
+ puts "#{item} is already listed"
94
+ return
95
+ end
96
+
97
+ payload = [existing, item].flatten.compact
82
98
 
83
99
  exit 1 unless report(firestore.update(type, payload, merge: true))
84
100
  end
@@ -8,6 +8,15 @@ module Icarus
8
8
  class Github
9
9
  attr_reader :client, :resources
10
10
 
11
+ # owner/repo, optionally as a github.com URL (with .git, a trailing slash or a deeper path)
12
+ REPO_PATTERN = %r{\A(?:(?:https?://)?(?:www\.)?github\.com/)?([A-Za-z0-9][\w.-]*)/([\w.-]+?)(?:\.git)?(?:[/?#].*)?\z}
13
+
14
+ # The form meta/repos stores ("https://github.com/owner/repo"), or nil when +repo+ is not a GitHub repository
15
+ def self.canonical_url(repo)
16
+ match = REPO_PATTERN.match(repo.to_s.strip)
17
+ match && "https://github.com/#{match[1]}/#{match[2]}"
18
+ end
19
+
11
20
  def initialize(repo = nil)
12
21
  self.repository = repo if repo
13
22
  @client = Octokit::Client.new(access_token: Config.github.token)
@@ -41,11 +41,11 @@ module Icarus
41
41
  repositories.map do |repo|
42
42
  print "searching #{repo}..." if verbose
43
43
 
44
- case repo
45
- when /github/
44
+ # A GitHub URL, or a bare owner/repo (how `imt add repos` stored entries before 3.2.1)
45
+ if Github.canonical_url(repo)
46
46
  find_modinfo(repo, verbose:)
47
- else
48
- puts "Skipped...repository type not supported yet" if verbose
47
+ elsif verbose
48
+ puts "Skipped...repository type not supported yet"
49
49
  end
50
50
  end.compact
51
51
  end
@@ -41,11 +41,11 @@ module Icarus
41
41
  repositories.map do |repo|
42
42
  print "searching #{repo}..." if verbose
43
43
 
44
- case repo
45
- when /github/
44
+ # A GitHub URL, or a bare owner/repo (how `imt add repos` stored entries before 3.2.1)
45
+ if Github.canonical_url(repo)
46
46
  find_toolinfo(repo, verbose:)
47
- else
48
- puts "Skipped...repository type not supported yet" if verbose
47
+ elsif verbose
48
+ puts "Skipped...repository type not supported yet"
49
49
  end
50
50
  end.compact
51
51
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Icarus
4
4
  module Mod
5
- VERSION = "3.2.0"
5
+ VERSION = "3.2.1"
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: 3.2.0
4
+ version: 3.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Donovan Young