Sha256: b7cc64309b582b2e32ed37c5b88d1bcc561dee01bf93ade94dc352dce620c06b
Contents?: true
Size: 624 Bytes
Versions: 2
Compression:
Stored size: 624 Bytes
Contents
require "git-hack/version" Dir["#{File.dirname(__FILE__)}/**/*.rb"].each { |f| require f } require "git" module GitHack def self.current @current || get_dir('.') end def self.commit current.commit end private # get_dir(path) 检查给定目录是否在git受控目录中 # 本身是git目录返回 GitProject # 本身不是,但上层是返回GitProject,并设置dir # 本身不是,上层也不是则返回RawDir def self.get_dir(path) return GitRepo.new(path) if is_git(path) return get_dir(File.join(path,"/../")) end def self.is_git(path) File.directory?(File.join(path,"/.git")) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
git-hack-0.0.2 | lib/git-hack.rb |
git-hack-0.0.1 | lib/git-hack.rb |