module VCDetect
VCDetect
- detect version control software for file paths
Assumes version control data is stored on the file system in plain, unambiguous, per-project fashion. This precludes the ability to detect arcane and offbeat version control software such as cvsnt, svk, and vss.
Constants
- FILE2VC
Version control internal data file to version control software names (command line tools, as symbols)
- FILES
Version control internal data files
- HOME
- PARENT_OF_HOME
- VC2FILE
Version control software names (command line tools, as symbols) to version control internal data file
- VCS
Version control software names (command line tools, as symbols)
- VERSION
Public Class Methods
detect(path)
click to toggle source
Detect version control software managing a file path
Assumes path exists. Assuems path is relative to $HOME.
@path a file path (String)
# File lib/vcdetect.rb, line 70 def self.detect(path) parent = File.expand_path('..', path) if !File.directory?(path) detect(parent) elsif path == PARENT_OF_HOME :unknown else software = FILES.select do |vc_dir| Dir.new(path).entries.include?(vc_dir) end if software.length == 0 detect(parent) elsif software.length == 1 FILE2VC[software.first] else software.map do |s| FILE2VC[s] end end end end