[refs #442] Fix problem for build list with save_to plaftorm is freeze; fix ignoring auto_publish option.

This commit is contained in:
Vladimir Sharshov 2012-05-22 01:10:00 +04:00
parent bc5cf86115
commit 57ef020441
3 changed files with 6 additions and 5 deletions

View File

@ -18,7 +18,7 @@ class BuildList < ActiveRecord::Base
validates :update_type, :inclusion => UPDATE_TYPES,
:unless => Proc.new { |b| b.save_to_platform.released }
validates :update_type, :inclusion => RELEASE_UPDATE_TYPES,
:if => Proc.new { |b| b.save_to_platform.released }
:if => Proc.new { |b| b.save_to_platform.released && b.mass_build_id.nil?}
validate lambda {
errors.add(:build_for_platform, I18n.t('flash.build_list.wrong_platform')) if save_to_platform.platform_type == 'main' && save_to_platform_id != build_for_platform_id
}

View File

@ -5,7 +5,8 @@ class MassBuild < ActiveRecord::Base
def build_all(opts={})
set_name opts[:repositories]
platform.build_all opts.merge({:mass_build_id => self.id})
opts.merge!({:mass_build_id => self.id})
platform.build_all opts
end
private

View File

@ -76,7 +76,7 @@ class Project < ActiveRecord::Base
# If project platform repository is main, only main will be connect
build_reps = [platform.repositories.find_by_name('main')]
build_reps += platform.repositories.select {|rep| self.repository_ids.include? rep.id}
build_ids = build_reps.compact.map(&:id).uniq
build_reps_ids = build_reps.compact.map(&:id).uniq
arch = Arch.find_by_name(arch) if arch.acts_like?(:string)
build_lists.create do |bl|
bl.save_to_platform = platform
@ -86,8 +86,8 @@ class Project < ActiveRecord::Base
bl.project_version = "latest_#{platform.name}"
bl.build_requires = false # already set as db default
bl.user = user
bl.auto_publish = true # already set as db default
bl.include_repos = build_ids
bl.auto_publish = auto_publish
bl.include_repos = build_reps_ids
bl.priority = priority
bl.mass_build_id = mass_build_id
end