module Rookout::ComWs::Git
Constants
- GIT_CONFIG
- GIT_FOLDER
- GIT_HEAD
- REMOTE_ORIGINS
Public Instance Methods
find_root(path)
click to toggle source
# File lib/rookout/com_ws/git.rb, line 10 def find_root path # Return if found return path if git? path # Get next, fail if there's no next next_path = File.dirname path return nil if next_path == path # Recursive call find_root next_path end
follow_sym_links(root, link)
click to toggle source
# File lib/rookout/com_ws/git.rb, line 40 def follow_sym_links root, link link_path = File.join root, link link_contents = File.read link_path if link_contents.start_with? "ref:" next_link = (link_contents.split " ")[1].strip follow_sym_links root, next_link else link_contents.strip end end
git?(path)
click to toggle source
# File lib/rookout/com_ws/git.rb, line 35 def git? path potential_git_folder = File.join path, GIT_FOLDER File.directory? potential_git_folder end
remote_origin(path)
click to toggle source
# File lib/rookout/com_ws/git.rb, line 26 def remote_origin path git_config_path = File.join path, GIT_FOLDER, GIT_CONFIG git_config_contents = File.read git_config_path match = git_config_contents.match REMOTE_ORIGINS return "" if match.captures.empty? match.captures[0] end
revision(path)
click to toggle source
# File lib/rookout/com_ws/git.rb, line 22 def revision path follow_sym_links File.join(path, GIT_FOLDER), GIT_HEAD end