Universal mass rebuildfor platform onwer without hardcoded main repository or architecture
This commit is contained in:
parent
86328b6318
commit
77414b3092
|
@ -81,7 +81,7 @@ class Ability
|
|||
can [:read, :related, :members], Platform, :owner_type => 'Group', :owner_id => user.group_ids
|
||||
can([:read, :related, :members], Platform, read_relations_for('platforms')) {|platform| local_reader? platform}
|
||||
can([:update, :members], Platform) {|platform| local_admin? platform}
|
||||
can([:destroy, :members, :add_member, :remove_member, :remove_members] , Platform) {|platform| owner? platform}
|
||||
can([:destroy, :members, :add_member, :remove_member, :remove_members, :build_all] , Platform) {|platform| owner? platform}
|
||||
can :autocomplete_user_uname, Platform
|
||||
|
||||
can [:read, :projects_list], Repository, :platform => {:visibility => 'open'}
|
||||
|
|
|
@ -154,14 +154,16 @@ class Platform < ActiveRecord::Base
|
|||
end
|
||||
|
||||
def build_all(user)
|
||||
repositories.find_by_name('main').projects.find_in_batches(:batch_size => 2) do |group|
|
||||
sleep 1
|
||||
group.each do |p|
|
||||
%w(i586 x86_64).each do |arch|
|
||||
begin
|
||||
p.build_for(self, user, arch)
|
||||
rescue RuntimeError, Exception
|
||||
p.delay.build_for(self, user, arch)
|
||||
repositories.each do |rep|
|
||||
rep.projects.find_in_batches(:batch_size => 2) do |group|
|
||||
sleep 1
|
||||
group.each do |p|
|
||||
Arch.all.map(&:name).each do |arch|
|
||||
begin
|
||||
p.build_for(self, user, arch)
|
||||
rescue RuntimeError, Exception
|
||||
p.delay.build_for(self, user, arch)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
14
db/schema.rb
14
db/schema.rb
|
@ -17,8 +17,8 @@ ActiveRecord::Schema.define(:version => 20120425190938) do
|
|||
t.integer "user_id", :null => false
|
||||
t.string "kind"
|
||||
t.text "data"
|
||||
t.datetime "created_at", :null => false
|
||||
t.datetime "updated_at", :null => false
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
end
|
||||
|
||||
create_table "arches", :force => true do |t|
|
||||
|
@ -180,7 +180,7 @@ ActiveRecord::Schema.define(:version => 20120425190938) do
|
|||
t.string "owner_type"
|
||||
t.string "visibility", :default => "open", :null => false
|
||||
t.string "platform_type", :default => "main", :null => false
|
||||
t.string "distrib_type"
|
||||
t.string "distrib_type", :null => false
|
||||
end
|
||||
|
||||
add_index "platforms", ["name"], :name => "index_platforms_on_name", :unique => true, :case_sensitive => false
|
||||
|
@ -251,18 +251,18 @@ ActiveRecord::Schema.define(:version => 20120425190938) do
|
|||
t.text "description"
|
||||
t.string "ancestry"
|
||||
t.boolean "has_issues", :default => true
|
||||
t.boolean "has_wiki", :default => false
|
||||
t.string "srpm_file_name"
|
||||
t.string "srpm_content_type"
|
||||
t.integer "srpm_file_size"
|
||||
t.datetime "srpm_updated_at"
|
||||
t.boolean "has_wiki", :default => false
|
||||
t.string "default_branch", :default => "master"
|
||||
t.boolean "is_rpm", :default => true
|
||||
t.integer "average_build_time", :default => 0, :null => false
|
||||
t.integer "build_count", :default => 0, :null => false
|
||||
end
|
||||
|
||||
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true, :case_sensitive => false
|
||||
add_index "projects", ["owner_id"], :name => "index_projects_on_name_and_owner_id_and_owner_type", :unique => true
|
||||
|
||||
create_table "register_requests", :force => true do |t|
|
||||
t.string "name"
|
||||
|
@ -277,6 +277,7 @@ ActiveRecord::Schema.define(:version => 20120425190938) do
|
|||
end
|
||||
|
||||
add_index "register_requests", ["email"], :name => "index_register_requests_on_email", :unique => true, :case_sensitive => false
|
||||
add_index "register_requests", ["token"], :name => "index_register_requests_on_token", :unique => true, :case_sensitive => false
|
||||
|
||||
create_table "relations", :force => true do |t|
|
||||
t.integer "actor_id"
|
||||
|
@ -324,8 +325,8 @@ ActiveRecord::Schema.define(:version => 20120425190938) do
|
|||
t.string "name"
|
||||
t.string "email", :default => "", :null => false
|
||||
t.string "encrypted_password", :limit => 128, :default => "", :null => false
|
||||
t.string "password_salt", :default => "", :null => false
|
||||
t.string "reset_password_token"
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.datetime "remember_created_at"
|
||||
t.datetime "created_at"
|
||||
t.datetime "updated_at"
|
||||
|
@ -333,6 +334,7 @@ ActiveRecord::Schema.define(:version => 20120425190938) do
|
|||
t.string "role"
|
||||
t.string "language", :default => "en"
|
||||
t.integer "own_projects_count", :default => 0, :null => false
|
||||
t.datetime "reset_password_sent_at"
|
||||
t.text "professional_experience"
|
||||
t.string "site"
|
||||
t.string "company"
|
||||
|
|
Loading…
Reference in New Issue