From d91ceab0a9ddd66558300b6ca527a206c2dd552d Mon Sep 17 00:00:00 2001 From: Vokhmin Alexey V Date: Mon, 2 Jun 2014 20:49:50 +0400 Subject: [PATCH] rename forbid_to_publish_builds_not_from field to publish_builds_only_from_branch --- .../platforms/repositories_controller.rb | 2 +- app/models/build_list.rb | 6 +++--- app/models/repository.rb | 4 ++-- app/views/platforms/repositories/_form.html.haml | 4 ++-- config/locales/models/repository.en.yml | 2 +- config/locales/models/repository.ru.yml | 2 +- ..._not_from_to_publish_builds_only_from_branch.rb | 7 +++++++ db/schema.rb | 14 +++++++------- 8 files changed, 24 insertions(+), 17 deletions(-) create mode 100644 db/migrate/20140602164337_rename_repositories_forbid_to_publish_builds_not_from_to_publish_builds_only_from_branch.rb diff --git a/app/controllers/platforms/repositories_controller.rb b/app/controllers/platforms/repositories_controller.rb index 305019909..27734252f 100644 --- a/app/controllers/platforms/repositories_controller.rb +++ b/app/controllers/platforms/repositories_controller.rb @@ -22,7 +22,7 @@ class Platforms::RepositoriesController < Platforms::BaseController end def update - if @repository.update_attributes params[:repository].slice(:description, :synchronizing_publications, :forbid_to_publish_builds_not_from).merge(publish_without_qa: (params[:repository][:publish_without_qa] || @repository.publish_without_qa)) + if @repository.update_attributes params[:repository].slice(:description, :synchronizing_publications, :publish_builds_only_from_branch).merge(publish_without_qa: (params[:repository][:publish_without_qa] || @repository.publish_without_qa)) flash[:notice] = I18n.t("flash.repository.updated") redirect_to platform_repository_path(@platform, @repository) else diff --git a/app/models/build_list.rb b/app/models/build_list.rb index 8a5d8be3f..d364c574f 100644 --- a/app/models/build_list.rb +++ b/app/models/build_list.rb @@ -606,12 +606,12 @@ class BuildList < ActiveRecord::Base def valid_branch_for_publish? return true if save_to_platform.personal? || - save_to_repository.forbid_to_publish_builds_not_from.blank? || - ( project_version == save_to_repository.forbid_to_publish_builds_not_from ) + save_to_repository.publish_builds_only_from_branch.blank? || + ( project_version == save_to_repository.publish_builds_only_from_branch ) project.repo.git.native(:branch, {}, '--contains', commit_hash). gsub(/\*/, '').split(/\n/).map(&:strip). - include?(save_to_repository.forbid_to_publish_builds_not_from) + include?(save_to_repository.publish_builds_only_from_branch) end diff --git a/app/models/repository.rb b/app/models/repository.rb index f02cc7551..cb9fc2b36 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -23,7 +23,7 @@ class Repository < ActiveRecord::Base validates :description, presence: true validates :name, uniqueness: { scope: :platform_id, case_sensitive: false }, presence: true, format: { with: /\A[a-z0-9_\-]+\z/ } - validates :forbid_to_publish_builds_not_from, length: { maximum: 255 } + validates :publish_builds_only_from_branch, length: { maximum: 255 } scope :recent, -> { order(:name) } scope :main, -> { where(name: %w(main base)) } @@ -34,7 +34,7 @@ class Repository < ActiveRecord::Base :description, :publish_without_qa, :synchronizing_publications, - :forbid_to_publish_builds_not_from + :publish_builds_only_from_branch attr_readonly :name, :platform_id attr_accessor :projects_list diff --git a/app/views/platforms/repositories/_form.html.haml b/app/views/platforms/repositories/_form.html.haml index e44b03b5a..2343c718e 100644 --- a/app/views/platforms/repositories/_form.html.haml +++ b/app/views/platforms/repositories/_form.html.haml @@ -13,8 +13,8 @@ - if @platform.main? .both - .leftlist= f.label :forbid_to_publish_builds_not_from - .rightlist= f.text_field :forbid_to_publish_builds_not_from + .leftlist= f.label :publish_builds_only_from_branch + .rightlist= f.text_field :publish_builds_only_from_branch .both diff --git a/config/locales/models/repository.en.yml b/config/locales/models/repository.en.yml index 90b9b5767..83660c017 100644 --- a/config/locales/models/repository.en.yml +++ b/config/locales/models/repository.en.yml @@ -71,4 +71,4 @@ en: updated_at: Updated owner: Owner synchronizing_publications: Publish only on success all build_lists for each arch (checking by commit hash) - forbid_to_publish_builds_not_from: "Publish builds only from branch" + publish_builds_only_from_branch: "Publish builds only from branch" diff --git a/config/locales/models/repository.ru.yml b/config/locales/models/repository.ru.yml index 287361713..a2decc530 100644 --- a/config/locales/models/repository.ru.yml +++ b/config/locales/models/repository.ru.yml @@ -71,5 +71,5 @@ ru: updated_at: Обновлен owner: Владелец synchronizing_publications: Публиковать сборочные листы только при успешной сборке под каждую архитектуру (проверка по хэшу коммита) - forbid_to_publish_builds_not_from: "Публикация сборок только из ветки" + publish_builds_only_from_branch: "Публикация сборок только из ветки" diff --git a/db/migrate/20140602164337_rename_repositories_forbid_to_publish_builds_not_from_to_publish_builds_only_from_branch.rb b/db/migrate/20140602164337_rename_repositories_forbid_to_publish_builds_not_from_to_publish_builds_only_from_branch.rb new file mode 100644 index 000000000..32425dbf9 --- /dev/null +++ b/db/migrate/20140602164337_rename_repositories_forbid_to_publish_builds_not_from_to_publish_builds_only_from_branch.rb @@ -0,0 +1,7 @@ +class RenameRepositoriesForbidToPublishBuildsNotFromToPublishBuildsOnlyFromBranch < ActiveRecord::Migration + def change + change_table :repositories do |t| + t.rename :forbid_to_publish_builds_not_from, :publish_builds_only_from_branch + end + end +end diff --git a/db/schema.rb b/db/schema.rb index a0d15fbad..82c9152ac 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,7 +11,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 20140530193652) do +ActiveRecord::Schema.define(version: 20140602164337) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -522,14 +522,14 @@ ActiveRecord::Schema.define(version: 20140530193652) do end create_table "repositories", force: true do |t| - t.string "description", null: false - t.integer "platform_id", null: false + t.string "description", null: false + t.integer "platform_id", null: false t.datetime "created_at" t.datetime "updated_at" - t.string "name", null: false - t.boolean "publish_without_qa", default: true - t.boolean "synchronizing_publications", default: false, null: false - t.string "forbid_to_publish_builds_not_from" + t.string "name", null: false + t.boolean "publish_without_qa", default: true + t.boolean "synchronizing_publications", default: false, null: false + t.string "publish_builds_only_from_branch" t.index ["platform_id"], :name => "index_repositories_on_platform_id" end