f218a095cf4ca58d9ae4407675c82ff56bd27267Tim Reddehaseclass Commit < ActiveRecord::Base
f218a095cf4ca58d9ae4407675c82ff56bd27267Tim Reddehase attr_accessible :commit_oid, :repository
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa attr_accessible :author_name, :author_email, :author_date
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa attr_accessible :committer_name, :author_email, :commit_date
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa belongs_to :author, class_name: User.to_s
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa belongs_to :committer, class_name: User.to_s
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa belongs_to :pusher, class_name: User.to_s
f218a095cf4ca58d9ae4407675c82ff56bd27267Tim Reddehase
a64b89f298e3973ed3c46b5035a644a38d53649cTim Reddehase has_many :ontology_versions
a64b89f298e3973ed3c46b5035a644a38d53649cTim Reddehase has_many :ontologies, through: :ontology_versions
a64b89f298e3973ed3c46b5035a644a38d53649cTim Reddehase
f218a095cf4ca58d9ae4407675c82ff56bd27267Tim Reddehase belongs_to :repository
bdfdbdfe4689ea52c5f355180cd862b3105ceabcTim Reddehase
bdfdbdfe4689ea52c5f355180cd862b3105ceabcTim Reddehase def fill_commit_instance!
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa data = repository.git.commit_author(commit_oid)
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa self.author_name = data[:name]
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa self.author_email = data[:email]
bdfdbdfe4689ea52c5f355180cd862b3105ceabcTim Reddehase self.author_date = data[:time]
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa self.author = User.where(email: author_email).first
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa data = repository.git.commit_committer(commit_oid)
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa self.committer_name = data[:name]
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa self.committer_email = data[:email]
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa self.commit_date = data[:time]
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa self.committer = User.where(email: committer_email).first
81da36894af70bbb8d8e24b004026ad4c5c1bc99Eugen Kuksa
bdfdbdfe4689ea52c5f355180cd862b3105ceabcTim Reddehase save!
bdfdbdfe4689ea52c5f355180cd862b3105ceabcTim Reddehase end
f218a095cf4ca58d9ae4407675c82ff56bd27267Tim Reddehaseend