Sha256: ebdf5ff1a8f3cc6dc9056cffd7f8daac6c283d82c8574f8c3cd733e2c4f7ce55
Contents?: true
Size: 757 Bytes
Versions: 3
Compression:
Stored size: 757 Bytes
Contents
require 'zlib' require 'archive/tar/minitar' require 'tmpdir' require 'grit' include Archive::Tar include Grit module Heirloom class GitDirectory def initialize(args) @directory = args[:directory] @logger = args[:logger] end def commit(sha = nil) r = Repo.new @directory sha ? r.commits(sha).first : r.commits.first end def build_artifact_from_directory random_text = (0...8).map{65.+(rand(25)).chr}.join temp_file_name = File.join(Dir.tmpdir, random_text + ".tar.gz") @logger.info "Building artifact '#{temp_file_name}' from '#{@directory}'." tgz = Zlib::GzipWriter.new File.open(temp_file_name, 'wb') Minitar.pack(@directory, tgz) temp_file_name end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
heirloom-0.1.0 | lib/heirloom/directory/git_directory.rb |
heirloom-0.0.9 | lib/heirloom/directory/git_directory.rb |
heirloom-0.0.8 | lib/heirloom/directory/git_directory.rb |