Sha256: dd253b3748b61cd51a07a7e16fcbf71560129f97987e44f2d84ddb91cf06a639

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 Bytes

Contents

module TerraspaceBundler::Util
  module Registry
    extend Memoist

    def registry?(url)
      !url.nil? && url.split('/').size == 3
    end

    def registry_github
      TB::Mod::Registry.new(self).to_github
    end
    memoize :registry_github

    def obtain_org(source_option, global_org=nil)
      source = registry?(source_option) ? registry_github : source_option
      parts = source.split('/') # IE: git@github.com:boltopspro/terraform-google-vm
      if parts.size == 1
        global_org
      else
        parts[-2..-2].first
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
terraspace-bundler-0.1.0 lib/terraspace_bundler/util/registry.rb