Class: Mnenv::BinaryVersion
- Inherits:
-
ArtifactVersion
- Object
- Lutaml::Model::Serializable
- ArtifactVersion
- Mnenv::BinaryVersion
- Defined in:
- lib/mnenv/models/binary_version.rb
Instance Method Summary collapse
-
#assets ⇒ Object
Get list of available assets for this release.
-
#available_arches_for(platform_name) ⇒ Object
Get available architectures for a platform.
-
#available_platforms ⇒ Object
Get available platform names.
-
#binary_for_platform?(platform) ⇒ Boolean
Check if binary is available for a specific platform.
-
#display_name ⇒ Object
Binary versions use plain version display (no ‘v’ prefix).
-
#download_url(name:, arch:, variant: nil, format: nil) ⇒ Object
Get download URL for a specific platform/arch combination.
-
#find_platform(name:, arch:, variant: nil, format: nil) ⇒ Object
Find the best matching platform entry for current system Returns the platform hash with url, format, etc.
-
#html_url ⇒ Object
Get the GitHub release URL.
-
#platforms ⇒ Object
Get platforms info (with URLs, format, etc.).
-
#tag_name ⇒ Object
Get the release tag name (with ‘v’ prefix).
Methods inherited from ArtifactVersion
Instance Method Details
#assets ⇒ Object
Get list of available assets for this release
28 29 30 |
# File 'lib/mnenv/models/binary_version.rb', line 28 def assets &.dig('assets') || [] end |
#available_arches_for(platform_name) ⇒ Object
Get available architectures for a platform
74 75 76 |
# File 'lib/mnenv/models/binary_version.rb', line 74 def available_arches_for(platform_name) platforms.select { |p| p['name'] == platform_name }.map { |p| p['arch'] }.uniq end |
#available_platforms ⇒ Object
Get available platform names
69 70 71 |
# File 'lib/mnenv/models/binary_version.rb', line 69 def available_platforms platforms.map { |p| p['name'] }.uniq end |
#binary_for_platform?(platform) ⇒ Boolean
Check if binary is available for a specific platform
38 39 40 |
# File 'lib/mnenv/models/binary_version.rb', line 38 def binary_for_platform?(platform) assets.any? { |a| a == "metanorma-#{platform}" } end |
#display_name ⇒ Object
Binary versions use plain version display (no ‘v’ prefix)
17 |
# File 'lib/mnenv/models/binary_version.rb', line 17 def display_name = version |
#download_url(name:, arch:, variant: nil, format: nil) ⇒ Object
Get download URL for a specific platform/arch combination
63 64 65 66 |
# File 'lib/mnenv/models/binary_version.rb', line 63 def download_url(name:, arch:, variant: nil, format: nil) platform = find_platform(name: name, arch: arch, variant: variant, format: format) platform&.dig('url') end |
#find_platform(name:, arch:, variant: nil, format: nil) ⇒ Object
Find the best matching platform entry for current system Returns the platform hash with url, format, etc.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/mnenv/models/binary_version.rb', line 44 def find_platform(name:, arch:, variant: nil, format: nil) candidates = platforms.select { |p| p['name'] == name && p['arch'] == arch } # Filter by variant # - If variant is specified, match platforms with that variant # - If variant is nil, match platforms WITHOUT a variant (glibc, not musl) candidates = if variant candidates.select { |p| p['variant'] == variant } else candidates.select { |p| p['variant'].nil? } end # Filter by format if specified candidates = candidates.select { |p| p['format'] == format } if format candidates.first end |
#html_url ⇒ Object
Get the GitHub release URL
23 24 25 |
# File 'lib/mnenv/models/binary_version.rb', line 23 def html_url &.dig('html_url') end |
#platforms ⇒ Object
Get platforms info (with URLs, format, etc.)
33 34 35 |
# File 'lib/mnenv/models/binary_version.rb', line 33 def platforms &.dig('platforms') || [] end |
#tag_name ⇒ Object
Get the release tag name (with ‘v’ prefix)
20 |
# File 'lib/mnenv/models/binary_version.rb', line 20 def tag_name = "v#{version}" |