Sha256: 69a2f1e6c18197c9138b3bf19b70f0707f2c3ee7876c103b9c0ee1368cb5e3da
Contents?: true
Size: 959 Bytes
Versions: 1
Compression:
Stored size: 959 Bytes
Contents
require 'grit' require 'cgi' class Ginst::Project class Ref < Struct.new(:project, :repo,:name,:grit_commit) def commits repo.commits(grit_commit.id).map{|c| Commit.new(project, c) } end def commit self.grit_commit.id end end class Commit < Grit::Commit def initialize(project,c) @project = project c.instance_variables.each do |var| instance_variable_set(var, c.send(:instance_variable_get, var)) end end end # Return an array of Refs def refs repo.refs.map{ |ref| Ref.new(self,repo,ref.name,ref.commit) } end def find_ref(name) refs.select{|r| r.name == name}.first || nil end def find_commit(commit_id) commit = repo.commit(commit_id) and Commit.new(self,commit) rescue nil end protected def repo @repo ||= Grit::Repo.new(@dir) rescue [] end def commit(id) repo.commit(id) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ginst-0.2.2 | lib/ginst/project/grit.rb |