From cf18550cfb5c6d4127e4f93e5f796b2aff26e770 Mon Sep 17 00:00:00 2001 From: Vladimir Sharshov Date: Mon, 12 Dec 2011 16:34:20 +0400 Subject: [PATCH] #24. Add new statuses and remove repetition --- app/models/build_list.rb | 39 +++++++++++++++++++---------------- app/models/build_list/item.rb | 5 +++-- config/locales/ru.yml | 6 ++++-- lib/build_server.rb | 7 ++++++- 4 files changed, 34 insertions(+), 23 deletions(-) diff --git a/app/models/build_list.rb b/app/models/build_list.rb index e8aacc4b2..0f2ec1961 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -17,36 +17,39 @@ class BuildList < ActiveRecord::Base errors.add(:bpl, I18n.t('flash.build_list.can_not_published')) if status == BUILD_PUBLISHED && status_was != BuildServer::SUCCESS } + # The kernel does not send these statuses directly BUILD_CANCELED = 5000 WAITING_FOR_RESPONSE = 4000 BUILD_PENDING = 2000 - BUILD_STARTED = 3000 BUILD_PUBLISHED = 6000 - TEST_FAILD = 21 - STATUSES = [WAITING_FOR_RESPONSE, - BuildServer::SUCCESS, - BUILD_PENDING, - BUILD_STARTED, - BuildServer::BUILD_ERROR, - BuildServer::PLATFORM_NOT_FOUND, - BuildServer::PLATFORM_PENDING, - BuildServer::PROJECT_NOT_FOUND, - BuildServer::PROJECT_VERSION_NOT_FOUND, - BUILD_CANCELED, - TEST_FAILD] + STATUSES = [ WAITING_FOR_RESPONSE, + BUILD_CANCELED, + BUILD_PENDING, + BUILD_PUBLISHED, + BuildServer::SUCCESS, + BuildServer::BUILD_STARTED, + BuildServer::BUILD_ERROR, + BuildServer::PLATFORM_NOT_FOUND, + BuildServer::PLATFORM_PENDING, + BuildServer::PROJECT_NOT_FOUND, + BuildServer::PROJECT_VERSION_NOT_FOUND, + BuildServer::BINARY_TEST_FAILED, + BuildServer::DEPENDENCY_TEST_FAILED ] - HUMAN_STATUSES = { BuildServer::BUILD_ERROR => :build_error, + HUMAN_STATUSES = { WAITING_FOR_RESPONSE => :waiting_for_response, + BUILD_CANCELED => :build_canceled BUILD_PENDING => :build_pending, - BUILD_STARTED => :build_started, + BUILD_PUBLISHED => :build_published, + BuildServer::BUILD_ERROR => :build_error, + BuildServer::BUILD_STARTED => :build_started, BuildServer::SUCCESS => :success, - WAITING_FOR_RESPONSE => :waiting_for_response, BuildServer::PLATFORM_NOT_FOUND => :platform_not_found, BuildServer::PLATFORM_PENDING => :platform_pending, BuildServer::PROJECT_NOT_FOUND => :project_not_found, BuildServer::PROJECT_VERSION_NOT_FOUND => :project_version_not_found, - TEST_FAILD => :testing_faild, - BUILD_CANCELED => :build_canceled + BuildServer::DEPENDENCY_TEST_FAILED => :dependency_test_faild, + BuildServer::BINARY_TEST_FAILED => :binary_test_failed, } scope :recent, order("updated_at DESC") diff --git a/app/models/build_list/item.rb b/app/models/build_list/item.rb index 9963565d0..a06e3b89e 100644 --- a/app/models/build_list/item.rb +++ b/app/models/build_list/item.rb @@ -3,11 +3,12 @@ class BuildList::Item < ActiveRecord::Base attr_protected :build_list_id - STATUSES = [BuildServer::SUCCESS, BuildServer::DEPENDENCIES_FAIL, BuildServer::BUILD_ERROR] + STATUSES = [BuildServer::SUCCESS, BuildServer::DEPENDENCIES_ERROR, BuildServer::BUILD_ERROR, BuildServer::BUILD_STARTED] HUMAN_STATUSES = { nil => :unknown, - BuildServer::DEPENDENCIES_FAIL => :dependencies_fail, + BuildServer::DEPENDENCIES_ERROR => :dependencies_error, BuildServer::SUCCESS => :success, + BuildServer::BUILD_STARTED => :build_started, BuildServer::BUILD_ERROR => :build_error } diff --git a/config/locales/ru.yml b/config/locales/ru.yml index 943cfb82a..0a6b3f910 100644 --- a/config/locales/ru.yml +++ b/config/locales/ru.yml @@ -300,16 +300,18 @@ ru: items: statuses: build_error: ошибка сборки - dependencies_fail: зависимости не найдены + dependencies_error: зависимости не найдены success: собран unknown: ожидает сборки statuses: build_error: ошибка сборки + build_published: опубликован dependencies_fail: зависимости не найдены waiting_for_response: ожидает ответа build_pending: ожидает сборку - testing_faild: тестирование не пройдено + dependency_test_faild: тестирование зависимостей не пройдено + binary_test_failed: тестирование бинарной совместимости не пройдено build_canceled: сборка отменена success: собран build_started: собирается diff --git a/lib/build_server.rb b/lib/build_server.rb index 285fe1a39..6ce8f87bb 100644 --- a/lib/build_server.rb +++ b/lib/build_server.rb @@ -9,9 +9,14 @@ class BuildServer PLATFORM_PENDING = 2 PROJECT_NOT_FOUND = 3 PROJECT_VERSION_NOT_FOUND = 4 + PROJECT_SOURCE_ERROR = 6 + + DEPENDENCY_TEST_FAILED = 21 + BINARY_TEST_FAILED = 22 + DEPENDENCIES_ERROR = 555 BUILD_ERROR = 666 - DEPENDENCIES_FAIL = 555 + BUILD_STARTED = 3000 def self.client @@client ||= XMLRPC::Client.new3('host' => APP_CONFIG['build_server_ip'], 'port' => APP_CONFIG['build_server_port'], 'path' => APP_CONFIG['build_server_path'])