class TerraspaceBundler::Mod
Delegates to:
1. Local 2. Git
Use to build mod from Terrafile entry. The Terrafile.lock does not need this because it's simple and just merges the data.
Attributes
branch[R]
props[R]
ref[R]
tag[R]
version[R]
Public Class Methods
new(props={})
click to toggle source
# File lib/terraspace_bundler/mod.rb, line 10 def initialize(props={}) @props = props.symbolize_keys # These props are used for version comparing by VersionComparer @version, @ref, @tag, @branch = @props[:version], @props[:ref], @props[:tag], @props[:branch] end
Public Instance Methods
checkout_version()
click to toggle source
support variety of options, prefer version
# File lib/terraspace_bundler/mod.rb, line 17 def checkout_version @version || @ref || @tag || @branch end
full_repo()
click to toggle source
# File lib/terraspace_bundler/mod.rb, line 33 def full_repo "#{org}/#{repo}" end
latest_sha()
click to toggle source
# File lib/terraspace_bundler/mod.rb, line 37 def latest_sha fetcher = Fetcher.new(self).instance fetcher.run fetcher.sha end
org()
click to toggle source
github.com/tongueroo/pet - 2nd to last word git@github.com:tongueroo/pet - 2nd to last word without chars before :
# File lib/terraspace_bundler/mod.rb, line 28 def org s = url_words[-2] # second to last word s.split(':').last # in case of git@github.com:tongueroo/pet form end
repo()
click to toggle source
use url instead of source because for registry modules, the repo name is different
# File lib/terraspace_bundler/mod.rb, line 22 def repo url_words[-1].sub(/\.git$/,'') end
vcs_provider()
click to toggle source
# File lib/terraspace_bundler/mod.rb, line 43 def vcs_provider if url.include?('http') # "https://github.com/org/repo" => github.com url.match(%r{http[s]?://(.*?)/})[1] else # git@ # "git@github.com:org/repo" => github.com url.match(%r{git@(.*?):})[1] end end
Private Instance Methods
url_words()
click to toggle source
# File lib/terraspace_bundler/mod.rb, line 54 def url_words url.split('/') end