commit.rb revision c140a278d85cbeebd590129c5ea258e092cfaab4
ccf9d4a5c6453fa9f8b839baeee25147865fbb7dJames Phillpottsclass Commit < ActiveRecord::Base
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster attr_accessible :commit_oid, :repository
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster attr_accessible :author, :author_date
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster attr_accessible :committer, :commit_date
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster has_many :ontology_versions
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster has_many :ontologies, through: :ontology_versions
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster belongs_to :repository
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster def fill_commit_instance!
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster commit = repository.git.repo.lookup(commit_oid)
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster data = commit.committer
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster self.committer = "#{data[:name]} <#{data[:email]}>"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster self.commit_date = data[:time]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster data = commit.author
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster self.author = "#{data[:name]} <#{data[:email]}>"
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster self.author_date = data[:time]
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster save!
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster end
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterend
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster