Class: PandocBinary::Architecture

Inherits:
Struct
  • Object
show all
Defined in:
lib/pandoc_binary.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#archive_suffixObject

Returns the value of attribute archive_suffix

Returns:

  • (Object)

    the current value of archive_suffix



33
34
35
# File 'lib/pandoc_binary.rb', line 33

def archive_suffix
  @archive_suffix
end

#asset_patternsObject

Returns the value of attribute asset_patterns

Returns:

  • (Object)

    the current value of asset_patterns



33
34
35
# File 'lib/pandoc_binary.rb', line 33

def asset_patterns
  @asset_patterns
end

#bin_path_patternObject

Returns the value of attribute bin_path_pattern

Returns:

  • (Object)

    the current value of bin_path_pattern



33
34
35
# File 'lib/pandoc_binary.rb', line 33

def bin_path_pattern
  @bin_path_pattern
end

#bin_suffixObject

Returns the value of attribute bin_suffix

Returns:

  • (Object)

    the current value of bin_suffix



33
34
35
# File 'lib/pandoc_binary.rb', line 33

def bin_suffix
  @bin_suffix
end

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



33
34
35
# File 'lib/pandoc_binary.rb', line 33

def name
  @name
end

Instance Method Details

#asset_name_patternsObject



34
35
36
# File 'lib/pandoc_binary.rb', line 34

def asset_name_patterns
  return asset_patterns || [name]
end

#fetch_executable(asset:) ⇒ Object



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/pandoc_binary.rb', line 38

def fetch_executable(asset:)
  Open3.pipeline_r(
    [*%w[curl --silent --location], asset.browser_download_url],
    [*%w[bsdtar --to-stdout -xf -], bin_path_pattern],
  ) do |stdout, wait_threads|
    result = yield(stdout)
    process_statuses = wait_threads.map(&:value)
    raise "Command failed with exit: statuses=#{process_statuses.inspect}" if !process_statuses.all?(&:success?)
    return result
  end
end