class BetweenMeals::Repo
Local checkout wrapper
Attributes
bin[R]
repo_path[R]
Public Class Methods
get(type, repo_path, logger)
click to toggle source
# File lib/between_meals/repo.rb, line 35 def self.get(type, repo_path, logger) case type when 'auto' unless File.directory?(repo_path) logger.warn("#{repo_path} does not point to a repo") exit(1) end logger.info('Trying to detect repo type') require 'between_meals/repo/git' require 'between_meals/repo/hg' require 'between_meals/repo/svn' [ BetweenMeals::Repo::Git, BetweenMeals::Repo::Hg, BetweenMeals::Repo::Svn, ].each do |klass| begin r = klass.new(repo_path, logger) if r.exists? logger.info("Repo found to be #{klass.to_s.split('::').last}") return r end rescue StandardError logger.debug("Skipping #{klass}") end end logger.warn("Failed detecting repo type at #{repo_path}") exit(1) when 'svn' require 'between_meals/repo/svn' BetweenMeals::Repo::Svn.new(repo_path, logger) when 'git' require 'between_meals/repo/git' BetweenMeals::Repo::Git.new(repo_path, logger) when 'hg' require 'between_meals/repo/hg' BetweenMeals::Repo::Hg.new(repo_path, logger) else fail "Do not know repo type #{type}" end end
new(repo_path, logger)
click to toggle source
# File lib/between_meals/repo.rb, line 24 def initialize(repo_path, logger) @repo_path = repo_path @logger = logger @repo = nil @bin = nil setup rescue StandardError @logger.warn("Unable to read repo from #{File.expand_path(repo_path)}") exit(1) end
Public Instance Methods
bin=(bin)
click to toggle source
# File lib/between_meals/repo.rb, line 77 def bin=(bin) @bin = bin @cmd.bin = bin end
changes(_start_ref, _end_ref)
click to toggle source
Return files changed between two revisions
# File lib/between_meals/repo.rb, line 128 def changes(_start_ref, _end_ref) fail "#{__method__} not implemented" end
checkout()
click to toggle source
# File lib/between_meals/repo.rb, line 145 def checkout fail "#{__method__} not implemented" end
create(_url)
click to toggle source
# File lib/between_meals/repo.rb, line 123 def create(_url) fail "#{__method__} not implemented" end
email()
click to toggle source
# File lib/between_meals/repo.rb, line 165 def email fail "#{__method__} not implemented" end
exists?()
click to toggle source
# File lib/between_meals/repo.rb, line 82 def exists? fail "#{__method__} not implemented" end
files()
click to toggle source
Return all files
# File lib/between_meals/repo.rb, line 137 def files fail "#{__method__} not implemented" end
head()
click to toggle source
# File lib/between_meals/repo.rb, line 141 def head fail "#{__method__} not implemented" end
head_msg()
click to toggle source
# File lib/between_meals/repo.rb, line 107 def head_msg fail "#{__method__} not implemented" end
head_msg=()
click to toggle source
# File lib/between_meals/repo.rb, line 111 def head_msg= fail "#{__method__} not implemented" end
head_parents()
click to toggle source
# File lib/between_meals/repo.rb, line 115 def head_parents fail "#{__method__} not implemented" end
head_rev()
click to toggle source
# File lib/between_meals/repo.rb, line 103 def head_rev fail "#{__method__} not implemented" end
last_msg()
click to toggle source
# File lib/between_meals/repo.rb, line 153 def last_msg fail "#{__method__} not implemented" end
last_msg=()
click to toggle source
# File lib/between_meals/repo.rb, line 157 def last_msg= fail "#{__method__} not implemented" end
latest_revision()
click to toggle source
# File lib/between_meals/repo.rb, line 119 def latest_revision fail "#{__method__} not implemented" end
name()
click to toggle source
# File lib/between_meals/repo.rb, line 161 def name fail "#{__method__} not implemented" end
repo_object()
click to toggle source
Only interesting in the case of git where we have an underlying repo object courtesy of Rugged.
# File lib/between_meals/repo.rb, line 92 def repo_object fail "#{__method__} not implemented" end
setup()
click to toggle source
This method must succeed in the case of no repo directory so that users can call `checkout`. Users may call `exists?` to find out if we have an underlying repo yet.
# File lib/between_meals/repo.rb, line 99 def setup fail "#{__method__} not implemented" end
status()
click to toggle source
# File lib/between_meals/repo.rb, line 86 def status fail "#{__method__} not implemented" end
update()
click to toggle source
# File lib/between_meals/repo.rb, line 132 def update fail "#{__method__} not implemented" end
upstream?(_rev)
click to toggle source
# File lib/between_meals/repo.rb, line 169 def upstream?(_rev) fail "#{__method__} not implemented" end
valid_ref?(_rev)
click to toggle source
# File lib/between_meals/repo.rb, line 173 def valid_ref?(_rev) fail "#{__method__} not implemented" end