2017-06-14 03:17:34 -04:00
|
|
|
class GpgSignature < ActiveRecord::Base
|
2017-07-20 09:44:15 -04:00
|
|
|
include ShaAttribute
|
|
|
|
|
|
|
|
sha_attribute :commit_sha
|
|
|
|
sha_attribute :gpg_key_primary_keyid
|
|
|
|
|
2017-06-14 03:17:34 -04:00
|
|
|
belongs_to :project
|
|
|
|
belongs_to :gpg_key
|
|
|
|
|
|
|
|
validates :commit_sha, presence: true
|
2017-07-25 15:20:48 -04:00
|
|
|
validates :project_id, presence: true
|
2017-06-15 06:43:04 -04:00
|
|
|
validates :gpg_key_primary_keyid, presence: true
|
2017-07-06 04:17:09 -04:00
|
|
|
|
2017-07-25 10:23:52 -04:00
|
|
|
def gpg_key_primary_keyid
|
|
|
|
super&.upcase
|
|
|
|
end
|
|
|
|
|
2017-07-06 04:17:09 -04:00
|
|
|
def commit
|
|
|
|
project.commit(commit_sha)
|
|
|
|
end
|
2017-06-14 03:17:34 -04:00
|
|
|
end
|