Sha256: cf98c556e2658df27fd6d79a4120b471ad84f58397a38d72356027c7ff8c45b7
Contents?: true
Size: 706 Bytes
Versions: 9
Compression:
Stored size: 706 Bytes
Contents
require 'minigit' module Aerosol::Util extend self def is_tar?(path) if File.size(path) < 262 return false end magic = nil File.open(path, "r") do |f| f.read(257) magic = f.read(5) end magic == "ustar" end def is_gzip?(path) if File.size(path) < 2 return false end magic = nil File.open(path, "r") do |f| magic = f.read(2) end magic = magic.unpack('H*')[0] magic == "1f8b" end def strip_heredoc(str) str.gsub(/^#{str[/\A\s*/]}/, '') end def git_repo @git_repo ||= MiniGit.new('.') end def git_sha @git_sha ||= git_repo.capturing.rev_parse('HEAD').chomp[0..6] rescue 'unknown' end end
Version data entries
9 entries across 9 versions & 1 rubygems