#755: update path to platform for personal platforms, some refactoring

This commit is contained in:
Vokhmin Alexey V 2012-12-11 15:47:32 +04:00
parent f00b168b20
commit 1c51a2d514
5 changed files with 26 additions and 18 deletions

View File

@ -267,16 +267,27 @@ class BuildList < ActiveRecord::Base
def publish_container
type = save_to_platform.distrib_type
archive = results.select{ |r| r['file_name'] =~ /.*\.tar\.gz$/}[0]
platform_path = "#{APP_CONFIG[root]}/platforms/#{save_to_platform.name}"
if save_to_platform.personal?
platform_path << '/'
platform_path << build_for_platform.name
Dir.mkdir(platform_path) unless File.exists?(platform_path)
end
Resque.push(
"publish_build_list_container_#{type}_worker",
'class' => "AbfWorker::PublishBuildListContainer#{type.capitalize}Worker",
'args' => [{
:id => id,
:released => save_to_platform.released,
:arch => arch.name,
:distrib_type => type,
:container_sha1 => archive['sha1'],
:platform_path => "#{APP_CONFIG[root]}/platforms/#{save_to_platform.name}/",
:platform => {
:platform_path => platform_path,
:released => save_to_platform.released
},
:repository_name => save_to_repository.name,
:time_living => 1800 # 30 min
}]
)

View File

@ -17,8 +17,7 @@ module AbfWorker
pbl.build_canceled
end
if status != BUILD_STARTED
pbl.results = options['results']
pbl.save!
update_results(pbl, options)
end
end

View File

@ -5,5 +5,12 @@ module AbfWorker
BUILD_PENDING = 2
BUILD_STARTED = 3
BUILD_CANCELED = 4
def update_results(subject, options)
results = (subject.results || [])+ options['results']
subject.results = results.sort_by{ |r| r['file_name'] }
subject.save!
end
end
end

View File

@ -19,16 +19,5 @@ module AbfWorker
end
end
class << self
protected
def update_results(bl, options)
results = bl.results + options['results']
bl.results = results.sort_by{ |r| r['file_name'] }
bl.save!
end
end
end
end

View File

@ -52,9 +52,11 @@ module AbfWorker
container = (options['results'] || []).
select{ |r| r['file_name'] !~ /.*\.log$/ }.first
sha1 = container ? container['sha1'] : nil
bl.results = options['results']
bl.container_path = "#{APP_CONFIG['file_store_url']}/#{sha1}" if sha1
bl.save!
if sha1
bl.container_path = "#{APP_CONFIG['file_store_url']}/#{sha1}"
bl.save!
end
update_results(bl, options)
end
end