ukiryu 0.2.3 → 0.2.4
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 +4 -4
- data/lib/ukiryu/logger.rb +1 -1
- data/lib/ukiryu/models/implementation_version.rb +2 -3
- data/lib/ukiryu/register.rb +1 -10
- data/lib/ukiryu/schemas/v1/tool.schema.yaml +3 -3
- data/lib/ukiryu/tool/loader.rb +57 -1
- data/lib/ukiryu/tool_index.rb +17 -30
- data/lib/ukiryu/version.rb +1 -1
- data/spec/fixtures/register/tools/bzip2/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/bzip2_busybox/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/bzip2_gnu/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/exiftool/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/ffmpeg/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/ghostscript/default/10.0.yaml +1 -1
- data/spec/fixtures/register/tools/gzip/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/gzip_busybox/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/gzip_gnu/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/imagemagick/default/6.0.yaml +1 -1
- data/spec/fixtures/register/tools/imagemagick/default/6.9.yaml +1 -1
- data/spec/fixtures/register/tools/imagemagick/default/7.1.yaml +1 -1
- data/spec/fixtures/register/tools/inkscape/default/0.92.yaml +1 -1
- data/spec/fixtures/register/tools/inkscape/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/jq/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/pdf2ps/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/ping/bsd/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/ping/gnu/2024.01.17.yaml +1 -1
- data/spec/fixtures/register/tools/ping/windows/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/ping_bsd/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/ping_gnu/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/ping_windows/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/sort/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/tar/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/unzip/default/1.0.yaml +1 -1
- data/spec/fixtures/register/tools/unzip/default/6.0.yaml +1 -1
- data/spec/fixtures/register/tools/yq/default/1.0.yaml +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 26e9a5bf049e08e07b4c435f8269327599cb5d6928c8d27c238ddb6f8ea81b1e
|
|
4
|
+
data.tar.gz: 4db1b1c05432cab64d36c0749b83e6d5d910a941c15eda604811111db748b543
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 9a5b3624a369f3aa3005ff91b8b502e49ed8b0c9392709dd556e39b4cfaff45a22e3f0a9fd1bda3802aa9e5633e64d20297a7792321dae9becfa22d085146aa0
|
|
7
|
+
data.tar.gz: 8160cd1815a565be6596b077e509ec0e49edb8b6e28e6d47b1baa6db22be02549887c635cbe300c833a00895874b65f2d830a44a803d8f04cdbd35d0ab5e93d2
|
data/lib/ukiryu/logger.rb
CHANGED
|
@@ -118,9 +118,8 @@ module Ukiryu
|
|
|
118
118
|
VersionDetection.from_hash(vd_data)
|
|
119
119
|
end
|
|
120
120
|
|
|
121
|
-
#
|
|
122
|
-
profiles_data = data[:execution_profiles] || data['execution_profiles'] ||
|
|
123
|
-
data[:profiles] || data['profiles'] || []
|
|
121
|
+
# Extract execution_profiles
|
|
122
|
+
profiles_data = data[:execution_profiles] || data['execution_profiles'] || []
|
|
124
123
|
|
|
125
124
|
new(
|
|
126
125
|
implements: data[:implements],
|
data/lib/ukiryu/register.rb
CHANGED
|
@@ -417,7 +417,7 @@ module Ukiryu
|
|
|
417
417
|
|
|
418
418
|
# Get versions from index
|
|
419
419
|
versions = list_versions(name_str)
|
|
420
|
-
return
|
|
420
|
+
return nil if versions.empty?
|
|
421
421
|
|
|
422
422
|
# Return specific version or latest
|
|
423
423
|
if version
|
|
@@ -486,15 +486,6 @@ module Ukiryu
|
|
|
486
486
|
|
|
487
487
|
private
|
|
488
488
|
|
|
489
|
-
# Load legacy single-file tool YAML
|
|
490
|
-
#
|
|
491
|
-
# @param name [String] the tool name
|
|
492
|
-
# @return [String, nil] the YAML content or nil
|
|
493
|
-
def load_legacy_tool_yaml(name)
|
|
494
|
-
file = File.join(path, 'tools', "#{name}.yaml")
|
|
495
|
-
File.read(file) if File.exist?(file)
|
|
496
|
-
end
|
|
497
|
-
|
|
498
489
|
# Get git information for this register
|
|
499
490
|
#
|
|
500
491
|
# @return [Hash, nil] git info or nil
|
|
@@ -14,7 +14,7 @@ required:
|
|
|
14
14
|
- ukiryu_schema
|
|
15
15
|
- name
|
|
16
16
|
- version
|
|
17
|
-
-
|
|
17
|
+
- execution_profiles
|
|
18
18
|
additionalProperties: false
|
|
19
19
|
|
|
20
20
|
properties:
|
|
@@ -154,9 +154,9 @@ properties:
|
|
|
154
154
|
description: Default execution timeout in seconds
|
|
155
155
|
example: 300
|
|
156
156
|
|
|
157
|
-
# === Profiles ===
|
|
157
|
+
# === Execution Profiles ===
|
|
158
158
|
|
|
159
|
-
|
|
159
|
+
execution_profiles:
|
|
160
160
|
type: array
|
|
161
161
|
minItems: 1
|
|
162
162
|
description: Platform/shell-specific configurations
|
data/lib/ukiryu/tool/loader.rb
CHANGED
|
@@ -65,7 +65,16 @@ module Ukiryu
|
|
|
65
65
|
# @param options [Hash] options including platform and shell
|
|
66
66
|
# @return [Hash, nil] hash with :implementation_name, :version, :file or nil
|
|
67
67
|
def detect_implementation_and_version(index, tool_name, options = {})
|
|
68
|
-
|
|
68
|
+
target_platform = options[:platform]
|
|
69
|
+
current_platform = Platform.detect
|
|
70
|
+
|
|
71
|
+
# If platform is overridden to a different platform, skip detection
|
|
72
|
+
# and find an implementation that supports the target platform
|
|
73
|
+
if target_platform && target_platform.to_sym != current_platform
|
|
74
|
+
return find_implementation_for_platform(index, tool_name, target_platform, options)
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Normal detection: try each implementation in order
|
|
69
78
|
index.implementations.each do |impl|
|
|
70
79
|
result = try_implementation(impl, tool_name, options)
|
|
71
80
|
return result if result
|
|
@@ -75,6 +84,53 @@ module Ukiryu
|
|
|
75
84
|
fallback_to_default(index)
|
|
76
85
|
end
|
|
77
86
|
|
|
87
|
+
# Find an implementation that supports the target platform
|
|
88
|
+
#
|
|
89
|
+
# @param index [Models::ImplementationIndex] the implementation index
|
|
90
|
+
# @param tool_name [String] the tool name
|
|
91
|
+
# @param target_platform [Symbol] the target platform
|
|
92
|
+
# @param options [Hash] options including shell
|
|
93
|
+
# @return [Hash, nil] implementation spec or nil
|
|
94
|
+
def find_implementation_for_platform(index, tool_name, target_platform, options = {})
|
|
95
|
+
target_platform = target_platform.to_sym if target_platform.is_a?(String)
|
|
96
|
+
target_shell = (options[:shell] || Shell.detect).to_sym
|
|
97
|
+
|
|
98
|
+
# Try each implementation and check if it has a profile for the target platform
|
|
99
|
+
index.implementations.each do |impl|
|
|
100
|
+
impl_name = impl[:name] || impl['name']
|
|
101
|
+
versions = impl[:versions] || impl['versions']
|
|
102
|
+
|
|
103
|
+
# Check each version file for platform compatibility
|
|
104
|
+
versions.each do |version_spec|
|
|
105
|
+
file = version_spec[:file] || version_spec['file']
|
|
106
|
+
next unless file
|
|
107
|
+
|
|
108
|
+
# Load the implementation version to check profiles
|
|
109
|
+
impl_version = Register.load_implementation_version(
|
|
110
|
+
tool_name,
|
|
111
|
+
impl_name,
|
|
112
|
+
file,
|
|
113
|
+
options
|
|
114
|
+
)
|
|
115
|
+
next unless impl_version
|
|
116
|
+
|
|
117
|
+
# Check if any execution profile supports the target platform/shell
|
|
118
|
+
profile = impl_version.compatible_profile(platform: target_platform, shell: target_shell)
|
|
119
|
+
if profile
|
|
120
|
+
# Found a compatible implementation
|
|
121
|
+
return {
|
|
122
|
+
implementation_name: impl_name,
|
|
123
|
+
version: impl_version.version,
|
|
124
|
+
file: file
|
|
125
|
+
}
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
# No implementation supports the target platform
|
|
131
|
+
nil
|
|
132
|
+
end
|
|
133
|
+
|
|
78
134
|
private
|
|
79
135
|
|
|
80
136
|
# Try to detect version from a single implementation
|
data/lib/ukiryu/tool_index.rb
CHANGED
|
@@ -272,28 +272,19 @@ module Ukiryu
|
|
|
272
272
|
@alias_to_tool.clear
|
|
273
273
|
|
|
274
274
|
# Scan all tool directories for metadata
|
|
275
|
-
#
|
|
276
|
-
# Fallback: tools/{tool-name}/{version}.yaml (legacy structure)
|
|
275
|
+
# Structure: tools/{tool-name}/{implementation}/{version}.yaml
|
|
277
276
|
tool_dirs = Dir.glob(File.join(tools_dir, '*')).select { |d| File.directory?(d) }.sort
|
|
278
277
|
|
|
279
278
|
tool_dirs.each do |tool_dir|
|
|
280
279
|
tool_name = File.basename(tool_dir)
|
|
281
280
|
tool_sym = tool_name.to_sym
|
|
282
281
|
|
|
283
|
-
# Find YAML files in
|
|
282
|
+
# Find YAML files in implementation subdirectories
|
|
284
283
|
yaml_files = []
|
|
285
284
|
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
Dir.glob(File.join(variant_dir, '*.yaml')).sort.each do |file|
|
|
290
|
-
yaml_files << file
|
|
291
|
-
end
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
# Fallback: direct YAML files in tool directory (legacy structure)
|
|
295
|
-
if yaml_files.empty?
|
|
296
|
-
Dir.glob(File.join(tool_dir, '*.yaml')).sort.each do |file|
|
|
285
|
+
impl_dirs = Dir.glob(File.join(tool_dir, '*')).select { |d| File.directory?(d) }
|
|
286
|
+
impl_dirs.each do |impl_dir|
|
|
287
|
+
Dir.glob(File.join(impl_dir, '*.yaml')).sort.each do |file|
|
|
297
288
|
yaml_files << file
|
|
298
289
|
end
|
|
299
290
|
end
|
|
@@ -305,7 +296,7 @@ module Ukiryu
|
|
|
305
296
|
next unless hash
|
|
306
297
|
|
|
307
298
|
# Index by interface (multiple tools can implement one interface)
|
|
308
|
-
#
|
|
299
|
+
# implements is an array of interface names
|
|
309
300
|
implements_value = hash['implements']
|
|
310
301
|
if implements_value
|
|
311
302
|
interfaces = if implements_value.is_a?(Array)
|
|
@@ -371,28 +362,24 @@ module Ukiryu
|
|
|
371
362
|
tool_dir = File.join(current_path, 'tools', tool_name.to_s)
|
|
372
363
|
return nil unless Dir.exist?(tool_dir)
|
|
373
364
|
|
|
374
|
-
#
|
|
375
|
-
|
|
376
|
-
# Legacy: tools/{tool-name}/{version}.yaml
|
|
365
|
+
# Structure: tools/{tool-name}/{implementation}/{version}.yaml
|
|
366
|
+
impl_dirs = Dir.glob(File.join(tool_dir, '*')).select { |d| File.directory?(d) }
|
|
377
367
|
|
|
378
|
-
#
|
|
379
|
-
|
|
368
|
+
# Prefer 'default' implementation if present
|
|
369
|
+
impl_dirs.each do |impl_dir|
|
|
370
|
+
next unless File.basename(impl_dir) == 'default'
|
|
380
371
|
|
|
381
|
-
|
|
382
|
-
# Prefer 'default' variant if present
|
|
383
|
-
next unless File.basename(variant_dir) == 'default'
|
|
384
|
-
|
|
385
|
-
files = Dir.glob(File.join(variant_dir, '*.yaml'))
|
|
372
|
+
files = Dir.glob(File.join(impl_dir, '*.yaml'))
|
|
386
373
|
return select_latest_version_by_content(files) if files.any?
|
|
374
|
+
end
|
|
387
375
|
|
|
388
|
-
|
|
389
|
-
|
|
376
|
+
# Fall back to any implementation directory
|
|
377
|
+
impl_dirs.each do |impl_dir|
|
|
378
|
+
files = Dir.glob(File.join(impl_dir, '*.yaml'))
|
|
390
379
|
return select_latest_version_by_content(files) if files.any?
|
|
391
380
|
end
|
|
392
381
|
|
|
393
|
-
|
|
394
|
-
files = Dir.glob(File.join(tool_dir, '*.yaml'))
|
|
395
|
-
files.any? ? select_latest_version_by_content(files) : nil
|
|
382
|
+
nil
|
|
396
383
|
rescue StandardError
|
|
397
384
|
nil
|
|
398
385
|
end
|
data/lib/ukiryu/version.rb
CHANGED