module BitScopeAdd

takeltau bit scope add

Public Instance Methods

bit_scope_add(scope) click to toggle source

Backend method for bit scope add.

# File lib/takeltau/bit/scope/add.rb, line 6
def bit_scope_add(scope)
  log.info "Adding bit remote scope \"#{scope}\" to local workspace"

  return false unless configured? %w[bit_ssh bit_remote]

  return false unless _bit_scope_add_workspace_ready?

  return false unless _bit_scope_add_scope_exists? scope

  run _bit_scope_add_cmd scope

  log.info "Added bit remote scope \"#{scope}\" to local bit workspace"
end

Private Instance Methods

_bit_scope_add_cmd(scope) click to toggle source

Prepare bit add scope command.

# File lib/takeltau/bit/scope/add.rb, line 46
def _bit_scope_add_cmd(scope)
  remote = config.active['bit_remote']

  format(
    config.active['cmd_bit_scope_add_scope'],
    remote: remote,
    scope: scope
  )
end
_bit_scope_add_scope_exists?(scope) click to toggle source

Check if bit remote scope exists.

# File lib/takeltau/bit/scope/add.rb, line 38
def _bit_scope_add_scope_exists?(scope)
  return true if bit_scope_list.include? scope

  log.error "The bit remote bit scope \"#{scope}\" doesn't exist"
  false
end
_bit_scope_add_workspace_ready?() click to toggle source

Check if workspace ready for bit scope add.

# File lib/takeltau/bit/scope/add.rb, line 23
def _bit_scope_add_workspace_ready?
  unless bit_check_workspace
    log.error 'No bit workspace'
    return false
  end

  return true unless git_check_workspace

  return true if git_check_bit

  log.error 'Not on git main branch'
  false
end