beast rev 2066
[beast-modified.git] / lib / tasks / deploy_edge.rake
blob4cc3a5fa7940ddb117759453687bf62c1dd4f39f
1 desc "freeze rails edge"
2 task :deploy_edge do
3   ENV['SHARED_PATH']  = '../../shared' unless ENV['SHARED_PATH']
4   ENV['RAILS_PATH'] ||= File.join(ENV['SHARED_PATH'], 'rails')
5   ENV['REPO_BRANCH'] ||= 'trunk'
6   
7   checkout_path = File.join(ENV['RAILS_PATH'], 'trunk')
8   export_path   = "#{ENV['RAILS_PATH']}/rev_#{ENV['REVISION']}"
9   symlink_path  = 'vendor/rails'
11   # do we need to checkout the file?
12   unless File.exists?(checkout_path)
13     puts 'setting up rails trunk'    
14     get_framework_for checkout_path do |framework|
15       system "svn co http://svn.rubyonrails.org/rails/#{ENV['REPO_BRANCH']}/#{framework}/lib #{checkout_path}/#{framework}/lib --quiet"
16     end
17   end
19   # do we need to export the revision?
20   unless File.exists?(export_path)
21     puts "setting up rails rev #{ENV['REVISION']}"
22     get_framework_for export_path do |framework|
23       system "svn up #{checkout_path}/#{framework}/lib -r #{ENV['REVISION']} --quiet"
24       system "svn export #{checkout_path}/#{framework}/lib #{export_path}/#{framework}/lib"
25     end
26   end
28   puts 'linking rails'
29   rm_rf   symlink_path
30   mkdir_p symlink_path
32   get_framework_for symlink_path do |framework|
33     ln_s File.expand_path("#{export_path}/#{framework}/lib"), "#{symlink_path}/#{framework}/lib"
34   end
35   
36   touch "vendor/rails_#{ENV['REVISION']}"
37 end
39 def get_framework_for(*paths)
40   %w( railties actionpack activerecord actionmailer activesupport activeresource ).each do |framework|
41     paths.each { |path| mkdir_p "#{path}/#{framework}" }
42     yield framework
43   end
44 end