From 52cd67e1c35493c94b8c18a096786f687a7ec9b9 Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Tue, 29 Jan 2013 01:50:27 +0400 Subject: [PATCH] #860: small refactoring --- app/helpers/build_lists_helper.rb | 7 +++++-- app/views/api/v1/build_lists/show.json.jbuilder | 2 +- lib/abf_worker/build_lists_publish_task_manager.rb | 3 +-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/app/helpers/build_lists_helper.rb b/app/helpers/build_lists_helper.rb index 768da4127..66e89a0dd 100644 --- a/app/helpers/build_lists_helper.rb +++ b/app/helpers/build_lists_helper.rb @@ -76,8 +76,11 @@ module BuildListsHelper end end - def container_url - "http://#{request.host_with_port}/downloads/#{@build_list.save_to_platform.name}/container/#{@build_list.id}".html_safe + def container_url(full_path = true) + p = '' + p << "http://#{request.host_with_port}" if full_path + p << "/downloads/#{@build_list.save_to_platform.name}/container/#{@build_list.id}" + p.html_safe end def log_reload_time_options diff --git a/app/views/api/v1/build_lists/show.json.jbuilder b/app/views/api/v1/build_lists/show.json.jbuilder index df67be992..004109489 100644 --- a/app/views/api/v1/build_lists/show.json.jbuilder +++ b/app/views/api/v1/build_lists/show.json.jbuilder @@ -6,7 +6,7 @@ json.build_list do |json| json.build_log_url log_build_list_path(@build_list) if @build_list.container_published? - json.container_path container_url + json.container_path container_url(false) else json.container_path '' end diff --git a/lib/abf_worker/build_lists_publish_task_manager.rb b/lib/abf_worker/build_lists_publish_task_manager.rb index 07fbc6a0d..e9b6e31c1 100644 --- a/lib/abf_worker/build_lists_publish_task_manager.rb +++ b/lib/abf_worker/build_lists_publish_task_manager.rb @@ -68,8 +68,7 @@ module AbfWorker def create_container_for(build_list) platform_path = "#{build_list.save_to_platform.path}/container/#{build_list.id}" - system "rm -rf #{platform_path}" - system "mkdir -p #{platform_path}" + system "rm -rf #{platform_path} && mkdir -p #{platform_path}" packages = {:sources => [], :binaries => {:x86_64 => [], :i586 => []}} packages[:sources] = build_list.packages.by_package_type('source').pluck(:sha1).compact