Sha256: c8b8637237848a8ec64df06caf1cf0e06e542bc67c1a790cc9687b7af19ae949

Contents?: true

Size: 900 Bytes

Versions: 3

Compression:

Stored size: 900 Bytes

Contents

# encoding: UTF-8

module Tetra
  # implements a to_archive method
  module Archiver
    include Logging
    # expected attributes:
    #   project (Tetra::Project)
    #   package_name (string)
    #   source_dir (string)
    #   source_paths ([string])
    #   destination_dir (string)

    # generates an archive and returns its name
    # this will archive source_paths starting from source_dir in
    # destination_dir + package_name + extension
    def to_archive
      full_destination_dir = File.join(project.full_path, "output", destination_dir)
      FileUtils.mkdir_p(full_destination_dir)

      project.from_directory(source_dir) do
        destination_path = File.join(full_destination_dir, "#{package_name}.tar.xz")
        log.debug "creating #{destination_path}"

        `tar -cJf #{destination_path} #{source_paths.join(" ")}`

        destination_path
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tetra-0.43.0 lib/tetra/archiver.rb
tetra-0.42.0 lib/tetra/archiver.rb
tetra-0.41.0 lib/tetra/archiver.rb