Skip to content
Browse files

#358: small refactoring according to Alexander's comments

  • Loading branch information...
1 parent 8ed84cc commit 3e7d84f94359ea9ed5155497d6908b13405afd69 @avokhmin avokhmin committed Feb 20, 2014
Showing with 13 additions and 3 deletions.
  1. +13 −3 app/models/build_list.rb
View
16 app/models/build_list.rb
@@ -56,9 +56,7 @@ class BuildList < ActiveRecord::Base
before_validation :prepare_extra_repositories, on: :create
before_validation :prepare_extra_build_lists, on: :create
before_validation :prepare_extra_params, on: :create
- before_validation lambda { self.auto_publish_status = AUTO_PUBLISH_STATUS_NONE if external_nodes.present?; true }, on: :create
- before_validation lambda { self.auto_publish_status = AUTO_PUBLISH_STATUS_NONE if auto_publish? && !save_to_repository.publish_without_qa?; true }, on: :create
- before_validation lambda { self.auto_create_container = false if auto_publish? || auto_publish_into_testing?; true }, on: :create
+ before_validation :prepare_auto_publish_status, on: :create
attr_accessible :include_repos, :auto_publish, :build_for_platform_id, :commit_hash,
:arch_id, :project_id, :save_to_repository_id, :update_type,
@@ -629,6 +627,18 @@ def prepare_extra_build_lists
self.extra_build_lists = bls.pluck('build_lists.id')
end
+ def prepare_auto_publish_status
+ if external_nodes.present?
+ self.auto_publish_status = AUTO_PUBLISH_STATUS_NONE
+ end
+ if auto_publish? && !save_to_repository.publish_without_qa?
+ self.auto_publish_status = AUTO_PUBLISH_STATUS_NONE
+ end
+ if auto_publish? || auto_publish_into_testing?
+ self.auto_create_container = false
+ end
+ end
+
def prepare_extra_params
if extra_params.present?
params = extra_params.slice(*BuildList::EXTRA_PARAMS)

0 comments on commit 3e7d84f

Please sign in to comment.
Something went wrong with that request. Please try again.