diff --git a/app/models/product_build_list.rb b/app/models/product_build_list.rb index bc287b49a..72600c47b 100644 --- a/app/models/product_build_list.rb +++ b/app/models/product_build_list.rb @@ -2,7 +2,6 @@ class ProductBuildList < ActiveRecord::Base include Modules::Models::CommitAndVersion delegate :url_helpers, to: 'Rails.application.routes' - # include Rails.application.routes.url_helpers BUILD_STARTED = 2 BUILD_COMPLETED = 0 @@ -28,6 +27,7 @@ class ProductBuildList < ActiveRecord::Base attr_accessor :base_url attr_accessible :status, :base_url, :branch, :project_id, :main_script, :params, :project_version, :commit_hash attr_readonly :product_id + serialize :results, Array scope :default_order, order('updated_at DESC') @@ -80,11 +80,18 @@ class ProductBuildList < ActiveRecord::Base :main_script => main_script } # if result == ProductBuilder::SUCCESS - if Resque.enqueue(AbfWorker::IsoWorker, options) - return true - else - raise "Failed to create product_build_list #{id} inside platform #{product.platform.name} with params: #{options.inspect}" - end + + Resque.push( + 'iso_worker', + 'class' => 'AbfWorker::IsoWorker', + 'args' => [options] + ) + return true + # if Resque.enqueue(AbfWorker::IsoWorker, options) + # return true + # else + # raise "Failed to create product_build_list #{id} inside platform #{product.platform.name} with params: #{options.inspect}" + # end end def xml_delete_iso_container diff --git a/app/views/platforms/product_build_lists/show.html.haml b/app/views/platforms/product_build_lists/show.html.haml index cc5317055..7fc60ce0e 100644 --- a/app/views/platforms/product_build_lists/show.html.haml +++ b/app/views/platforms/product_build_lists/show.html.haml @@ -47,5 +47,25 @@ .rightlist= l(pbl.updated_at, :format => :long) .both +%h3= t("layout.product_build_lists.results") +- unless pbl.results.present? + %h4.nomargin= t("layout.product_build_lists.no_results") +- else + %table.tablesorter.width565{:cellpadding => "0", :cellspacing => "0"} + %thead + %tr + %th= t("activerecord.attributes.product_build_list/results.file_name") + %th= t("activerecord.attributes.product_build_list/results.sha1") + %th= t("activerecord.attributes.product_build_list/results.link") + %tbody + - pbl.results.each do |item| + %tr + %td= item['file_name'] + - sha1 = item['sha1'] + %td= sha1 + %td= link_to t("activerecord.attributes.product_build_list/results.link"), "http://file-store.rosalinux.ru/api/v1/file_stores/#{sha1}" +.both + + :javascript $('article .all').addClass('bigpadding'); \ No newline at end of file diff --git a/config/locales/models/product_build_list.en.yml b/config/locales/models/product_build_list.en.yml index 2322b52d3..6baf8374b 100644 --- a/config/locales/models/product_build_list.en.yml +++ b/config/locales/models/product_build_list.en.yml @@ -1,6 +1,7 @@ en: layout: product_build_lists: + results: Results work_env: Work environment iso_builder_folder: folder with contents of the GIT project results_folder: all files from this folder will be uploaded into the file-store @@ -38,6 +39,10 @@ en: project_version: Version main_script: Main script params: Params for running script + product_build_list/results: + file_name: File name + sha1: SHA1 + link: Link flash: product_build_list: diff --git a/config/locales/models/product_build_list.ru.yml b/config/locales/models/product_build_list.ru.yml index 7b233383a..1f0a919f9 100644 --- a/config/locales/models/product_build_list.ru.yml +++ b/config/locales/models/product_build_list.ru.yml @@ -1,6 +1,7 @@ ru: layout: product_build_lists: + results: Результаты work_env: Рабочее пространство iso_builder_folder: папка с содержимым GIT проекта results_folder: все файлы из этой папки будут загружены на file-store @@ -38,6 +39,10 @@ ru: project_version: Версия main_script: Основной скрипт params: Параметры для запуска скрипта + product_build_list/results: + file_name: Имя файла + sha1: SHA1 + link: Ссылка flash: product_build_list: diff --git a/db/migrate/20121106113338_integrate_new_iso_builder_with_products.rb b/db/migrate/20121106113338_integrate_new_iso_builder_with_products.rb index 6bbeb6cc6..2cf75faf6 100644 --- a/db/migrate/20121106113338_integrate_new_iso_builder_with_products.rb +++ b/db/migrate/20121106113338_integrate_new_iso_builder_with_products.rb @@ -19,6 +19,7 @@ class IntegrateNewIsoBuilderWithProducts < ActiveRecord::Migration add_column :product_build_lists, :params, :string add_column :product_build_lists, :main_script, :string + add_column :product_build_lists, :results, :text end def down @@ -41,5 +42,6 @@ class IntegrateNewIsoBuilderWithProducts < ActiveRecord::Migration remove_column :product_build_lists, :params remove_column :product_build_lists, :main_script + remove_column :product_build_lists, :results end end diff --git a/db/schema.rb b/db/schema.rb index 6c3f34267..86cdd0711 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -286,6 +286,7 @@ ActiveRecord::Schema.define(:version => 20121106113338) do t.string "commit_hash" t.string "params" t.string "main_script" + t.text "results" end add_index "product_build_lists", ["product_id"], :name => "index_product_build_lists_on_product_id" diff --git a/lib/abf_worker/iso_worker.rb b/lib/abf_worker/iso_worker.rb deleted file mode 100644 index 6237b80a5..000000000 --- a/lib/abf_worker/iso_worker.rb +++ /dev/null @@ -1,5 +0,0 @@ -module AbfWorker - class IsoWorker - @queue = :iso_worker - end -end \ No newline at end of file diff --git a/lib/abf_worker/iso_worker_observer.rb b/lib/abf_worker/iso_worker_observer.rb new file mode 100644 index 000000000..026874368 --- /dev/null +++ b/lib/abf_worker/iso_worker_observer.rb @@ -0,0 +1,14 @@ +module AbfWorker + class IsoWorkerObserver + @queue = :iso_worker_observer + + def self.perform(options) + status = options['status'].to_i + pbl = ProductBuildList.find options['id'] + pbl.status = status + pbl.results = options['results'] if status != ProductBuildList::BUILD_STARTED + pbl.save! + end + + end +end \ No newline at end of file