Sha256: 9ba567f691b190d72c1e0a11b6716eed9d020405f0ac0ef32a2214267bd4b92b

Contents?: true

Size: 779 Bytes

Versions: 1

Compression:

Stored size: 779 Bytes

Contents

# frozen_string_literal: true

##
# Create the release package as a tarball.
#
# Offers:
# *  +:build_package+
class Cartage::BuildTarball < Cartage::Plugin
  # Create the package.
  #
  # Requests:
  # *  +:pre_build_tarball+
  # *  +:post_build_tarball+
  def build_package
    cartage.plugins.request(:pre_build_tarball)
    run_command
    cartage.plugins.request(:post_build_tarball)
  end

  # The final tarball name.
  def package_name
    @package_name ||=
      Pathname("#{cartage.final_name}.tar#{cartage.tar_compression_extension}")
  end

  private

  def run_command
    command = [
      "tar",
      "cf#{cartage.tar_compression_flag}",
      package_name.to_s,
      "-C",
      cartage.tmp_path.to_s,
      cartage.name
    ]

    cartage.run command
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cartage-2.2.1 lib/cartage/plugins/build_tarball.rb