merger stash
This commit is contained in:
parent
08c58a84df
commit
69fb368911
|
@ -23,10 +23,11 @@ class Project < ActiveRecord::Base
|
||||||
|
|
||||||
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false}, :presence => true, :format => {:with => /^#{NAME_REGEXP}$/, :message => I18n.t("activerecord.errors.project.uname")}
|
validates :name, :uniqueness => {:scope => [:owner_id, :owner_type], :case_sensitive => false}, :presence => true, :format => {:with => /^#{NAME_REGEXP}$/, :message => I18n.t("activerecord.errors.project.uname")}
|
||||||
validates :owner, :presence => true
|
validates :owner, :presence => true
|
||||||
|
validates :visibility, :presence => true, :inclusion => {:in => VISIBILITIES}
|
||||||
validate { errors.add(:base, :can_have_less_or_equal, :count => MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS }
|
validate { errors.add(:base, :can_have_less_or_equal, :count => MAX_OWN_PROJECTS) if owner.projects.size >= MAX_OWN_PROJECTS }
|
||||||
|
|
||||||
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki
|
attr_accessible :name, :description, :visibility, :srpm, :is_package, :default_branch, :has_issues, :has_wiki
|
||||||
attr_readonly :name
|
attr_readonly :name, :owner_id, :owner_type
|
||||||
|
|
||||||
scope :recent, order("name ASC")
|
scope :recent, order("name ASC")
|
||||||
scope :search_order, order("CHAR_LENGTH(name) ASC")
|
scope :search_order, order("CHAR_LENGTH(name) ASC")
|
||||||
|
@ -83,13 +84,12 @@ class Project < ActiveRecord::Base
|
||||||
owner == user
|
owner == user
|
||||||
end
|
end
|
||||||
|
|
||||||
def build_for(platform, user, arch = 'i586', auto_publish = false, mass_build_id = nil, priority = 0)
|
def build_for(platform, repository_id, user, arch = 'i586', auto_publish = false, mass_build_id = nil, priority = 0)
|
||||||
# Select main and project platform repository(contrib, non-free and etc)
|
# Select main and project platform repository(contrib, non-free and etc)
|
||||||
# If main does not exist, will connect only project platform repository
|
# If main does not exist, will connect only project platform repository
|
||||||
# If project platform repository is main, only main will be connect
|
# If project platform repository is main, only main will be connect
|
||||||
build_reps = [platform.repositories.find_by_name('main')]
|
main_rep_id = platform.repositories.find_by_name('main').id
|
||||||
build_reps += platform.repositories.select {|rep| self.repository_ids.include? rep.id}
|
build_reps_ids = [main_rep_id, repository_id].compact.uniq
|
||||||
build_reps_ids = build_reps.compact.map(&:id).uniq
|
|
||||||
arch = Arch.find_by_name(arch) if arch.acts_like?(:string)
|
arch = Arch.find_by_name(arch) if arch.acts_like?(:string)
|
||||||
build_lists.create do |bl|
|
build_lists.create do |bl|
|
||||||
bl.save_to_platform = platform
|
bl.save_to_platform = platform
|
||||||
|
@ -103,6 +103,7 @@ class Project < ActiveRecord::Base
|
||||||
bl.include_repos = build_reps_ids
|
bl.include_repos = build_reps_ids
|
||||||
bl.priority = priority
|
bl.priority = priority
|
||||||
bl.mass_build_id = mass_build_id
|
bl.mass_build_id = mass_build_id
|
||||||
|
bl.save_to_repository_id = repository_id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
16
db/schema.rb
16
db/schema.rb
|
@ -106,6 +106,7 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
|
||||||
t.string "project_version"
|
t.string "project_version"
|
||||||
t.integer "project_id"
|
t.integer "project_id"
|
||||||
t.integer "arch_id"
|
t.integer "arch_id"
|
||||||
|
t.datetime "notified_at"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
t.boolean "is_circle", :default => false
|
t.boolean "is_circle", :default => false
|
||||||
|
@ -167,8 +168,6 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
|
|
||||||
|
|
||||||
create_table "groups", :force => true do |t|
|
create_table "groups", :force => true do |t|
|
||||||
t.integer "owner_id"
|
t.integer "owner_id"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
|
@ -246,14 +245,14 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
|
||||||
t.string "description"
|
t.string "description"
|
||||||
t.string "name", :null => false
|
t.string "name", :null => false
|
||||||
t.integer "parent_platform_id"
|
t.integer "parent_platform_id"
|
||||||
t.datetime "created_at"
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at"
|
t.datetime "updated_at", :null => false
|
||||||
t.boolean "released", :default => false, :null => false
|
t.boolean "released", :default => false, :null => false
|
||||||
t.integer "owner_id"
|
t.integer "owner_id"
|
||||||
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", :null => false
|
t.string "distrib_type"
|
||||||
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
|
||||||
|
@ -394,20 +393,19 @@ ActiveRecord::Schema.define(:version => 20120730214052) do
|
||||||
create_table "users", :force => true do |t|
|
create_table "users", :force => true do |t|
|
||||||
t.string "name"
|
t.string "name"
|
||||||
t.string "email", :default => "", :null => false
|
t.string "email", :default => "", :null => false
|
||||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
t.string "encrypted_password", :default => "", :null => false
|
||||||
t.string "password_salt", :default => "", :null => false
|
|
||||||
t.string "reset_password_token"
|
t.string "reset_password_token"
|
||||||
t.datetime "remember_created_at"
|
t.datetime "remember_created_at"
|
||||||
t.datetime "created_at", :null => false
|
t.datetime "created_at", :null => false
|
||||||
t.datetime "updated_at", :null => false
|
t.datetime "updated_at", :null => false
|
||||||
|
t.text "ssh_key"
|
||||||
t.string "uname"
|
t.string "uname"
|
||||||
t.string "role"
|
t.string "role"
|
||||||
t.string "language", :default => "en"
|
t.string "language", :default => "en"
|
||||||
|
t.integer "own_projects_count", :default => 0, :null => false
|
||||||
t.string "confirmation_token"
|
t.string "confirmation_token"
|
||||||
t.datetime "confirmed_at"
|
t.datetime "confirmed_at"
|
||||||
t.datetime "confirmation_sent_at"
|
t.datetime "confirmation_sent_at"
|
||||||
t.integer "own_projects_count", :default => 0, :null => false
|
|
||||||
t.datetime "reset_password_sent_at"
|
|
||||||
t.text "professional_experience"
|
t.text "professional_experience"
|
||||||
t.string "site"
|
t.string "site"
|
||||||
t.string "company"
|
t.string "company"
|
||||||
|
|
Loading…
Reference in New Issue