From 57ef02044166ff584e8bf8ffec440da6a59cc590 Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Tue, 22 May 2012 01:10:00 +0400 Subject: [PATCH] [refs #442] Fix problem for build list with save_to plaftorm is freeze; fix ignoring auto_publish option. --- app/models/build_list.rb | 2 +- app/models/mass_build.rb | 3 ++- app/models/project.rb | 6 +++--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 8060ce219..5d8a93e9d 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -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 } diff --git a/app/models/mass_build.rb b/app/models/mass_build.rb index b626bed53..8739df6a4 100644 --- a/app/models/mass_build.rb +++ b/app/models/mass_build.rb @@ -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 diff --git a/app/models/project.rb b/app/models/project.rb index f40717e41..c6501721b 100644 --- a/app/models/project.rb +++ b/app/models/project.rb @@ -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