Sha256: 8d0a611655b564ce9eecce23c3c29834537b44a657a855eb47b82177d3d0583c

Contents?: true

Size: 1.02 KB

Versions: 61

Compression:

Stored size: 1.02 KB

Contents

# frozen_string_literal: true

# takelage bit scope new
module BitScopeNew
  # Backend method for bit scope new.
  # @return [Int] status of new command
  def bit_scope_new(scope)
    log.debug "Creating new bit remote scope \"#{scope}\""

    return false unless configured? %w[bit_ssh bit_remote]

    return false if _bit_scope_new_scope_exists? scope

    cmd_bit_ssh = config.active['bit_ssh']

    cmd_bit_scope_new = _bit_scope_new_cmd scope

    run "#{cmd_bit_ssh} '#{cmd_bit_scope_new}'"

    log.info "Created new bit remote scope \"#{scope}\""
  end

  private

  # Check if bit scope already exists.
  def _bit_scope_new_scope_exists?(scope)
    scope_list = bit_scope_list
    return false unless scope_list.include? scope

    log.error "The remote bit scope \"#{scope}\" already exists"
    false
  end

  # Prepare bit scope new command.
  def _bit_scope_new_cmd(scope)
    root = config.active['bit_root']

    format(
      config.active['cmd_bit_scope_new_bit_init'],
      scope: scope,
      root: root
    )
  end
end

Version data entries

61 entries across 61 versions & 1 rubygems

Version Path
takelage-0.28.11 lib/takelage/bit/scope/new.rb
takelage-0.28.8 lib/takelage/bit/scope/new.rb
takelage-0.28.7 lib/takelage/bit/scope/new.rb
takelage-0.28.5 lib/takelage/bit/scope/new.rb
takelage-0.27.1 lib/takelage/bit/scope/new.rb
takelage-0.27.0 lib/takelage/bit/scope/new.rb
takelage-0.26.7 lib/takelage/bit/scope/new.rb
takelage-0.26.4 lib/takelage/bit/scope/new.rb
takelage-0.26.3 lib/takelage/bit/scope/new.rb
takelage-0.26.2 lib/takelage/bit/scope/new.rb
takelage-0.25.10 lib/takelage/bit/scope/new.rb
takelage-0.25.8 lib/takelage/bit/scope/new.rb
takelage-0.24.0 lib/takelage/bit/scope/new.rb
takelage-0.23.3 lib/takelage/bit/scope/new.rb
takelage-0.23.2 lib/takelage/bit/scope/new.rb
takelage-0.23.1 lib/takelage/bit/scope/new.rb
takelage-0.23.0 lib/takelage/bit/scope/new.rb
takelage-0.22.2 lib/takelage/bit/scope/new.rb
takelage-0.22.1 lib/takelage/bit/scope/new.rb
takelage-0.22.0 lib/takelage/bit/scope/new.rb