reverted event data

This commit is contained in:
randx 2012-04-04 02:59:58 +03:00
parent 82c8c42aee
commit 911ce0d3e5

View file

@ -1,13 +1,13 @@
module Event::PushTrait module Event::PushTrait
as_trait do as_trait do
def valid_push? def valid_push?
data["ref"] data[:ref]
rescue => ex rescue => ex
false false
end end
def tag? def tag?
data["ref"]["refs/tags"] data[:ref]["refs/tags"]
end end
def new_branch? def new_branch?
@ -27,11 +27,11 @@ module Event::PushTrait
end end
def commit_from def commit_from
data["before"] data[:before]
end end
def commit_to def commit_to
data["after"] data[:after]
end end
def ref_name def ref_name
@ -43,15 +43,15 @@ module Event::PushTrait
end end
def branch_name def branch_name
@branch_name ||= data["ref"].gsub("refs/heads/", "") @branch_name ||= data[:ref].gsub("refs/heads/", "")
end end
def tag_name def tag_name
@tag_name ||= data["ref"].gsub("refs/tags/", "") @tag_name ||= data[:ref].gsub("refs/tags/", "")
end end
def commits def commits
@commits ||= data["commits"].map do |commit| @commits ||= data[:commits].map do |commit|
project.commit(commit["id"]) project.commit(commit["id"])
end end
end end