class BetweenMeals::Repo
Local checkout wrapper
Attributes
Public Class Methods
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
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
Source
# File lib/between_meals/repo.rb, line 77 def bin=(bin) @bin = bin @cmd.bin = bin end
Source
# File lib/between_meals/repo.rb, line 128 def changes(_start_ref, _end_ref) fail "#{__method__} not implemented" end
Return files changed between two revisions
Source
# File lib/between_meals/repo.rb, line 145 def checkout fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 123 def create(_url) fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 165 def email fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 82 def exists? fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 137 def files fail "#{__method__} not implemented" end
Return all files
Source
# File lib/between_meals/repo.rb, line 141 def head fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 107 def head_msg fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 111 def head_msg= fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 115 def head_parents fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 103 def head_rev fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 153 def last_msg fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 157 def last_msg= fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 119 def latest_revision fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 161 def name fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 92 def repo_object fail "#{__method__} not implemented" end
Only interesting in the case of git where we have an underlying repo object courtesy of Rugged.
Source
# File lib/between_meals/repo.rb, line 99 def setup fail "#{__method__} not implemented" end
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.
Source
# File lib/between_meals/repo.rb, line 86 def status fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 132 def update fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 169 def upstream?(_rev) fail "#{__method__} not implemented" end
Source
# File lib/between_meals/repo.rb, line 173 def valid_ref?(_rev) fail "#{__method__} not implemented" end