Sha256: d6ff3f2863a8299bbb521b48ba39c60f0da46dce2859f10eff4b316de56099a1

Contents?: true

Size: 946 Bytes

Versions: 6

Compression:

Stored size: 946 Bytes

Contents

# frozen_string_literal: true

# takeltau bit scope list
module BitScopeList
  # Backend method for bit scope list.
  # @return [String] list of bit scopes
  def bit_scope_list
    log.debug 'Listing bit remote scopes'

    return false unless configured? %w[bit_ssh bit_remote]

    # get ssh command from active config.
    cmd_bit_ssh =
      config.active['bit_ssh']

    root = config.active['bit_root']

    cmd_bit_scope_list = _bit_scope_list_cmd root

    # run ssh command with scope list command.
    scope_list = run "#{cmd_bit_ssh} '#{cmd_bit_scope_list}'"

    # remove bit remote root directory from results
    scope_list.gsub!(%r{#{root}/*}, '')

    # remove /scope.json from results
    scope_list.gsub!(%r{/scope.json}, '')

    scope_list
  end

  private

  # Prepare bit scope list command.
  def _bit_scope_list_cmd(root)
    format(
      config.active['cmd_bit_scope_list_find_scopes'],
      root: root
    )
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
takeltau-0.34.15 lib/takeltau/bit/scope/list.rb
takeltau-0.34.14 lib/takeltau/bit/scope/list.rb
takeltau-0.34.13 lib/takeltau/bit/scope/list.rb
takeltau-0.34.12 lib/takeltau/bit/scope/list.rb
takeltau-0.34.11 lib/takeltau/bit/scope/list.rb
takeltau-0.34.9 lib/takeltau/bit/scope/list.rb