Class: Packages::Debian::ExtractDebMetadataService

Inherits:
Object
  • Object
show all
Defined in:
app/services/packages/debian/extract_deb_metadata_service.rb

Overview

Returns .deb file metadata

Constant Summary collapse

CommandFailedError =
Class.new(StandardError)

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ ExtractDebMetadataService

Returns a new instance of ExtractDebMetadataService.


9
10
11
# File 'app/services/packages/debian/extract_deb_metadata_service.rb', line 9

def initialize(file_path)
  @file_path = file_path
end

Instance Method Details

#executeObject


13
14
15
16
17
18
19
20
21
# File 'app/services/packages/debian/extract_deb_metadata_service.rb', line 13

def execute
  unless success?
    raise CommandFailedError, "The `#{cmd}` command failed (status: #{result.status}) with the following error:\n#{result.stderr}"
  end

  sections = ParseDebian822Service.new(result.stdout).execute

  sections.each_value.first
end