#759: refactoring according to Vladimir's comments
This commit is contained in:
parent
c3e8d18925
commit
ab8c4016b5
|
@ -100,16 +100,13 @@ class Projects::BuildListsController < Projects::BaseController
|
|||
end
|
||||
|
||||
def cancel
|
||||
if @build_list.new_core? && @build_list.can_cancel?
|
||||
@build_list.cancel_job
|
||||
notice = t('layout.build_lists.will_be_canceled')
|
||||
else
|
||||
if @build_list.cancel
|
||||
notice = t('layout.build_lists.cancel_success')
|
||||
notice = @build_list.new_core? ?
|
||||
t('layout.build_lists.will_be_canceled') :
|
||||
t('layout.build_lists.cancel_success')
|
||||
else
|
||||
notice = t('layout.build_lists.cancel_fail')
|
||||
end
|
||||
end
|
||||
redirect_to :back, :notice => notice
|
||||
end
|
||||
|
||||
|
|
|
@ -141,6 +141,8 @@ class BuildList < ActiveRecord::Base
|
|||
end
|
||||
|
||||
after_transition :on => :published, :do => [:set_version_and_tag, :actualize_packages]
|
||||
after_transition :on => :cancel, :do => [:cancel_job],
|
||||
:if => lambda { |build_list| build_list.build_canceling? }
|
||||
|
||||
after_transition :on => [:published, :fail_publish, :build_error], :do => :notify_users
|
||||
after_transition :on => :build_success, :do => :notify_users,
|
||||
|
@ -175,6 +177,15 @@ class BuildList < ActiveRecord::Base
|
|||
transition [:build_pending, :platform_pending] => :build_canceled, :if => lambda { |build_list|
|
||||
!build_list.new_core? && build_list.can_cancel? && BuildServer.delete_build_list(build_list.bs_id) == BuildServer::SUCCESS
|
||||
}
|
||||
transition [:build_pending, :build_started] => :build_canceling, :if => lambda { |build_list|
|
||||
build_list.new_core? && build_list.can_cancel?
|
||||
}
|
||||
end
|
||||
|
||||
event :build_canceled do
|
||||
transition [:build_canceling] => :build_canceled, :if => lambda { |build_list|
|
||||
build_list.new_core?
|
||||
}
|
||||
end
|
||||
|
||||
event :published do
|
||||
|
|
|
@ -24,7 +24,7 @@ module AbfWorker
|
|||
bl.save!
|
||||
bl.start_build
|
||||
when BUILD_CANCELED
|
||||
bl.update_attributes({:status => BuildList::BUILD_CANCELED})
|
||||
bl.build_canceled
|
||||
item.update_attributes({:status => BuildList::BUILD_CANCELED})
|
||||
end
|
||||
if status != BUILD_STARTED
|
||||
|
|
Loading…
Reference in New Issue