rename BUILD_IN_QUEUE to BUILD_PENDING

This commit is contained in:
Vokhmin Alexey V 2012-11-19 20:38:08 +04:00
parent edc6638b1e
commit 894f8651d9
4 changed files with 17 additions and 11 deletions

View File

@ -5,7 +5,7 @@ class ProductBuildList < ActiveRecord::Base
BUILD_COMPLETED = 0 BUILD_COMPLETED = 0
BUILD_FAILED = 1 BUILD_FAILED = 1
BUILD_IN_QUEUE = 2 BUILD_PENDING = 2
BUILD_STARTED = 3 BUILD_STARTED = 3
BUILD_CANCELED = 4 BUILD_CANCELED = 4
BUILD_CANCELING = 5 BUILD_CANCELING = 5
@ -13,7 +13,7 @@ class ProductBuildList < ActiveRecord::Base
STATUSES = [ BUILD_STARTED, STATUSES = [ BUILD_STARTED,
BUILD_COMPLETED, BUILD_COMPLETED,
BUILD_FAILED, BUILD_FAILED,
BUILD_IN_QUEUE, BUILD_PENDING,
BUILD_CANCELED, BUILD_CANCELED,
BUILD_CANCELING BUILD_CANCELING
] ]
@ -21,7 +21,7 @@ class ProductBuildList < ActiveRecord::Base
HUMAN_STATUSES = { BUILD_STARTED => :build_started, HUMAN_STATUSES = { BUILD_STARTED => :build_started,
BUILD_COMPLETED => :build_completed, BUILD_COMPLETED => :build_completed,
BUILD_FAILED => :build_failed, BUILD_FAILED => :build_failed,
BUILD_IN_QUEUE => :in_queue, BUILD_PENDING => :build_pending,
BUILD_CANCELED => :build_canceled, BUILD_CANCELED => :build_canceled,
BUILD_CANCELING => :canceling BUILD_CANCELING => :canceling
} }
@ -63,6 +63,7 @@ class ProductBuildList < ActiveRecord::Base
after_create :xml_rpc_create after_create :xml_rpc_create
before_destroy :can_destroy? before_destroy :can_destroy?
after_destroy :xml_delete_iso_container after_destroy :xml_delete_iso_container
before_validation :check_status
def build_started? def build_started?
status == BUILD_STARTED status == BUILD_STARTED
@ -89,7 +90,7 @@ class ProductBuildList < ActiveRecord::Base
end end
def can_destroy? def can_destroy?
[BUILD_COMPLETED, BUILD_FAILED].include? status [BUILD_COMPLETED, BUILD_FAILED, BUILD_CANCELED].include? status
end end
def log def log
@ -107,6 +108,12 @@ class ProductBuildList < ActiveRecord::Base
protected protected
def check_status
if status_was == BUILD_CANCELING && [BUILD_COMPLETED, BUILD_FAILED].include?(status)
self.status = BUILD_CANCELED
end
end
def xml_rpc_create def xml_rpc_create
file_name = "#{project.owner.uname}-#{project.name}-#{commit_hash}" file_name = "#{project.owner.uname}-#{project.name}-#{commit_hash}"
srcpath = url_helpers.archive_url( srcpath = url_helpers.archive_url(

View File

@ -17,16 +17,16 @@ en:
statuses: statuses:
'0': 'build complete' '0': 'build complete'
'1': 'build error' '1': 'build error'
'2': 'build is waiting' '2': 'build pending'
'3': 'build started' '3': 'build started'
'4': 'build canceled' '4': 'build canceled'
'5': 'build is canceling' '5': 'build is canceling'
build_completed: Build complete build_completed: Build complete
build_failed: Build failed build_failed: Build failed
in_queue: Build is waiting build_pending: Build pending
build_started: Build started build_started: Build started
build_canceled: Build canceled build_canceled: Build canceled
canceling: Build is canceling build_canceling: Build is canceling
ownership: ownership:
header: Build list ownership header: Build list ownership

View File

@ -17,13 +17,13 @@ ru:
statuses: statuses:
'0': 'собран' '0': 'собран'
'1': 'ошибка сборки' '1': 'ошибка сборки'
'2': 'ожидает сборки' '2': 'ожидает сборку'
'3': 'собирается' '3': 'собирается'
'4': 'сборка отменена' '4': 'сборка отменена'
'5': 'сборка отменяется' '5': 'сборка отменяется'
build_completed: Собран build_completed: Собран
build_failed: Ошибка сборки build_failed: Ошибка сборки
in_queue: Ожидает сборки build_pending: Ожидает сборку
build_started: Собирается build_started: Собирается
build_canceled: Сборка отменена build_canceled: Сборка отменена
canceling: Сборка отменяется canceling: Сборка отменяется

View File

@ -5,8 +5,7 @@ module AbfWorker
def self.perform(options) def self.perform(options)
status = options['status'].to_i status = options['status'].to_i
pbl = ProductBuildList.find options['id'] pbl = ProductBuildList.find options['id']
pbl.status = pbl.status == ProductBuildList::BUILD_CANCELING ? pbl.status = status
ProductBuildList::BUILD_CANCELED : status
pbl.results = options['results'] if status != ProductBuildList::BUILD_STARTED pbl.results = options['results'] if status != ProductBuildList::BUILD_STARTED
pbl.save! pbl.save!
end end