Module: BitScopeList

Included in:
Takelage::BitRequire, Takelage::BitScope
Defined in:
lib/takelage/bit/scope/list.rb

Overview

takelage bit scope list

Instance Method Summary collapse

Instance Method Details

#bit_scope_listString

Backend method for bit scope list.

Returns:

  • (String)

    list of bit scopes



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/takelage/bit/scope/list.rb', line 7

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