Sha256: 03a001acc3c03035e14701d672dedd54f332b64d8e0781b9b76cc6cc59e1e4f2

Contents?: true

Size: 700 Bytes

Versions: 2

Compression:

Stored size: 700 Bytes

Contents

module TerraspaceBundler
  class Exporter
    include TB::Util::Logging

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

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

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

  private
    def purge
      return unless TB.config.export_purge
      FileUtils.rm_rf(TB.config.export_to)
    end

    def lockfile
      Lockfile.instance
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
terraspace-bundler-0.3.1 lib/terraspace_bundler/exporter.rb
terraspace-bundler-0.3.0 lib/terraspace_bundler/exporter.rb