Added ability to use specific branch for each platform
This commit is contained in:
parent
86c6fa60dd
commit
7efe8894ff
|
@ -12,7 +12,7 @@ NewBuildListController = (dataservice, $http) ->
|
||||||
result = _.select(vm.save_to_repositories, (e) ->
|
result = _.select(vm.save_to_repositories, (e) ->
|
||||||
e.id is vm.save_to_repository_id or
|
e.id is vm.save_to_repository_id or
|
||||||
!vm.save_to_repository_id and
|
!vm.save_to_repository_id and
|
||||||
e.platform_name is vm.project_version_name
|
e.default_branch is vm.project_version_name
|
||||||
)
|
)
|
||||||
return vm.save_to_repositories[0] if result.length is 0
|
return vm.save_to_repositories[0] if result.length is 0
|
||||||
result[0]
|
result[0]
|
||||||
|
@ -78,7 +78,7 @@ NewBuildListController = (dataservice, $http) ->
|
||||||
vm.build_for_platform_id = vm.save_to_repository.platform_id
|
vm.build_for_platform_id = vm.save_to_repository.platform_id
|
||||||
vm.is_build_for_main_platform = isBuildForMainPlatform()
|
vm.is_build_for_main_platform = isBuildForMainPlatform()
|
||||||
|
|
||||||
vm.project_version_name = vm.save_to_repository.platform_name
|
vm.project_version_name = vm.save_to_repository.default_branch
|
||||||
vm.project_version = setProjectVersion() if vm.is_build_for_main_platform
|
vm.project_version = setProjectVersion() if vm.is_build_for_main_platform
|
||||||
|
|
||||||
changeStatusRepositories()
|
changeStatusRepositories()
|
||||||
|
|
|
@ -51,7 +51,7 @@ class Platforms::PlatformsController < Platforms::BaseController
|
||||||
@admin_uname = params[:admin_uname]
|
@admin_uname = params[:admin_uname]
|
||||||
|
|
||||||
platform_params = params[:platform] || {}
|
platform_params = params[:platform] || {}
|
||||||
platform_params = platform_params.slice(:description, :platform_arch_settings_attributes, :released, :automatic_metadata_regeneration)
|
platform_params = platform_params.slice(:description, :platform_arch_settings_attributes, :released, :automatic_metadata_regeneration, :default_branch)
|
||||||
platform_params[:owner] = User.find(@admin_id) if @admin_id.present?
|
platform_params[:owner] = User.find(@admin_id) if @admin_id.present?
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -222,7 +222,7 @@ module BuildListsHelper
|
||||||
publish_without_qa: r.publish_without_qa?,
|
publish_without_qa: r.publish_without_qa?,
|
||||||
repo_name: r.name,
|
repo_name: r.name,
|
||||||
platform_id: r.platform.id,
|
platform_id: r.platform.id,
|
||||||
platform_name: r.platform.name,
|
default_branch: r.platform.default_branch,
|
||||||
default_arches: ( r.platform.platform_arch_settings.by_default.pluck(:arch_id).presence ||
|
default_arches: ( r.platform.platform_arch_settings.by_default.pluck(:arch_id).presence ||
|
||||||
Arch.where(name: Arch::DEFAULT).pluck(:id) )
|
Arch.where(name: Arch::DEFAULT).pluck(:id) )
|
||||||
}
|
}
|
||||||
|
|
|
@ -67,6 +67,10 @@ class Platform < ActiveRecord::Base
|
||||||
format: { with: /\A#{NAME_PATTERN}\z/ },
|
format: { with: /\A#{NAME_PATTERN}\z/ },
|
||||||
length: { maximum: 100 }
|
length: { maximum: 100 }
|
||||||
|
|
||||||
|
validates :default_branch,
|
||||||
|
presence: true,
|
||||||
|
length: { maximum: 100 }
|
||||||
|
|
||||||
validates :distrib_type,
|
validates :distrib_type,
|
||||||
presence: true,
|
presence: true,
|
||||||
inclusion: { in: APP_CONFIG['distr_types'] }
|
inclusion: { in: APP_CONFIG['distr_types'] }
|
||||||
|
@ -114,7 +118,8 @@ class Platform < ActiveRecord::Base
|
||||||
:platform_arch_settings_attributes,
|
:platform_arch_settings_attributes,
|
||||||
:automatic_metadata_regeneration,
|
:automatic_metadata_regeneration,
|
||||||
:admin_id,
|
:admin_id,
|
||||||
:term
|
:term,
|
||||||
|
:default_branch
|
||||||
|
|
||||||
attr_accessor :admin_id, :term
|
attr_accessor :admin_id, :term
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
value: @admin_uname,
|
value: @admin_uname,
|
||||||
class: 'typeahead' }
|
class: 'typeahead' }
|
||||||
|
|
||||||
|
= f.input :default_branch
|
||||||
|
|
||||||
- if %w(edit update).include? controller.action_name
|
- if %w(edit update).include? controller.action_name
|
||||||
|
|
||||||
- if can? :change_visibility, @platform
|
- if can? :change_visibility, @platform
|
||||||
|
|
|
@ -100,7 +100,12 @@ en:
|
||||||
platform:
|
platform:
|
||||||
term: Search
|
term: Search
|
||||||
admin_id: Owner
|
admin_id: Owner
|
||||||
|
default_branch: Default branch
|
||||||
|
hints:
|
||||||
|
platform:
|
||||||
|
default_branch: "This is the name of branch that will be used by default at creation of build for platform."
|
||||||
placeholders:
|
placeholders:
|
||||||
platform:
|
platform:
|
||||||
term: Enter the name of file or folder here.
|
term: Enter the name of file or folder here.
|
||||||
|
default_branch: Enter the name of branch here.
|
||||||
|
|
||||||
|
|
|
@ -101,6 +101,12 @@ ru:
|
||||||
platform:
|
platform:
|
||||||
term: Искать
|
term: Искать
|
||||||
admin_id: Владелец
|
admin_id: Владелец
|
||||||
|
default_branch: Ветка по умолчанию
|
||||||
|
hints:
|
||||||
|
platform:
|
||||||
|
default_branch: "Это имя ветки, которая будет использоваться по умолчанию при создании сборок для платформы."
|
||||||
placeholders:
|
placeholders:
|
||||||
platform:
|
platform:
|
||||||
term: Введите имя файла или папки здесь.
|
term: Введите имя файла или папки здесь.
|
||||||
|
default_branch: Введите имя ветки здесь.
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,11 @@
|
||||||
|
class AddDefaultBranchToPlatforms < ActiveRecord::Migration
|
||||||
|
def up
|
||||||
|
add_column :platforms, :default_branch, :string
|
||||||
|
execute "UPDATE platforms SET default_branch = name"
|
||||||
|
change_column_null :platforms, :default_branch, false
|
||||||
|
end
|
||||||
|
|
||||||
|
def down
|
||||||
|
remove_column :platforms, :default_branch
|
||||||
|
end
|
||||||
|
end
|
|
@ -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: 20150210192749) do
|
ActiveRecord::Schema.define(version: 20150217215529) 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"
|
||||||
|
@ -416,6 +416,7 @@ ActiveRecord::Schema.define(version: 20150210192749) do
|
||||||
t.integer "last_regenerated_status"
|
t.integer "last_regenerated_status"
|
||||||
t.string "last_regenerated_log_sha1"
|
t.string "last_regenerated_log_sha1"
|
||||||
t.string "automatic_metadata_regeneration"
|
t.string "automatic_metadata_regeneration"
|
||||||
|
t.string "default_branch", null: false
|
||||||
t.index ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
t.index ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ describe Platform do
|
||||||
it { should validate_uniqueness_of(:name).case_insensitive }
|
it { should validate_uniqueness_of(:name).case_insensitive }
|
||||||
it { should allow_value('Basic_platform-name-1234').for(:name) }
|
it { should allow_value('Basic_platform-name-1234').for(:name) }
|
||||||
it { should_not allow_value('.!').for(:name) }
|
it { should_not allow_value('.!').for(:name) }
|
||||||
|
it { should validate_presence_of(:default_branch)}
|
||||||
it { should validate_presence_of(:description) }
|
it { should validate_presence_of(:description) }
|
||||||
it { should validate_presence_of(:distrib_type) }
|
it { should validate_presence_of(:distrib_type) }
|
||||||
it { should validate_presence_of(:visibility) }
|
it { should validate_presence_of(:visibility) }
|
||||||
|
|
Loading…
Reference in New Issue