Class: TerraspaceBundler::Exporter

Inherits:
Object
  • Object
show all
Includes:
TB::Mod::Concerns::PathConcern, TB::Util::Logging
Defined in:
lib/terraspace_bundler/exporter.rb,
lib/terraspace_bundler/exporter/base.rb,
lib/terraspace_bundler/exporter/copy.rb,
lib/terraspace_bundler/exporter/stacks.rb

Defined Under Namespace

Classes: Base, Copy, Stacks

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Exporter

Returns a new instance of Exporter.



6
7
8
# File 'lib/terraspace_bundler/exporter.rb', line 6

def initialize(options={})
  @options = options
end

Instance Method Details

#export(mod) ⇒ Object



27
28
29
30
31
32
33
34
35
# File 'lib/terraspace_bundler/exporter.rb', line 27

def export(mod)
  fetcher = Mod::Fetcher.new(mod).instance
  fetcher.run
  fetcher.switch_version(mod.sha)
  copy = Copy.new(mod)
  copy.mod
  copy.stacks
  logger.debug "Exported: #{copy.mod_path}"
end

#modsObject



19
20
21
22
23
24
25
# File 'lib/terraspace_bundler/exporter.rb', line 19

def mods
  mods = lockfile.mods
  if TB.update_mode? && !@options[:mods].empty?
    mods.select! { |mod| @options[:mods].include?(mod.name) }
  end
  mods
end

#runObject



10
11
12
13
14
15
16
17
# File 'lib/terraspace_bundler/exporter.rb', line 10

def run
  purge_all
  mods.each do |mod|
    logger.info "Exporting #{mod.name}"
    purge(mod)
    export(mod)
  end
end