Sha256: 3193fbc6543d5cb0eb22c879641ad9bc4623a4ef633079451202e871ff8696db
Contents?: true
Size: 1.08 KB
Versions: 1
Compression:
Stored size: 1.08 KB
Contents
module Coral class Git < ::Grit::Repo #----------------------------------------------------------------------------- # Constructor / Destructor def initialize(path, options = {}) epath = File.expand_path(path) git_dir = File.join(epath, '.git') @bare = (options[:is_bare] ? true : false) if File.exist?(git_dir) self.working_dir = epath if File.directory?(git_dir) self.path = git_dir else git_dir = Util::Disk.read(git_dir) unless git_dir.nil? git_dir = git_dir.gsub(/^gitdir\:\s*/, '').strip self.path = git_dir if File.directory?(git_dir) end end elsif File.directory?(epath) && (options[:is_bare] || (epath =~ /\.git$/ && File.exist?(File.join(epath, 'HEAD')))) self.path = epath @bare = true end self.git = ::Grit::Git.new(self.path) self.git.work_tree = epath unless File.directory?(epath) && self.git.exist? FileUtils.mkdir_p(epath) unless File.directory?(epath) self.git.init({ :bare => @bare }) end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
coral_core-0.2.30 | lib/coral_core/util/git.rb |