#31: add project_version into product

This commit is contained in:
Vokhmin Alexey V 2013-03-27 16:18:24 +04:00
parent 34585c0857
commit a171be9f53
6 changed files with 16 additions and 5 deletions

View File

@ -68,6 +68,7 @@ module GitHelper
end
def versions_for_group_select(project)
return [] unless project
[ ['Branches', project.repo.branches.map(&:name)],
['Tags', project.repo.tags.map(&:name)] ]
end

View File

@ -31,7 +31,8 @@ class Product < ActiveRecord::Base
:main_script,
:params,
:platform_id,
:autostart_status
:autostart_status,
:project_version
attr_readonly :platform_id
def full_clone(attrs = {})
@ -63,7 +64,7 @@ class Product < ActiveRecord::Base
def self.autostart_iso_builds(autostart_status)
Product.where(:autostart_status => autostart_status).each do |product|
pbl = product.product_build_lists.new
[:params, :main_script, :project].each do |k|
[:params, :main_script, :project, :project_version].each do |k|
pbl.send "#{k}=", product.send(k)
end
owner = product.platform.owner
@ -71,7 +72,6 @@ class Product < ActiveRecord::Base
pbl.autostarted = true
pbl.base_url = "http://#{product.platform.default_host}"
pbl.time_living = product.time_living / 60
pbl.project_version = product.project.default_branch
pbl.save
end
end

View File

@ -9,7 +9,7 @@
.both
.leftlist= f.label :project_version, t("activerecord.attributes.product_build_list.project_version"), :class => :label
.rightlist= f.select :project_version, versions_for_group_select(pbl.project), :selected => params[:product_build_lists].try(:fetch, :project_version) || pbl.project.default_branch
.rightlist= f.select :project_version, versions_for_group_select(pbl.project), :selected => params[:product_build_lists].try(:fetch, :project_version) || @product.project_version || pbl.project.default_branch
.both
= render 'platforms/products/def_fields', :f => f

View File

@ -10,6 +10,10 @@
.rightlist= f.autocomplete_field :project, autocomplete_project_platform_products_path(@platform), :id_element => 'src_project_id', :name => 'src_project', :value => @product.project.try(:name_with_owner)
.both
.leftlist= f.label :project_version, t("activerecord.attributes.product_build_list.project_version")
.rightlist= f.select :project_version, versions_for_group_select(@product.project), {:selected => params[:products].try(:fetch, :project_version) || @product.project_version, :include_blank => true}
.both
= render 'def_fields', :f => f
.leftlist= f.label :autostart_status

View File

@ -0,0 +1,5 @@
class AddProjectVersionToProduct < ActiveRecord::Migration
def change
add_column :products, :project_version, :string
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20130322132919) do
ActiveRecord::Schema.define(:version => 20130327120129) do
create_table "activity_feeds", :force => true do |t|
t.integer "user_id", :null => false
@ -331,6 +331,7 @@ ActiveRecord::Schema.define(:version => 20130322132919) do
t.string "main_script"
t.integer "time_living"
t.integer "autostart_status"
t.string "project_version"
end
create_table "project_imports", :force => true do |t|