Sha256: b7226b61543b1280a8cc1b846ac465950c027029ae6ad8affb52864fd91059b4

Contents?: true

Size: 944 Bytes

Versions: 16

Compression:

Stored size: 944 Bytes

Contents

# frozen_string_literal: true

# takelage 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

16 entries across 16 versions & 1 rubygems

Version Path
takelage-0.19.2 lib/takelage/bit/scope/list.rb
takelage-0.19.1 lib/takelage/bit/scope/list.rb
takelage-0.19.0 lib/takelage/bit/scope/list.rb
takelage-0.18.1 lib/takelage/bit/scope/list.rb
takelage-0.18.0 lib/takelage/bit/scope/list.rb
takelage-0.17.1 lib/takelage/bit/scope/list.rb
takelage-0.17.0 lib/takelage/bit/scope/list.rb
takelage-0.16.0 lib/takelage/bit/scope/list.rb
takelage-0.15.1 lib/takelage/bit/scope/list.rb
takelage-0.15.0 lib/takelage/bit/scope/list.rb
takelage-0.14.5 lib/takelage/bit/scope/list.rb
takelage-0.14.4 lib/takelage/bit/scope/list.rb
takelage-0.14.3 lib/takelage/bit/scope/list.rb
takelage-0.14.2 lib/takelage/bit/scope/list.rb
takelage-0.14.1 lib/takelage/bit/scope/list.rb
takelage-0.14.0 lib/takelage/bit/scope/list.rb