Sha256: a0762e58717a6ac50580c8be7545edadb6a38d07f550385c36e175d39a5c856d
Contents?: true
Size: 1.17 KB
Versions: 3
Compression:
Stored size: 1.17 KB
Contents
module Integrity class Project module Push def push(payload) payload = parse_payload(payload) raise ArgumentError unless valid_payload?(payload) commits = if Integrity.config[:build_all_commits] payload["commits"] else [ payload["commits"].first ] end commits.each { |commit_data| commit = commit_from(commit_data) commit.create build(commit.identifier) } end private def commit_from(data) commits.new(:identifier => data["id"], :author => "#{data["author"]["name"]} <#{data["author"]["email"]}>", :message => data["message"], :url => data["url"], :committed_at => data["timestamp"]) end def valid_payload?(payload) payload && payload["ref"].to_s.include?(branch) && !payload["commits"].nil? && !payload["commits"].to_a.empty? end def parse_payload(payload) JSON.parse(payload.to_s) rescue JSON::ParserError false end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
alphasights-integrity-0.1.9.6 | lib/integrity/project/push.rb |
alphasights-integrity-0.1.9.7 | lib/integrity/project/push.rb |
alphasights-integrity-0.1.9.8 | lib/integrity/project/push.rb |