Sha256: c90e6ea0e39a91b7e7dbf8a2ac36e7321ac06a8cf7bd425585b04eb2ab4e2488

Contents?: true

Size: 523 Bytes

Versions: 6

Compression:

Stored size: 523 Bytes

Contents

module TerraspaceBundler
  class Extract
    def self.extract(archive, dest)
      FileUtils.rm_rf(dest)
      FileUtils.mkdir_p(File.dirname(dest))

      if archive.ends_with?('.tgz') || archive.ends_with?('.tar.gz')
        Tar.extract(archive, dest)
      elsif archive.ends_with?('.zip')
        Zip.extract(archive, dest)
      else
        puts <<~EOL.color(:red)
          ERROR: Unable to extract. Unsupported archive extension for:

              #{archive}
        EOL
        exit 1
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
terraspace-bundler-0.5.0 lib/terraspace_bundler/extract.rb
terraspace-bundler-0.4.4 lib/terraspace_bundler/extract.rb
terraspace-bundler-0.4.3 lib/terraspace_bundler/extract.rb
terraspace-bundler-0.4.2 lib/terraspace_bundler/extract.rb
terraspace-bundler-0.4.1 lib/terraspace_bundler/extract.rb
terraspace-bundler-0.4.0 lib/terraspace_bundler/extract.rb