#298: auto publish packages only with > version

This commit is contained in:
Vokhmin Alexey V 2013-09-09 22:40:58 +04:00
parent c03b4aaab6
commit e7e5414db7
2 changed files with 15 additions and 1 deletions

View File

@ -280,6 +280,20 @@ class BuildList < ActiveRecord::Base
build_started? || build_pending? build_started? || build_pending?
end end
def can_auto_publish?
return false if !(auto_publish? && can_publish?)
if last_bl = last_published.last
return true if last_bl.source_packages.count != source_packages.count
last_bl.source_packages.each do |sp|
return true if source_packages.find{ |nsp| nsp.name == sp.name && nsp.version > sp.version }
end
else
return true # no published packages
end
return false # no new packages
end
def can_publish? def can_publish?
[SUCCESS, FAILED_PUBLISH, BUILD_PUBLISHED, TESTS_FAILED].include?(status) && extra_build_lists_published? && save_to_repository.projects.exists?(:id => project_id) [SUCCESS, FAILED_PUBLISH, BUILD_PUBLISHED, TESTS_FAILED].include?(status) && extra_build_lists_published? && save_to_repository.projects.exists?(:id => project_id)
end end

View File

@ -17,7 +17,7 @@ module AbfWorker
case status case status
when COMPLETED when COMPLETED
subject.build_success subject.build_success
subject.now_publish if subject.auto_publish? && subject.can_publish? subject.now_publish if subject.can_auto_publish?
when FAILED when FAILED
subject.build_error subject.build_error
item.update_attributes({:status => BuildList::BUILD_ERROR}) item.update_attributes({:status => BuildList::BUILD_ERROR})