#298: ability for auto publish package into dev platform
This commit is contained in:
parent
01f46b2cf2
commit
24a0307e63
|
@ -280,11 +280,19 @@ class BuildList < ActiveRecord::Base
|
||||||
build_started? || build_pending?
|
build_started? || build_pending?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# Comparison between versions of current and last published build_list
|
||||||
|
# @return [Number]
|
||||||
|
# - false if no new packages
|
||||||
|
# - false if version of packages is less than version of pubished packages.
|
||||||
|
# - true if version of packages is equal to version of pubished packages (only if platform is not released).
|
||||||
|
# - true if version of packages is greater than version of pubished packages.
|
||||||
def has_new_packages?
|
def has_new_packages?
|
||||||
if last_bl = last_published.joins(:source_packages).where(:build_list_packages => {:actual => true}).last
|
if last_bl = last_published.joins(:source_packages).where(:build_list_packages => {:actual => true}).last
|
||||||
source_packages.each do |nsp|
|
source_packages.each do |nsp|
|
||||||
sp = last_bl.source_packages.find{ |sp| nsp.name == sp.name }
|
sp = last_bl.source_packages.find{ |sp| nsp.name == sp.name }
|
||||||
return !sp || nsp.rpmvercmp(sp) == 1
|
return true unless sp
|
||||||
|
comparison = nsp.rpmvercmp(sp)
|
||||||
|
return comparison == 1 || (comparison == 0 && !save_to_platform.released?)
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
return true # no published packages
|
return true # no published packages
|
||||||
|
|
|
@ -178,10 +178,15 @@ describe BuildList do
|
||||||
:release => 6,
|
:release => 6,
|
||||||
:project => published_build_list.project) }
|
:project => published_build_list.project) }
|
||||||
|
|
||||||
it 'ensures that return false if version of packages are same' do
|
it 'ensures that return false if version of packages are same and platform is released' do
|
||||||
|
build_list.save_to_platform.update_attributes(:released => true)
|
||||||
build_list.has_new_packages?.should be_false
|
build_list.has_new_packages?.should be_false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'ensures that return true if version of packages are same and platform is not released' do
|
||||||
|
build_list.has_new_packages?.should be_true
|
||||||
|
end
|
||||||
|
|
||||||
context 'ensures that return false if version of published package >' do
|
context 'ensures that return false if version of published package >' do
|
||||||
|
|
||||||
it 'published: 3.1.13, new: 3.1.12' do
|
it 'published: 3.1.13, new: 3.1.12' do
|
||||||
|
|
Loading…
Reference in New Issue