diff --git a/app/models/platform.rb b/app/models/platform.rb index d5962f9da..1dcee17a9 100644 --- a/app/models/platform.rb +++ b/app/models/platform.rb @@ -176,33 +176,6 @@ class Platform < ActiveRecord::Base end end - def build_all(opts={}) - # Set options to build all need - repositories = opts[:repositories] ? self.repositories.where(:id => opts[:repositories]) : self.repositories - arches = opts[:arches] ? Arch.where(:id => opts[:arches]) : Arch.all - auto_publish = opts[:auto_publish] || false - user = opts[:user] - mass_build_id = opts[:mass_build_id] - mass_build = MassBuild.find mass_build_id - - repositories.each do |rep| - rep.projects.find_in_batches(:batch_size => 2) do |group| - sleep 1 - group.each do |p| - arches.map(&:name).each do |arch| - begin - return if mass_build.reload.stop_build - p.build_for(self, rep.id, user, arch, auto_publish, mass_build_id) - rescue RuntimeError, Exception - # p.async(:build_for, self, user, arch, auto_publish, mass_build_id) # TODO need this? - end - end - end - end - end - end - later :build_all, :loner => true, :queue => :clone_build - def destroy with_skip {super} # avoid cascade XML RPC requests end diff --git a/app/models/project_to_repository.rb b/app/models/project_to_repository.rb index 3e7addb13..16035ce3e 100644 --- a/app/models/project_to_repository.rb +++ b/app/models/project_to_repository.rb @@ -5,7 +5,7 @@ class ProjectToRepository < ActiveRecord::Base delegate :path, :to => :project - after_destroy lambda { project.destroy_project_from_repository(repository) } + after_destroy lambda { project.destroy_project_from_repository(repository) }, :unless => lambda {Thread.current[:skip]} validate :one_project_in_platform_repositories diff --git a/app/models/repository.rb b/app/models/repository.rb index 00314ddad..7b4113271 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -16,7 +16,7 @@ class Repository < ActiveRecord::Base scope :recent, order("name ASC") - before_destroy :detele_directory + before_destroy :detele_directory, :unless => lambda {Thread.current[:skip]} attr_accessible :name, :description, :publish_without_qa attr_readonly :name, :platform_id