Sha256: 53b418b7fb74a1b2652d563951cf276ca700af1fb71aad5a17e021ffeaf3d737

Contents?: true

Size: 693 Bytes

Versions: 3

Compression:

Stored size: 693 Bytes

Contents

require 'zip_folder'

class Terraspace::Cloud::Folder
  class Package < Base
    def build
      copy
      tidy
      zip # returns zip path
    end

    def copy
      FileUtils.rm_rf(artifacts_path)
      FileUtils.mkdir_p(File.dirname(artifacts_path))

      expr = "#{@mod.cache_dir}/.terraspace-cache/_cache2/#{@type}/*"
      Dir.glob(expr).each do |src|
        dest = "#{artifacts_path}/#{File.basename(src)}"
        FileUtils.mkdir_p(File.dirname(dest))
        FileUtils.cp(src, dest)
      end
    end

    def tidy
      Tidy.new(@options).cleanup
    end

    def zip
      FileUtils.rm_f(zip_path)
      ZipFolder.zip(artifacts_path, zip_path)
      zip_path
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
terraspace-2.0.2 lib/terraspace/cloud/folder/package.rb
terraspace-2.0.1 lib/terraspace/cloud/folder/package.rb
terraspace-2.0.0 lib/terraspace/cloud/folder/package.rb