Sha256: f6650dece38ed9eb6ce30e36e04bdf76b9caf677c97458c70d760c5e02abb170
Contents?: true
Size: 993 Bytes
Versions: 3
Compression:
Stored size: 993 Bytes
Contents
require 'tmpdir' module Heirloom class Directory attr_reader :local_build def initialize(args) @config = args[:config] @exclude = args[:exclude] @path = args[:path] @logger = @config.logger end def build_artifact_from_directory random_text = (0...8).map{65.+(Kernel.rand(25)).chr}.join @local_build = File.join(Dir.tmpdir, random_text + ".tar.gz") @logger.info "Building Heirloom '#{@local_build}' from '#{@path}'." @logger.info "Excluding #{@exclude.to_s}." @logger.info "Adding #{files_to_pack.to_s}." build_archive end private def build_archive command = "tar czf #{@local_build} #{files_to_pack.join(' ')}" @logger.info "Archiving with: `#{command}`" output = `#{command}` @logger.debug "Exited with status: '#{$?.exitstatus}' ouput: '#{output}'" $?.success? end def files_to_pack Dir.entries(@path) - ['.', '..'] - @exclude end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
heirloom-0.5.0rc1 | lib/heirloom/directory/directory.rb |
heirloom-0.4.1rc1 | lib/heirloom/directory/directory.rb |
heirloom-0.4.0 | lib/heirloom/directory/directory.rb |