#405: added auto_publish_status to MassBuild
This commit is contained in:
parent
6ba72db818
commit
544fc16c96
|
@ -1182,11 +1182,12 @@ div#advisory_search_block div.continue_input {
|
|||
form.mass_build {
|
||||
section.left {
|
||||
margin-left: 10px;
|
||||
width: 350px;
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
section.right {
|
||||
margin-right: 50px;
|
||||
width: 300px;
|
||||
}
|
||||
input[type="submit"] {
|
||||
margin: 10px 0 10px 0;
|
||||
|
|
|
@ -32,10 +32,11 @@ class BuildList < ActiveRecord::Base
|
|||
EXTRA_PARAMS = %w[cfg_options cfg_urpm_options build_src_rpm build_rpm]
|
||||
EXTERNAL_NODES = %w[owned everything]
|
||||
|
||||
AUTO_PUBLISH_STATUS_NONE = 'none'
|
||||
AUTO_PUBLISH_STATUS_DEFAULT = 'default'
|
||||
AUTO_PUBLISH_STATUS_TESTING = 'testing'
|
||||
AUTO_PUBLISH_STATUSES = [AUTO_PUBLISH_STATUS_NONE, AUTO_PUBLISH_STATUS_DEFAULT, AUTO_PUBLISH_STATUS_TESTING]
|
||||
AUTO_PUBLISH_STATUSES = [
|
||||
AUTO_PUBLISH_STATUS_NONE = 'none',
|
||||
AUTO_PUBLISH_STATUS_DEFAULT = 'default',
|
||||
AUTO_PUBLISH_STATUS_TESTING = 'testing'
|
||||
]
|
||||
|
||||
validates :project_id,
|
||||
:project_version,
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
class MassBuild < ActiveRecord::Base
|
||||
|
||||
AUTO_PUBLISH_STATUSES = %w(none default testing)
|
||||
|
||||
belongs_to :build_for_platform, -> { where(platform_type: 'main') }, class_name: 'Platform'
|
||||
belongs_to :save_to_platform, class_name: 'Platform'
|
||||
belongs_to :user
|
||||
|
@ -13,7 +16,7 @@ class MassBuild < ActiveRecord::Base
|
|||
scope :search, -> (q) { where("#{table_name}.description ILIKE ?", "%#{q}%") if q.present? }
|
||||
|
||||
attr_accessor :arches
|
||||
attr_accessible :arches, :auto_publish, :projects_list, :build_for_platform_id,
|
||||
attr_accessible :arches, :auto_publish_status, :projects_list, :build_for_platform_id,
|
||||
:extra_repositories, :extra_build_lists, :increase_release_tag,
|
||||
:use_cached_chroot, :use_extra_tests, :description
|
||||
|
||||
|
@ -31,8 +34,10 @@ class MassBuild < ActiveRecord::Base
|
|||
validates :description,
|
||||
length: { maximum: 255 }
|
||||
|
||||
validates :auto_publish,
|
||||
:increase_release_tag,
|
||||
validates :auto_publish_status,
|
||||
inclusion: { in: AUTO_PUBLISH_STATUSES }
|
||||
|
||||
validates :increase_release_tag,
|
||||
:use_cached_chroot,
|
||||
:use_extra_tests,
|
||||
inclusion: { in: [true, false] }
|
||||
|
|
|
@ -188,7 +188,7 @@ class Project < ActiveRecord::Base
|
|||
bl.arch = arch
|
||||
bl.project_version = project_version
|
||||
bl.user = user
|
||||
bl.auto_publish_status = mass_build.auto_publish? ? BuildList::AUTO_PUBLISH_STATUS_DEFAULT : BuildList::AUTO_PUBLISH_STATUS_NONE
|
||||
bl.auto_publish_status = mass_build.auto_publish_status
|
||||
bl.include_repos = include_repos
|
||||
bl.extra_repositories = mass_build.extra_repositories
|
||||
bl.extra_build_lists = mass_build.extra_build_lists
|
||||
|
|
|
@ -43,7 +43,10 @@
|
|||
subject: @mass_build,
|
||||
autocomplete_path: autocomplete_extra_build_list_autocompletes_path
|
||||
%h3= t("activerecord.attributes.build_list.preferences")
|
||||
- %i(auto_publish increase_release_tag use_cached_chroot use_extra_tests).each do |field|
|
||||
.both
|
||||
= f.select :auto_publish_status, auto_publish_statuses
|
||||
= f.label :auto_publish_status
|
||||
- %i(increase_release_tag use_cached_chroot use_extra_tests).each do |field|
|
||||
.both
|
||||
= f.check_box field
|
||||
= f.label field
|
||||
|
|
|
@ -10,13 +10,38 @@
|
|||
%td
|
||||
%b= t('activerecord.attributes.mass_build.name')
|
||||
%td= link_to_mass_build(@mass_build)
|
||||
|
||||
- %i(id arch_names auto_publish increase_release_tag use_cached_chroot use_extra_tests created_at description).each do |field|
|
||||
%tr
|
||||
%td
|
||||
%b= t("activerecord.attributes.mass_build.#{field}")
|
||||
%td= @mass_build.send field
|
||||
|
||||
%tr
|
||||
%td
|
||||
%b= t('activerecord.attributes.mass_build.id')
|
||||
%td= @mass_build.id
|
||||
%tr
|
||||
%td
|
||||
%b= t('activerecord.attributes.mass_build.arch_names')
|
||||
%td= @mass_build.arch_names
|
||||
%tr
|
||||
%td
|
||||
%b= t('activerecord.attributes.mass_build.auto_publish_status')
|
||||
%td= t("layout.build_lists.auto_publish_status.#{@mass_build.auto_publish_status}")
|
||||
%tr
|
||||
%td
|
||||
%b= t('activerecord.attributes.mass_build.increase_release_tag')
|
||||
%td= t("layout.#{@mass_build.increase_release_tag?}_")
|
||||
%tr
|
||||
%td
|
||||
%b= t('activerecord.attributes.mass_build.use_cached_chroot')
|
||||
%td= t("layout.#{@mass_build.use_cached_chroot?}_")
|
||||
%tr
|
||||
%td
|
||||
%b= t('activerecord.attributes.mass_build.use_extra_tests')
|
||||
%td= t("layout.#{@mass_build.use_extra_tests?}_")
|
||||
%tr
|
||||
%td
|
||||
%b= t('activerecord.attributes.mass_build.created_at')
|
||||
%td= @mass_build.created_at
|
||||
%tr
|
||||
%td
|
||||
%b= t('activerecord.attributes.mass_build.description')
|
||||
%td= @mass_build.description
|
||||
%tr
|
||||
%td
|
||||
%td
|
||||
|
@ -49,7 +74,7 @@
|
|||
|
||||
.buttons_block
|
||||
- if can?(:publish, @mass_build)
|
||||
- unless @mass_build.auto_publish?
|
||||
- unless @mass_build.auto_publish_status == BuildList::AUTO_PUBLISH_STATUS_DEFAULT
|
||||
= link_to t('layout.mass_builds.publish_success'),
|
||||
publish_platform_mass_build_path(@platform, @mass_build.id),
|
||||
method: :post, data: { confirm: t("layout.confirm") }, class: 'button'
|
||||
|
|
|
@ -31,7 +31,7 @@ en:
|
|||
updated_at: Updated
|
||||
arch_names: Architectures
|
||||
user: User
|
||||
auto_publish: Automated publishing
|
||||
auto_publish_status: Automated publishing
|
||||
increase_release_tag: Increase release tag
|
||||
use_cached_chroot: Use cached chroot
|
||||
use_extra_tests: Use extra tests
|
||||
|
|
|
@ -32,7 +32,7 @@ ru:
|
|||
updated_at: Обновлен
|
||||
arch_names: Архитектуры
|
||||
user: Пользователь
|
||||
auto_publish: Автоматическая публикация
|
||||
auto_publish_status: Автоматическая публикация
|
||||
increase_release_tag: Увеличить release тег
|
||||
use_cached_chroot: Использовать кэшированный chroot
|
||||
use_extra_tests: Использовать дополнительные тесты
|
||||
|
|
|
@ -0,0 +1,16 @@
|
|||
class AddAutoPublishStatusToMassBuilds < ActiveRecord::Migration
|
||||
class MassBuild < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def up
|
||||
add_column :mass_builds, :auto_publish_status, :string, default: 'none', null: false
|
||||
MassBuild.where(auto_publish: true).update_all(auto_publish_status: :default)
|
||||
remove_column :mass_builds, :auto_publish
|
||||
end
|
||||
|
||||
def down
|
||||
add_column :mass_builds, :auto_publish, :boolean, default: false
|
||||
MassBuild.where(auto_publish_status: :default).update_all(auto_publish: true)
|
||||
remove_column :mass_builds, :auto_publish_status
|
||||
end
|
||||
end
|
24
db/schema.rb
24
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: 20140626195741) do
|
||||
ActiveRecord::Schema.define(version: 20140627162053) do
|
||||
|
||||
# These are extensions that must be enabled in order to support this database
|
||||
enable_extension "plpgsql"
|
||||
|
@ -308,26 +308,26 @@ ActiveRecord::Schema.define(version: 20140626195741) do
|
|||
end
|
||||
|
||||
create_table "mass_builds", force: true do |t|
|
||||
t.integer "build_for_platform_id", null: false
|
||||
t.integer "build_for_platform_id", null: false
|
||||
t.string "name"
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.datetime "created_at", null: false
|
||||
t.datetime "updated_at", null: false
|
||||
t.string "arch_names"
|
||||
t.integer "user_id"
|
||||
t.boolean "auto_publish", default: false, null: false
|
||||
t.integer "build_lists_count", default: 0, null: false
|
||||
t.boolean "stop_build", default: false, null: false
|
||||
t.integer "build_lists_count", default: 0, null: false
|
||||
t.boolean "stop_build", default: false, null: false
|
||||
t.text "projects_list"
|
||||
t.integer "missed_projects_count", default: 0, null: false
|
||||
t.integer "missed_projects_count", default: 0, null: false
|
||||
t.text "missed_projects_list"
|
||||
t.boolean "new_core", default: true
|
||||
t.integer "save_to_platform_id", null: false
|
||||
t.integer "save_to_platform_id", null: false
|
||||
t.text "extra_repositories"
|
||||
t.text "extra_build_lists"
|
||||
t.boolean "increase_release_tag", default: false, null: false
|
||||
t.boolean "use_cached_chroot", default: true, null: false
|
||||
t.boolean "use_extra_tests", default: false, null: false
|
||||
t.boolean "increase_release_tag", default: false, null: false
|
||||
t.boolean "use_cached_chroot", default: true, null: false
|
||||
t.boolean "use_extra_tests", default: false, null: false
|
||||
t.string "description"
|
||||
t.string "auto_publish_status", default: "none", null: false
|
||||
end
|
||||
|
||||
create_table "users", force: true do |t|
|
||||
|
|
|
@ -130,7 +130,6 @@ describe Platforms::MassBuildsController do
|
|||
@create_params = {
|
||||
mass_build: {
|
||||
:projects_list => @repository.projects.map(&:name).join("\n"),
|
||||
:auto_publish => true,
|
||||
:build_for_platform_id => @platform
|
||||
},
|
||||
:platform_id => @platform,
|
||||
|
|
|
@ -4,7 +4,6 @@ FactoryGirl.define do
|
|||
association :user
|
||||
projects_list "first"
|
||||
arches { [ Arch.where(name: 'x86_64').first_or_create.id ] }
|
||||
auto_publish true
|
||||
stop_build false
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue