class TerraspaceBundler::Mod::Props::Typer

Attributes

props[R]

Public Class Methods

new(props) click to toggle source
# File lib/terraspace_bundler/mod/props/typer.rb, line 9
def initialize(props)
  @props = props # Props.new object
end

Public Instance Methods

type() click to toggle source

IE: git or registry

# File lib/terraspace_bundler/mod/props/typer.rb, line 14
def type
  if source.include?('::')
    source.split('::').first # IE: git:: s3:: gcs::
  elsif local?
    "local"
  elsif registry?
    "registry"
  else
    "git"
  end
end

Private Instance Methods

registry?() click to toggle source

dont use registry? externally. instead use type since it can miss local detection

# File lib/terraspace_bundler/mod/props/typer.rb, line 28
def registry?
  if source.nil? ||
     source.starts_with?('git@') || # git@github.com:tongueroo/pet
     source.starts_with?('http') || # https://github.com/tongueroo/pet
     source.include?('::')          # git::https:://git.example.com/pet
     return false
  end
  s = remove_notations(@props.source)
  s.split('/').size == 3 || s.split('/').size == 4
end