[refs #847] removed PLATFORM_PENDING & PROJECT_NOT_FOUND statuses

This commit is contained in:
Alexander Machehin 2013-01-24 23:55:24 +06:00
parent 643e163652
commit 090f40caee
6 changed files with 9 additions and 21 deletions

View File

@ -5,7 +5,7 @@ module BuildListsHelper
return 'success' return 'success'
end end
if [BuildList::BUILD_ERROR, BuildList::PLATFORM_NOT_FOUND, if [BuildList::BUILD_ERROR, BuildList::PLATFORM_NOT_FOUND,
BuildList::PROJECT_NOT_FOUND, BuildList::PROJECT_VERSION_NOT_FOUND, BuildList::PROJECT_VERSION_NOT_FOUND,
BuildList::FAILED_PUBLISH, BuildList::REJECTED_PUBLISH].include? status BuildList::FAILED_PUBLISH, BuildList::REJECTED_PUBLISH].include? status
return 'error' return 'error'
end end

View File

@ -131,7 +131,7 @@ class ActivityFeedObserver < ActiveRecord::Observer
when 'BuildList' when 'BuildList'
if [BuildList::BUILD_PUBLISHED, BuildList::SUCCESS, BuildList::BUILD_ERROR, BuildList::PLATFORM_NOT_FOUND, if [BuildList::BUILD_PUBLISHED, BuildList::SUCCESS, BuildList::BUILD_ERROR, BuildList::PLATFORM_NOT_FOUND,
BuildList::PROJECT_NOT_FOUND, BuildList::PROJECT_VERSION_NOT_FOUND, BuildList::FAILED_PUBLISH].include? record.status or BuildList::PROJECT_VERSION_NOT_FOUND, BuildList::FAILED_PUBLISH].include? record.status or
(record.status == BuildList::BUILD_PENDING && record.bs_id_changed?) (record.status == BuildList::BUILD_PENDING && record.bs_id_changed?)
record.project.admins.each do |recipient| record.project.admins.each do |recipient|
ActivityFeed.create( ActivityFeed.create(

View File

@ -53,8 +53,6 @@ class BuildList < ActiveRecord::Base
ERROR = 1 ERROR = 1
PLATFORM_NOT_FOUND = 1 PLATFORM_NOT_FOUND = 1
PLATFORM_PENDING = 2
PROJECT_NOT_FOUND = 3
PROJECT_VERSION_NOT_FOUND = 4 PROJECT_VERSION_NOT_FOUND = 4
PROJECT_SOURCE_ERROR = 6 PROJECT_SOURCE_ERROR = 6
DEPENDENCIES_ERROR = 555 DEPENDENCIES_ERROR = 555
@ -81,8 +79,6 @@ class BuildList < ActiveRecord::Base
BUILD_STARTED, BUILD_STARTED,
BUILD_ERROR, BUILD_ERROR,
PLATFORM_NOT_FOUND, PLATFORM_NOT_FOUND,
PLATFORM_PENDING,
PROJECT_NOT_FOUND,
PROJECT_VERSION_NOT_FOUND PROJECT_VERSION_NOT_FOUND
] ]
@ -98,8 +94,6 @@ class BuildList < ActiveRecord::Base
BUILD_STARTED => :build_started, BUILD_STARTED => :build_started,
SUCCESS => :success, SUCCESS => :success,
PLATFORM_NOT_FOUND => :platform_not_found, PLATFORM_NOT_FOUND => :platform_not_found,
PLATFORM_PENDING => :platform_pending,
PROJECT_NOT_FOUND => :project_not_found,
PROJECT_VERSION_NOT_FOUND => :project_version_not_found, PROJECT_VERSION_NOT_FOUND => :project_version_not_found,
} }
@ -163,9 +157,7 @@ class BuildList < ActiveRecord::Base
build_list.add_to_queue == BuildList::SUCCESS build_list.add_to_queue == BuildList::SUCCESS
} }
%w[BUILD_PENDING %w[BUILD_PENDING
PLATFORM_PENDING
PLATFORM_NOT_FOUND PLATFORM_NOT_FOUND
PROJECT_NOT_FOUND
PROJECT_VERSION_NOT_FOUND PROJECT_VERSION_NOT_FOUND
].each do |code| ].each do |code|
transition :waiting_for_response => code.demodulize.downcase.to_sym, :if => lambda { |build_list| transition :waiting_for_response => code.demodulize.downcase.to_sym, :if => lambda { |build_list|
@ -176,9 +168,7 @@ class BuildList < ActiveRecord::Base
event :start_build do event :start_build do
transition [ :build_pending, transition [ :build_pending,
:platform_pending,
:platform_not_found, :platform_not_found,
:project_not_found,
:project_version_not_found ] => :build_started :project_version_not_found ] => :build_started
end end

View File

@ -121,7 +121,6 @@ en:
build_started: Build started build_started: Build started
platform_not_found: Platform not found platform_not_found: Platform not found
platform_pending: Platform pending platform_pending: Platform pending
project_not_found: Project not found
project_version_not_found: Project version not found project_version_not_found: Project version not found
log: log:

View File

@ -118,7 +118,6 @@ ru:
build_started: собирается build_started: собирается
platform_not_found: платформа не найдена platform_not_found: платформа не найдена
platform_pending: платформа в процессе создания platform_pending: платформа в процессе создания
project_not_found: проект не найден
project_version_not_found: версия не найдена project_version_not_found: версия не найдена
log: log:

View File

@ -130,15 +130,15 @@ describe Api::V1::BuildListsController do
context "if it has another status" do context "if it has another status" do
it "should return correct json error message" do it "should return correct json error message" do
@build_list.update_column(:status, BuildList::PROJECT_NOT_FOUND) @build_list.update_column(:status, BuildList::PROJECT_VERSION_NOT_FOUND)
do_cancel do_cancel
response.body.should == {:is_canceled => false, :url => api_v1_build_list_path(@build_list, :format => :json), :message => incorrect_action_message}.to_json response.body.should == {:is_canceled => false, :url => api_v1_build_list_path(@build_list, :format => :json), :message => incorrect_action_message}.to_json
end end
it "should not cancel build list" do it "should not cancel build list" do
@build_list.update_column(:status, BuildList::PROJECT_NOT_FOUND) @build_list.update_column(:status, BuildList::PROJECT_VERSION_NOT_FOUND)
do_cancel do_cancel
@build_list.reload.status.should == BuildList::PROJECT_NOT_FOUND @build_list.reload.status.should == BuildList::PROJECT_VERSION_NOT_FOUND
end end
end end
end end
@ -183,7 +183,7 @@ describe Api::V1::BuildListsController do
context "if it has another status" do context "if it has another status" do
before(:each) do before(:each) do
@build_list.update_column(:status, BuildList::PROJECT_NOT_FOUND) @build_list.update_column(:status, BuildList::PROJECT_VERSION_NOT_FOUND)
do_publish do_publish
end end
@ -192,7 +192,7 @@ describe Api::V1::BuildListsController do
end end
it "should not cancel build list" do it "should not cancel build list" do
@build_list.reload.status.should == BuildList::PROJECT_NOT_FOUND @build_list.reload.status.should == BuildList::PROJECT_VERSION_NOT_FOUND
end end
end end
end end
@ -243,7 +243,7 @@ describe Api::V1::BuildListsController do
context "if it has another status" do context "if it has another status" do
before(:each) do before(:each) do
@build_list.update_column(:status, BuildList::PROJECT_NOT_FOUND) @build_list.update_column(:status, BuildList::PROJECT_VERSION_NOT_FOUND)
do_reject_publish do_reject_publish
end end
@ -252,7 +252,7 @@ describe Api::V1::BuildListsController do
end end
it "should not cancel build list" do it "should not cancel build list" do
@build_list.reload.status.should == BuildList::PROJECT_NOT_FOUND @build_list.reload.status.should == BuildList::PROJECT_VERSION_NOT_FOUND
end end
end end
end end