fhir_packages_manager 0.1.0 → 0.2.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: c3db88fe718417bdd2a0bd82604b48928db13d036ee912094cb8891e5218d967
4
- data.tar.gz: d84a0f807bcd2f479cd511fb100cfd9c723c6b59fca65c5dc41aa2e6dd829418
3
+ metadata.gz: 4c2287ea505915de0f129d5ce615c60d6df687ed7253f62a0f3ef0b7f71c4a73
4
+ data.tar.gz: 1addb4d25614ee56ee29cbc4ebfe0598cfd2337e8cacde5ca011fcc121110b9f
5
5
  SHA512:
6
- metadata.gz: 17d1da3f230507fbeb91cd949a90370561bcdeece97bdf433b169f16b7baadf960cc542bd9931f56b2b6afe93936a1d53865efe8f45e9be969e2f1883dcb5acf
7
- data.tar.gz: 3b4e62d57b1b034c137869355e2d8454fc92292d3b0b59f4825abc89af0d86013afd76f563de14f95a23a03e28f1fd7783ef8b54994e7cf5137d44068bda562e
6
+ metadata.gz: 968af44ee62704494e47c21423c90b067c6ad0265aa4a27c254dcbd005800cc0c1e74ed691cedeefc15289e2b4c77c7012d88626ff0475148c4bfa272d0d7908
7
+ data.tar.gz: b1b2b5db5cf50a8a1d63cfc728ba3f0a0d69f37b3037f74d52b208c8620618276090f9c219229f8683f80988c6843044ecfb99f5fa03891ae1a7c0956167d2a3
data/CHANGELOG.md CHANGED
@@ -5,6 +5,17 @@ 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.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.0] - 2026-07-10
11
+
12
+ ### Added
13
+
14
+ - `list` CLI command and `Manager#list_versions`/`Registry#versions`: lists every version of a
15
+ package published across all configured registries, without needing a version suffix on the
16
+ spec. Respects the ignore list the same way `fetch` does (whole-package or single-version
17
+ entries). (#1)
18
+
8
19
  ## [0.1.0] - 2026-07-10
9
20
 
10
21
  ### Added
@@ -39,5 +50,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
39
50
  - **Documentation**: YARD doc comments across the public API, and a Codecov/docs badge pair
40
51
  in the README.
41
52
 
42
- [Unreleased]: https://github.com/projkov/fhir_packages_manager/compare/v0.1.0...HEAD
53
+ [Unreleased]: https://github.com/projkov/fhir_packages_manager/compare/v0.2.0...HEAD
54
+ [0.2.0]: https://github.com/projkov/fhir_packages_manager/compare/v0.1.0...v0.2.0
43
55
  [0.1.0]: https://github.com/projkov/fhir_packages_manager/releases/tag/v0.1.0
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
- # FhirPackagesManager
1
+ # FHIR Packages Manager
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/fhir_packages_manager.svg?icon=si%3Arubygems)](https://badge.fury.io/rb/fhir_packages_manager)
4
+ [![Ruby](https://img.shields.io/badge/ruby-%3E%3D%203.2-CC342D?logo=ruby&logoColor=white)](fhir_packages_manager.gemspec)
3
5
  [![codecov](https://codecov.io/gh/projkov/fhir_packages_manager/graph/badge.svg)](https://codecov.io/gh/projkov/fhir_packages_manager)
4
6
  [![docs](https://img.shields.io/badge/docs-yard-blue.svg)](https://projkov.github.io/fhir_packages_manager/)
5
7
 
@@ -42,6 +44,8 @@ result.status # => :downloaded, :ignored, :not_found, or :error
42
44
  result.path # => "./fhir_packages/hl7.fhir.us.core-6.1.0.tgz" when downloaded
43
45
 
44
46
  manager.fetch_all(["hl7.fhir.us.core@6.1.0", "hl7.fhir.r4.core"]) # bare name = latest
47
+
48
+ manager.list_versions("hl7.fhir.us.core") # => {"https://packages.fhir.org" => ["1.0.0", "1.0.1", ...], ...}
45
49
  ```
46
50
 
47
51
  The ignore list file (YAML or JSON) is a flat array where a bare string
@@ -60,6 +64,8 @@ exe/fhir_packages_manager check hl7.fhir.us.core@6.1.0 -r https://packages.fhir.
60
64
  exe/fhir_packages_manager fetch hl7.fhir.us.core@6.1.0 hl7.fhir.r4.core \
61
65
  -r https://packages.fhir.org -r https://packages.simplifier.net \
62
66
  -d ./fhir_packages -i fhir_packages_ignore.yml
67
+ exe/fhir_packages_manager list hl7.fhir.us.core \
68
+ -r https://packages.fhir.org -r https://packages.simplifier.net
63
69
  ```
64
70
 
65
71
  ### Docker
@@ -74,7 +80,13 @@ docker run --rm -v "$(pwd)/fhir_packages:/fhir_packages" ghcr.io/projkov/fhir_pa
74
80
  fetch hl7.fhir.us.core@6.1.0 -r https://packages.fhir.org -d /fhir_packages
75
81
  ```
76
82
 
77
- Mount a volume (as above) to get downloaded `.tgz` files back out onto the host.
83
+ Mount a volume (as above) to get downloaded `.tgz` files back out onto the host. `latest` and
84
+ version tags are built for both `linux/amd64` and `linux/arm64` (e.g. Apple Silicon).
85
+
86
+ To get a fresh image built from an unreleased commit (without cutting a real gem release),
87
+ run the **Docker Snapshot** workflow manually from the Actions tab. It re-runs the test/quality
88
+ gate, then pushes `ghcr.io/projkov/fhir_packages_manager:<gem-version>-<commit-sha>` (e.g.
89
+ `0.1.0-9649122`) — never `latest`, so it can't be mistaken for a real release.
78
90
 
79
91
  #### Docker Compose
80
92
 
@@ -7,7 +7,7 @@ module FhirPackagesManager
7
7
  # See the "CLI" section of the README for usage examples.
8
8
  class CLI
9
9
  # @return [Array<String>] the supported subcommands
10
- COMMANDS = %w[fetch check].freeze
10
+ COMMANDS = %w[fetch check list].freeze
11
11
 
12
12
  # @return [String] usage text shown on --help and on invalid invocations
13
13
  BANNER = <<~USAGE
@@ -16,6 +16,7 @@ module FhirPackagesManager
16
16
  Commands:
17
17
  fetch Download packages into the destination folder
18
18
  check Report which registry (if any) has each package/version
19
+ list List every version of a package available across registries
19
20
 
20
21
  USAGE
21
22
 
@@ -53,6 +54,8 @@ module FhirPackagesManager
53
54
  fetch(package_specs)
54
55
  when 'check'
55
56
  check(package_specs)
57
+ when 'list'
58
+ list(package_specs)
56
59
  end
57
60
  end
58
61
 
@@ -132,5 +135,20 @@ module FhirPackagesManager
132
135
  registry, version = found
133
136
  "AVAILABLE #{package.name}@#{version} (#{registry.base_url})"
134
137
  end
138
+
139
+ def list(package_specs)
140
+ package_specs.each do |spec|
141
+ name = Package.parse(spec).name
142
+ list_lines(name, manager.list_versions(name)).each { |line| puts line }
143
+ end
144
+ end
145
+
146
+ def list_lines(name, versions_by_registry)
147
+ return ["NONE #{name} (not found in any registry)"] if versions_by_registry.empty?
148
+
149
+ versions_by_registry.map do |base_url, versions|
150
+ "FOUND #{name} @ #{base_url}: #{versions.sort.join(', ')}"
151
+ end
152
+ end
135
153
  end
136
154
  end
@@ -60,6 +60,26 @@ module FhirPackagesManager
60
60
  packages.map { |package| fetch(package) }
61
61
  end
62
62
 
63
+ # Lists every version of a package published across all configured registries, skipping
64
+ # registries that don't have it at all and filtering out any ignored versions.
65
+ #
66
+ # @param name [String] the package name
67
+ # @return [Hash{String => Array<String>}] versions, keyed by registry base_url, for
68
+ # registries that have at least one non-ignored version; empty if the whole package is
69
+ # ignored or no registry has it
70
+ # @raise [HttpError] if a registry that does have the package fails for another reason
71
+ # (mirrors {#find_registry}/{Registry#version?}, which likewise only treat "not found" as
72
+ # an expected, non-raising outcome)
73
+ def list_versions(name)
74
+ result = {} # : Hash[String, Array[String]]
75
+ return result if ignored?(Package.new(name, nil))
76
+
77
+ registries.each_with_object(result) do |registry, found|
78
+ versions = available_versions(registry, name)
79
+ found[registry.base_url] = versions unless versions.empty?
80
+ end
81
+ end
82
+
63
83
  private
64
84
 
65
85
  def fetch_package(package)
@@ -77,6 +97,12 @@ module FhirPackagesManager
77
97
  !!ignore_list&.ignored?(package.name, package.version)
78
98
  end
79
99
 
100
+ def available_versions(registry, name)
101
+ registry.versions(name).reject { |version| ignored?(Package.new(name, version)) }
102
+ rescue PackageNotFoundError
103
+ []
104
+ end
105
+
80
106
  def download_result(package, found)
81
107
  registry, resolved_version = found
82
108
  name = package.name
@@ -49,6 +49,14 @@ module FhirPackagesManager
49
49
  nil
50
50
  end
51
51
 
52
+ # @param name [String] the package name
53
+ # @return [Array<String>] every version published for this package on this registry
54
+ # @raise [PackageNotFoundError] if the package doesn't exist on this registry
55
+ # @raise [HttpError] for any other non-2xx/3xx response
56
+ def versions(name)
57
+ metadata(name)['versions']&.keys || []
58
+ end
59
+
52
60
  # @param name [String] the package name
53
61
  # @param version [String] an exact version, as returned by {#version?}
54
62
  # @return [String] the tarball's download URL
@@ -2,5 +2,5 @@
2
2
 
3
3
  module FhirPackagesManager
4
4
  # @return [String] the gem's version, following semver
5
- VERSION = '0.1.0'
5
+ VERSION = '0.2.0'
6
6
  end
@@ -30,5 +30,9 @@ module FhirPackagesManager
30
30
  def check: (Array[String] package_specs) -> void
31
31
 
32
32
  def check_line: (Package package, [Registry, String]? found) -> String
33
+
34
+ def list: (Array[String] package_specs) -> void
35
+
36
+ def list_lines: (String name, Hash[String, Array[String]] versions_by_registry) -> Array[String]
33
37
  end
34
38
  end
@@ -14,6 +14,8 @@ module FhirPackagesManager
14
14
 
15
15
  def fetch_all: (Array[String | Package] packages) -> Array[FetchResult]
16
16
 
17
+ def list_versions: (String name) -> Hash[String, Array[String]]
18
+
17
19
  private
18
20
 
19
21
  def fetch_package: (Package package) -> FetchResult
@@ -21,5 +23,7 @@ module FhirPackagesManager
21
23
  def ignored?: (Package package) -> bool
22
24
 
23
25
  def download_result: (Package package, [Registry, String] found) -> FetchResult
26
+
27
+ def available_versions: (Registry registry, String name) -> Array[String]
24
28
  end
25
29
  end
@@ -10,6 +10,8 @@ module FhirPackagesManager
10
10
 
11
11
  def version?: (String name, ?String? version) -> String?
12
12
 
13
+ def versions: (String name) -> Array[String]
14
+
13
15
  def tarball_url: (String name, String version) -> String
14
16
 
15
17
  def download: (String name, String version, String destination_path) -> String
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fhir_packages_manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pavel Rozhkov