#778: update rails gem, update destroy Platform and Reposytory

This commit is contained in:
Vokhmin Alexey V 2012-12-17 16:28:17 +04:00
parent 1bae7d2293
commit 8757724acc
5 changed files with 63 additions and 53 deletions

View File

@ -1,6 +1,6 @@
source 'http://rubygems.org' source 'http://rubygems.org'
gem 'rails', '3.2.8' #, :git => 'git://github.com/rails/rails.git' gem 'rails', '3.2.9' #, :git => 'git://github.com/rails/rails.git'
gem 'pg', '~> 0.14.0' gem 'pg', '~> 0.14.0'
# gem 'silent-postgres', :git => 'git://github.com/dolzenko/silent-postgres.git' #'~> 0.1.1' # gem 'silent-postgres', :git => 'git://github.com/dolzenko/silent-postgres.git' #'~> 0.1.1'

View File

@ -25,31 +25,31 @@ GEM
remote: http://rubygems.org/ remote: http://rubygems.org/
specs: specs:
RedCloth (4.2.9) RedCloth (4.2.9)
actionmailer (3.2.8) actionmailer (3.2.9)
actionpack (= 3.2.8) actionpack (= 3.2.9)
mail (~> 2.4.4) mail (~> 2.4.4)
actionpack (3.2.8) actionpack (3.2.9)
activemodel (= 3.2.8) activemodel (= 3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
builder (~> 3.0.0) builder (~> 3.0.0)
erubis (~> 2.7.0) erubis (~> 2.7.0)
journey (~> 1.0.4) journey (~> 1.0.4)
rack (~> 1.4.0) rack (~> 1.4.0)
rack-cache (~> 1.2) rack-cache (~> 1.2)
rack-test (~> 0.6.1) rack-test (~> 0.6.1)
sprockets (~> 2.1.3) sprockets (~> 2.2.1)
activemodel (3.2.8) activemodel (3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
builder (~> 3.0.0) builder (~> 3.0.0)
activerecord (3.2.8) activerecord (3.2.9)
activemodel (= 3.2.8) activemodel (= 3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
arel (~> 3.0.2) arel (~> 3.0.2)
tzinfo (~> 0.3.29) tzinfo (~> 0.3.29)
activeresource (3.2.8) activeresource (3.2.9)
activemodel (= 3.2.8) activemodel (= 3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
activesupport (3.2.8) activesupport (3.2.9)
i18n (~> 0.6) i18n (~> 0.6)
multi_json (~> 1.0) multi_json (~> 1.0)
airbrake (3.1.2) airbrake (3.1.2)
@ -65,7 +65,7 @@ GEM
daemons (~> 1.1.4, <= 1.1.6) daemons (~> 1.1.4, <= 1.1.6)
i18n (>= 0.5.0) i18n (>= 0.5.0)
state_machine (~> 1.1.0) state_machine (~> 1.1.0)
builder (3.0.0) builder (3.0.4)
cancan (1.6.7) cancan (1.6.7)
cape (1.4.0) cape (1.4.0)
capistrano (2.12.0) capistrano (2.12.0)
@ -144,14 +144,14 @@ GEM
highline (1.6.13) highline (1.6.13)
hike (1.2.1) hike (1.2.1)
hirb (0.7.0) hirb (0.7.0)
i18n (0.6.0) i18n (0.6.1)
jbuilder (0.8.2) jbuilder (0.8.2)
activesupport (>= 3.0.0) activesupport (>= 3.0.0)
journey (1.0.4) journey (1.0.4)
jquery-rails (2.0.2) jquery-rails (2.0.2)
railties (>= 3.2.0, < 5.0) railties (>= 3.2.0, < 5.0)
thor (~> 0.14) thor (~> 0.14)
json (1.7.4) json (1.7.5)
kgio (2.7.4) kgio (2.7.4)
libv8 (3.3.10.4) libv8 (3.3.10.4)
macaddr (1.6.1) macaddr (1.6.1)
@ -172,7 +172,7 @@ GEM
meta-tags (1.2.6) meta-tags (1.2.6)
actionpack actionpack
mime-types (1.19) mime-types (1.19)
multi_json (1.3.6) multi_json (1.5.0)
mustache (0.99.4) mustache (0.99.4)
net-scp (1.0.4) net-scp (1.0.4)
net-ssh (>= 1.99.1) net-ssh (>= 1.99.1)
@ -215,18 +215,18 @@ GEM
rack rack
rack-ssl (1.3.2) rack-ssl (1.3.2)
rack rack
rack-test (0.6.1) rack-test (0.6.2)
rack (>= 1.0) rack (>= 1.0)
rack-throttle (0.3.0) rack-throttle (0.3.0)
rack (>= 1.0.0) rack (>= 1.0.0)
rails (3.2.8) rails (3.2.9)
actionmailer (= 3.2.8) actionmailer (= 3.2.9)
actionpack (= 3.2.8) actionpack (= 3.2.9)
activerecord (= 3.2.8) activerecord (= 3.2.9)
activeresource (= 3.2.8) activeresource (= 3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
bundler (~> 1.0) bundler (~> 1.0)
railties (= 3.2.8) railties (= 3.2.9)
rails-backbone (0.7.2) rails-backbone (0.7.2)
coffee-script (~> 2.2.0) coffee-script (~> 2.2.0)
ejs (~> 1.0.0) ejs (~> 1.0.0)
@ -235,15 +235,15 @@ GEM
railties (>= 3.0.0) railties (>= 3.0.0)
rails3-jquery-autocomplete (1.0.7) rails3-jquery-autocomplete (1.0.7)
rails (~> 3.0) rails (~> 3.0)
railties (3.2.8) railties (3.2.9)
actionpack (= 3.2.8) actionpack (= 3.2.9)
activesupport (= 3.2.8) activesupport (= 3.2.9)
rack-ssl (~> 1.3.2) rack-ssl (~> 1.3.2)
rake (>= 0.8.7) rake (>= 0.8.7)
rdoc (~> 3.4) rdoc (~> 3.4)
thor (>= 0.14.6, < 2.0) thor (>= 0.14.6, < 2.0)
raindrops (0.10.0) raindrops (0.10.0)
rake (0.9.2.2) rake (10.0.3)
rdiscount (1.6.8) rdiscount (1.6.8)
rdoc (3.12) rdoc (3.12)
json (~> 1.4) json (~> 1.4)
@ -314,8 +314,9 @@ GEM
skinny (0.2.1) skinny (0.2.1)
eventmachine (~> 0.12) eventmachine (~> 0.12)
thin (~> 1.2) thin (~> 1.2)
sprockets (2.1.3) sprockets (2.2.2)
hike (~> 1.2) hike (~> 1.2)
multi_json (~> 1.0)
rack (~> 1.0) rack (~> 1.0)
tilt (~> 1.1, != 1.3.0) tilt (~> 1.1, != 1.3.0)
sqlite3 (1.3.6) sqlite3 (1.3.6)
@ -330,10 +331,10 @@ GEM
rack (>= 1.0.0) rack (>= 1.0.0)
thor (0.16.0) thor (0.16.0)
tilt (1.3.3) tilt (1.3.3)
treetop (1.4.10) treetop (1.4.12)
polyglot polyglot
polyglot (>= 0.3.1) polyglot (>= 0.3.1)
tzinfo (0.3.33) tzinfo (0.3.35)
uglifier (1.2.7) uglifier (1.2.7)
execjs (>= 0.3.0) execjs (>= 0.3.0)
multi_json (~> 1.3) multi_json (~> 1.3)
@ -393,7 +394,7 @@ DEPENDENCIES
perform_later (~> 1.3.0) perform_later (~> 1.3.0)
pg (~> 0.14.0) pg (~> 0.14.0)
rack-throttle rack-throttle
rails (= 3.2.8) rails (= 3.2.9)
rails-backbone (~> 0.7.2) rails-backbone (~> 0.7.2)
rails3-generators rails3-generators
rails3-jquery-autocomplete (~> 1.0.7) rails3-jquery-autocomplete (~> 1.0.7)

View File

@ -156,10 +156,6 @@ class Platform < ActiveRecord::Base
end end
end end
def create_directory
system("sudo mkdir -p -m 0777 #{build_path [name, 'repositories']}")
end
def symlink_directory def symlink_directory
# umount_directory_for_rsync # TODO ignore errors # umount_directory_for_rsync # TODO ignore errors
system("ln -s #{path} #{symlink_path}") system("ln -s #{path} #{symlink_path}")
@ -212,8 +208,13 @@ class Platform < ActiveRecord::Base
end end
later :destroy, :queue => :clone_build later :destroy, :queue => :clone_build
protected protected
def create_directory
system("mkdir -p -m 0777 #{build_path([name, 'repository'])}")
end
def default_host def default_host
EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host] EventLog.current_controller.request.host_with_port rescue ::Rosa::Application.config.action_mailer.default_url_options[:host]
end end

View File

@ -16,8 +16,7 @@ class Repository < ActiveRecord::Base
scope :recent, order("name ASC") scope :recent, order("name ASC")
before_create :xml_rpc_create, :unless => lambda {Thread.current[:skip]} before_destroy :detele_directory
before_destroy :destroy_directory
attr_accessible :name, :description, :publish_without_qa attr_accessible :name, :description, :publish_without_qa
attr_readonly :name, :platform_id attr_readonly :name, :platform_id
@ -59,21 +58,30 @@ class Repository < ActiveRecord::Base
end end
end end
def destroy
with_skip {super} # avoid cascade XML RPC requests
end
later :destroy, :queue => :clone_build
protected protected
# TODO: remove it, when will be used new_core only. def detele_directory
def xml_rpc_create repository_path = platform.path
result = BuildServer.create_repo name, platform.name repository_path << '/repository'
if result == BuildServer::SUCCESS if platform.personal?
return true Platform.main.pluck(:name).each do |main_platform_name|
detele_repositories_directory "#{repository_path}/#{main_platform_name}"
end
else else
raise "Failed to create repository #{name} inside platform #{platform.name} with code #{result}." detele_repositories_directory repository_path
end end
end end
def destroy_directory def detele_repositories_directory(repository_path)
Resque.enqueue(AbfWorker::FileSystemWorker, Arch.pluck(:name).each do |arch|
{:id => id, :action => 'destroy', :type => 'repository'}) system("rm -rf #{repository_path}/#{arch}/#{name}")
return true end
system("rm -rf #{repository_path}/SRPMS/#{name}")
end end
end end

View File

@ -45,5 +45,5 @@ end
require 'stub_xml_rpc' require 'stub_xml_rpc'
Rails.application.config.to_prepare { Rails.application.config.to_prepare {
Platform.send :include, Modules::Models::SymlinkStub # Platform.send :include, Modules::Models::SymlinkStub
} }