[refs #442] Remove def is_rpm. Change auto_publish default value. Change MassBuild set_name. Fix schema

This commit is contained in:
konstantin.grabar 2012-05-21 17:59:04 +04:00
parent be2ab9154c
commit b85cb31b88
5 changed files with 9 additions and 12 deletions

View File

@ -1,17 +1,18 @@
class MassBuild < ActiveRecord::Base class MassBuild < ActiveRecord::Base
belongs_to :platform belongs_to :platform
before_save :set_name
scope :by_platform, lambda { |platform| where(:platform_id => platform.id) } scope :by_platform, lambda { |platform| where(:platform_id => platform.id) }
def build_all(opts={}) def build_all(opts={})
set_name opts[:repositories]
platform.build_all opts.merge({:mass_build_id => self.id}) platform.build_all opts.merge({:mass_build_id => self.id})
end end
protected private
def set_name def set_name(repositories_ids)
self.name = "#{Date.today.to_s}-#{platform.name}" rep_names = Repository.where(:id => repositories_ids).map(&:name).join(", ")
self.name = "#{Date.today.strftime("%d.%b")}-#{platform.name}(#{rep_names})"
self.save!
end end
end end

View File

@ -161,7 +161,7 @@ class Platform < ActiveRecord::Base
# Set options to build all need # Set options to build all need
repositories = opts[:repositories] ? self.repositories.where(:id => opts[:repositories]) : self.repositories repositories = opts[:repositories] ? self.repositories.where(:id => opts[:repositories]) : self.repositories
arches = opts[:arches] ? Arch.where(:id => opts[:arches]) : Arch.all arches = opts[:arches] ? Arch.where(:id => opts[:arches]) : Arch.all
auto_publish = opts[:auto_publish] || false auto_publish = opts[:auto_publish] || true
user = opts[:user] user = opts[:user]
mass_build_id = opts[:mass_build_id] mass_build_id = opts[:mass_build_id]

View File

@ -55,10 +55,6 @@ class Project < ActiveRecord::Base
include Modules::Models::Owner include Modules::Models::Owner
def is_rpm
is_package
end
def to_param def to_param
name name
end end

View File

@ -20,7 +20,7 @@
.table .table
%h3= t("activerecord.attributes.build_list.preferences") %h3= t("activerecord.attributes.build_list.preferences")
.lefter .lefter
= check_box_tag :auto_publish, true, params[:auto_publish].present?, :id => 'auto_publish' = check_box_tag :auto_publish, true, params[:auto_publish].present? ? params[:auto_publish].present? : true, :id => 'auto_publish'
= label_tag :auto_publish = label_tag :auto_publish
.both .both
.both .both

View File

@ -230,7 +230,7 @@ ActiveRecord::Schema.define(:version => 20120518105225) do
t.string "owner_type" t.string "owner_type"
t.string "visibility", :default => "open", :null => false t.string "visibility", :default => "open", :null => false
t.string "platform_type", :default => "main", :null => false t.string "platform_type", :default => "main", :null => false
t.string "distrib_type" t.string "distrib_type", :null => false
end end
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false