#24. Add new statuses and remove repetition

This commit is contained in:
Vladimir Sharshov 2011-12-12 16:34:20 +04:00
parent 5e3711505c
commit cf18550cfb
4 changed files with 34 additions and 23 deletions

View File

@ -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 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 BUILD_CANCELED = 5000
WAITING_FOR_RESPONSE = 4000 WAITING_FOR_RESPONSE = 4000
BUILD_PENDING = 2000 BUILD_PENDING = 2000
BUILD_STARTED = 3000
BUILD_PUBLISHED = 6000 BUILD_PUBLISHED = 6000
TEST_FAILD = 21
STATUSES = [ WAITING_FOR_RESPONSE, STATUSES = [ WAITING_FOR_RESPONSE,
BuildServer::SUCCESS, BUILD_CANCELED,
BUILD_PENDING, BUILD_PENDING,
BUILD_STARTED, BUILD_PUBLISHED,
BuildServer::SUCCESS,
BuildServer::BUILD_STARTED,
BuildServer::BUILD_ERROR, BuildServer::BUILD_ERROR,
BuildServer::PLATFORM_NOT_FOUND, BuildServer::PLATFORM_NOT_FOUND,
BuildServer::PLATFORM_PENDING, BuildServer::PLATFORM_PENDING,
BuildServer::PROJECT_NOT_FOUND, BuildServer::PROJECT_NOT_FOUND,
BuildServer::PROJECT_VERSION_NOT_FOUND, BuildServer::PROJECT_VERSION_NOT_FOUND,
BUILD_CANCELED, BuildServer::BINARY_TEST_FAILED,
TEST_FAILD] 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_PENDING => :build_pending,
BUILD_STARTED => :build_started, BUILD_PUBLISHED => :build_published,
BuildServer::BUILD_ERROR => :build_error,
BuildServer::BUILD_STARTED => :build_started,
BuildServer::SUCCESS => :success, BuildServer::SUCCESS => :success,
WAITING_FOR_RESPONSE => :waiting_for_response,
BuildServer::PLATFORM_NOT_FOUND => :platform_not_found, BuildServer::PLATFORM_NOT_FOUND => :platform_not_found,
BuildServer::PLATFORM_PENDING => :platform_pending, BuildServer::PLATFORM_PENDING => :platform_pending,
BuildServer::PROJECT_NOT_FOUND => :project_not_found, BuildServer::PROJECT_NOT_FOUND => :project_not_found,
BuildServer::PROJECT_VERSION_NOT_FOUND => :project_version_not_found, BuildServer::PROJECT_VERSION_NOT_FOUND => :project_version_not_found,
TEST_FAILD => :testing_faild, BuildServer::DEPENDENCY_TEST_FAILED => :dependency_test_faild,
BUILD_CANCELED => :build_canceled BuildServer::BINARY_TEST_FAILED => :binary_test_failed,
} }
scope :recent, order("updated_at DESC") scope :recent, order("updated_at DESC")

View File

@ -3,11 +3,12 @@ class BuildList::Item < ActiveRecord::Base
attr_protected :build_list_id 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 = { HUMAN_STATUSES = {
nil => :unknown, nil => :unknown,
BuildServer::DEPENDENCIES_FAIL => :dependencies_fail, BuildServer::DEPENDENCIES_ERROR => :dependencies_error,
BuildServer::SUCCESS => :success, BuildServer::SUCCESS => :success,
BuildServer::BUILD_STARTED => :build_started,
BuildServer::BUILD_ERROR => :build_error BuildServer::BUILD_ERROR => :build_error
} }

View File

@ -300,16 +300,18 @@ ru:
items: items:
statuses: statuses:
build_error: ошибка сборки build_error: ошибка сборки
dependencies_fail: зависимости не найдены dependencies_error: зависимости не найдены
success: собран success: собран
unknown: ожидает сборки unknown: ожидает сборки
statuses: statuses:
build_error: ошибка сборки build_error: ошибка сборки
build_published: опубликован
dependencies_fail: зависимости не найдены dependencies_fail: зависимости не найдены
waiting_for_response: ожидает ответа waiting_for_response: ожидает ответа
build_pending: ожидает сборку build_pending: ожидает сборку
testing_faild: тестирование не пройдено dependency_test_faild: тестирование зависимостей не пройдено
binary_test_failed: тестирование бинарной совместимости не пройдено
build_canceled: сборка отменена build_canceled: сборка отменена
success: собран success: собран
build_started: собирается build_started: собирается

View File

@ -9,9 +9,14 @@ class BuildServer
PLATFORM_PENDING = 2 PLATFORM_PENDING = 2
PROJECT_NOT_FOUND = 3 PROJECT_NOT_FOUND = 3
PROJECT_VERSION_NOT_FOUND = 4 PROJECT_VERSION_NOT_FOUND = 4
PROJECT_SOURCE_ERROR = 6
DEPENDENCY_TEST_FAILED = 21
BINARY_TEST_FAILED = 22
DEPENDENCIES_ERROR = 555
BUILD_ERROR = 666 BUILD_ERROR = 666
DEPENDENCIES_FAIL = 555 BUILD_STARTED = 3000
def self.client 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']) @@client ||= XMLRPC::Client.new3('host' => APP_CONFIG['build_server_ip'], 'port' => APP_CONFIG['build_server_port'], 'path' => APP_CONFIG['build_server_path'])