Class: TerraspaceBundler::Mod::Fetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/terraspace_bundler/mod/fetcher/base.rb,
lib/terraspace_bundler/mod/fetcher.rb,
lib/terraspace_bundler/mod/fetcher/s3.rb,
lib/terraspace_bundler/mod/fetcher/gcs.rb,
lib/terraspace_bundler/mod/fetcher/git.rb,
lib/terraspace_bundler/mod/fetcher/local.rb

Overview

Interface of subclasses should implement

run
switch_version(mod.sha)
sha

Defined Under Namespace

Classes: Base, Gcs, Git, Local, S3

Instance Method Summary collapse

Constructor Details

#initialize(mod) ⇒ Fetcher

Returns a new instance of Fetcher.



8
9
10
# File 'lib/terraspace_bundler/mod/fetcher.rb', line 8

def initialize(mod)
  @mod = mod
end

Instance Method Details

#instanceObject



12
13
14
15
16
# File 'lib/terraspace_bundler/mod/fetcher.rb', line 12

def instance
  type = @mod.type == "registry" ? "git" : @mod.type
  klass = "TerraspaceBundler::Mod::Fetcher::#{type.camelize}".constantize
  klass.new(@mod) # IE: Local.new(@mod), Git.new(@mod), S3.new(@mod), etc
end