Sha256: c302d64851f85eee87ea8ce33018cb791a833a9dc8b5a882210611b94d80cbed
Contents?: true
Size: 1.24 KB
Versions: 3
Compression:
Stored size: 1.24 KB
Contents
# to make refs work! module Grit class Commit attr_accessor :refs end end module Ginatra # Convenience class for me! class Repo attr_reader :name, :param, :description def initialize(path) @repo = Grit::Repo.new(path) @param = File.split(path).last @name = @param @description = @repo.description @description = "Please edit the #{@repo.path}/description file for this repository and set the description for it." if /^Unnamed repository;/.match(@description) @repo end def commit(id) @commit = @repo.commit(id) raise(Ginatra::InvalidCommit.new(id)) if @commit.nil? add_refs(@commit) @commit end def commits(start = 'master', max_count = 10, skip = 0) raise(Ginatra::Error.new("max_count cannot be less than 0")) if max_count < 0 @repo.commits(start, max_count, skip).each do |commit| add_refs(commit) end end # TODO: Perhaps move into commit class. def add_refs(commit) commit.refs = [] refs = @repo.refs.select { |ref| ref.commit.id == commit.id } commit.refs << refs commit.refs.flatten! end def method_missing(sym, *args, &block) @repo.send(sym, *args, &block) end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
lenary-ginatra-2.0.2 | lib/ginatra/repo.rb |
ginatra-2.0.2 | lib/ginatra/repo.rb |
ginatra-2.0.1 | lib/ginatra/repo.rb |