Sha256: d141e4b90d13d3e07ad87d646b832b0210c21aa0fd2d4360ac830d9936924883
Contents?: true
Size: 702 Bytes
Versions: 12
Compression:
Stored size: 702 Bytes
Contents
module Dockly::Util::Git module_function def repo @repo ||= MiniGit.new('.') end def sha return @sha if @sha @sha = repo.capturing.rev_parse('HEAD').chomp rescue @sha = 'unknown' end def archive(oid, prefix, output) prefix = prefix.dup unless prefix[-1] == '/'; prefix << '/'; end cmd = ['git','archive',"--prefix=#{prefix}",'--output=/dev/stdout',oid] Open3.popen3(*cmd) do |stdin, stdout, stderr, wait_thr| stdin.close output.write(stdout.read) process_status = wait_thr.value exit_status = process_status.exitstatus raise "#{cmd.join(' ')} exitted non-zero: #{exit_status}" unless exit_status.zero? end end end
Version data entries
12 entries across 12 versions & 1 rubygems