26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/depot/installer.rb', line 26
def install(input, options = {})
inspection_result = Inspector.inspect(input)
return inspection_result unless inspection_result.ok?
inspection = inspection_result.value
merged_settings = @settings.load.merge(options.fetch(:settings, {}))
result = case inspection.format
when "appimage"
Backends::AppImage.new(store: @store).install(inspection, settings: merged_settings)
when "deb"
Backends::Deb.new(store: @store).install(inspection, settings: merged_settings)
when "tar.gz", "tar.xz", "tar.zst"
Backends::Archive.new(store: @store).install(inspection, settings: merged_settings)
when "rpm"
Backends::Rpm.new(store: @store).install(inspection, settings: merged_settings)
when "flatpakref"
Backends::FlatpakRefBackend.new(store: @store).install(inspection, settings: merged_settings)
else
Result.err("No installer backend is available for detected format: #{inspection.format}")
end
return result unless result.ok?
sandboxed = Sandbox.apply(result.value, settings: merged_settings, store: @store)
return sandboxed unless sandboxed.ok?
Result.ok(sandboxed.value, warnings: result.warnings)
end
|