rename forbid_to_publish_builds_not_from field to publish_builds_only_from_branch

This commit is contained in:
Vokhmin Alexey V 2014-06-02 20:49:50 +04:00
parent f30feb1153
commit d91ceab0a9
8 changed files with 24 additions and 17 deletions

View File

@ -22,7 +22,7 @@ class Platforms::RepositoriesController < Platforms::BaseController
end end
def update 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") flash[:notice] = I18n.t("flash.repository.updated")
redirect_to platform_repository_path(@platform, @repository) redirect_to platform_repository_path(@platform, @repository)
else else

View File

@ -606,12 +606,12 @@ class BuildList < ActiveRecord::Base
def valid_branch_for_publish? def valid_branch_for_publish?
return true if save_to_platform.personal? || return true if save_to_platform.personal? ||
save_to_repository.forbid_to_publish_builds_not_from.blank? || save_to_repository.publish_builds_only_from_branch.blank? ||
( project_version == save_to_repository.forbid_to_publish_builds_not_from ) ( project_version == save_to_repository.publish_builds_only_from_branch )
project.repo.git.native(:branch, {}, '--contains', commit_hash). project.repo.git.native(:branch, {}, '--contains', commit_hash).
gsub(/\*/, '').split(/\n/).map(&:strip). 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 end

View File

@ -23,7 +23,7 @@ class Repository < ActiveRecord::Base
validates :description, presence: true validates :description, presence: true
validates :name, uniqueness: { scope: :platform_id, case_sensitive: false }, presence: true, validates :name, uniqueness: { scope: :platform_id, case_sensitive: false }, presence: true,
format: { with: /\A[a-z0-9_\-]+\z/ } 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 :recent, -> { order(:name) }
scope :main, -> { where(name: %w(main base)) } scope :main, -> { where(name: %w(main base)) }
@ -34,7 +34,7 @@ class Repository < ActiveRecord::Base
:description, :description,
:publish_without_qa, :publish_without_qa,
:synchronizing_publications, :synchronizing_publications,
:forbid_to_publish_builds_not_from :publish_builds_only_from_branch
attr_readonly :name, :platform_id attr_readonly :name, :platform_id
attr_accessor :projects_list attr_accessor :projects_list

View File

@ -13,8 +13,8 @@
- if @platform.main? - if @platform.main?
.both .both
.leftlist= f.label :forbid_to_publish_builds_not_from .leftlist= f.label :publish_builds_only_from_branch
.rightlist= f.text_field :forbid_to_publish_builds_not_from .rightlist= f.text_field :publish_builds_only_from_branch
.both .both

View File

@ -71,4 +71,4 @@ en:
updated_at: Updated updated_at: Updated
owner: Owner owner: Owner
synchronizing_publications: Publish only on success all build_lists for each arch (checking by commit hash) 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"

View File

@ -71,5 +71,5 @@ ru:
updated_at: Обновлен updated_at: Обновлен
owner: Владелец owner: Владелец
synchronizing_publications: Публиковать сборочные листы только при успешной сборке под каждую архитектуру (проверка по хэшу коммита) synchronizing_publications: Публиковать сборочные листы только при успешной сборке под каждую архитектуру (проверка по хэшу коммита)
forbid_to_publish_builds_not_from: "Публикация сборок только из ветки" publish_builds_only_from_branch: "Публикация сборок только из ветки"

View File

@ -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

View File

@ -11,7 +11,7 @@
# #
# It's strongly recommended that you check this file into your version control system. # 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 # These are extensions that must be enabled in order to support this database
enable_extension "plpgsql" enable_extension "plpgsql"
@ -522,14 +522,14 @@ ActiveRecord::Schema.define(version: 20140530193652) do
end end
create_table "repositories", force: true do |t| create_table "repositories", force: true do |t|
t.string "description", null: false t.string "description", null: false
t.integer "platform_id", null: false t.integer "platform_id", null: false
t.datetime "created_at" t.datetime "created_at"
t.datetime "updated_at" t.datetime "updated_at"
t.string "name", null: false t.string "name", null: false
t.boolean "publish_without_qa", default: true t.boolean "publish_without_qa", default: true
t.boolean "synchronizing_publications", default: false, null: false t.boolean "synchronizing_publications", default: false, null: false
t.string "forbid_to_publish_builds_not_from" t.string "publish_builds_only_from_branch"
t.index ["platform_id"], :name => "index_repositories_on_platform_id" t.index ["platform_id"], :name => "index_repositories_on_platform_id"
end end