Module: ErrorLog::Vcs
- Defined in:
- lib/error_log/vcs.rb
Overview
VCS would be a better name, I’m just sticking to rails file and modules naming convention
Class Method Summary collapse
Class Method Details
.guess ⇒ Object
4 5 6 7 8 9 |
# File 'lib/error_log/vcs.rb', line 4 def self.guess if File.exists?(File.join(Rails.root,'.git')) return :git end false end |
.revision ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/error_log/vcs.rb', line 11 def self.revision case ErrorLog.[:vcs] when :git git_root = File.join(Rails.root,'.git') head = File.read("#{git_root}/HEAD") ref = head.strip.split("ref:",2).last.strip hash = File.read("#{git_root}/#{ref}").strip else '' end end |