Sha256: 10beb7efec559baba288645619ff6f7f7e3374325d947491b5425fd74f588363

Contents?: true

Size: 1.1 KB

Versions: 6

Compression:

Stored size: 1.1 KB

Contents

class Lono::Bundler::Component::Props
  class Typer
    include Lono::Bundler::Component::Concerns::LocalConcern
    include Lono::Bundler::Component::Concerns::NotationConcern

    delegate :source, to: :props

    attr_reader :props
    def initialize(props)
      @props = props # Props.new object
    end

    # IE: git or registry
    def source_type
      if source.include?('ssh://')
        "git"
      elsif source.include?('::')
        source.split('::').first # IE: git:: s3:: gcs::
      elsif local?
        "local"
      elsif registry?
        "registry"
      else
        "git"
      end
    end

  private
    # dont use registry? externally. instead use type since it can miss local detection
    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
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
lono-8.0.0.pre.rc6 lib/lono/bundler/component/props/typer.rb
lono-8.0.0.pre.rc5 lib/lono/bundler/component/props/typer.rb
lono-8.0.0.pre.rc4 lib/lono/bundler/component/props/typer.rb
lono-8.0.0.pre.rc3 lib/lono/bundler/component/props/typer.rb
lono-8.0.0.pre.rc2 lib/lono/bundler/component/props/typer.rb
lono-8.0.0.pre.rc1 lib/lono/bundler/component/props/typer.rb