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

View File

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

View File

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

View File

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