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.21.1 lib/takelage/bit/scope/new.rb
takelage-0.21.0 lib/takelage/bit/scope/new.rb
takelage-0.20.2 lib/takelage/bit/scope/new.rb
takelage-0.20.1 lib/takelage/bit/scope/new.rb
takelage-0.20.0 lib/takelage/bit/scope/new.rb
takelage-0.19.2 lib/takelage/bit/scope/new.rb
takelage-0.19.1 lib/takelage/bit/scope/new.rb
takelage-0.19.0 lib/takelage/bit/scope/new.rb
takelage-0.18.1 lib/takelage/bit/scope/new.rb
takelage-0.18.0 lib/takelage/bit/scope/new.rb
takelage-0.17.1 lib/takelage/bit/scope/new.rb
takelage-0.17.0 lib/takelage/bit/scope/new.rb
takelage-0.16.0 lib/takelage/bit/scope/new.rb
takelage-0.15.1 lib/takelage/bit/scope/new.rb
takelage-0.15.0 lib/takelage/bit/scope/new.rb
takelage-0.14.5 lib/takelage/bit/scope/new.rb
takelage-0.14.4 lib/takelage/bit/scope/new.rb
takelage-0.14.3 lib/takelage/bit/scope/new.rb
takelage-0.14.2 lib/takelage/bit/scope/new.rb
takelage-0.14.1 lib/takelage/bit/scope/new.rb