diff options
author | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-01 18:26:06 +0000 |
---|---|---|
committer | Jeremy Kemper <jeremy@bitsweat.net> | 2005-11-01 18:26:06 +0000 |
commit | 30b9d6d28a946f37cd41e9dad50fb7c9224dac6d (patch) | |
tree | 6d8d80f0b15c1415c91e7bae720257828b85fe1d /railties/lib/tasks | |
parent | c827b3f15cdf66da1d09eff5ad4878098933c7d6 (diff) | |
download | rails-30b9d6d28a946f37cd41e9dad50fb7c9224dac6d.tar.gz rails-30b9d6d28a946f37cd41e9dad50fb7c9224dac6d.tar.bz2 rails-30b9d6d28a946f37cd41e9dad50fb7c9224dac6d.zip |
The freeze_gems Rake task accepts the VERSION environment variable to decide which version of Rails to pull into vendor/rails.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2838 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'railties/lib/tasks')
-rw-r--r-- | railties/lib/tasks/framework.rake | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/railties/lib/tasks/framework.rake b/railties/lib/tasks/framework.rake index 727a186fe1..51c277c641 100644 --- a/railties/lib/tasks/framework.rake +++ b/railties/lib/tasks/framework.rake @@ -2,13 +2,28 @@ desc "Lock this application to the current gems (by unpacking them into vendor/r task :freeze_gems do rm_rf "vendor/rails" mkdir_p "vendor/rails" - - for gem in %w( actionpack activerecord actionmailer activesupport actionwebservice ) - system "cd vendor/rails; gem unpack #{gem}" - FileUtils.mv(Dir.glob("vendor/rails/#{gem}*").first, "vendor/rails/#{gem}") + + deps = %w( actionpack activerecord actionmailer activesupport actionwebservice ) + if version = ENV['VERSION'] + puts "Freezing to the gems for Rails #{version}" + require 'rubygems' + if rails = Gem.cache.search('rails').find { |g| g.version.to_s == version } + rails.dependencies.select { |g| deps.include? g.name }.each do |g| + system "cd vendor/rails; gem unpack -v '#{g.version_requirements}' #{g.name}; mv #{g.name}* #{g.name}" + end + system "cd vendor/rails; gem unpack -v '= #{version}' rails" + else + puts "No rails gem version #{version} is installed. Do 'gem list rails' to see which versions you have available." + exit + end + else + puts "Freezing to your latest Rails gems" + for gem in deps + system "cd vendor/rails; gem unpack #{gem}" + FileUtils.mv(Dir.glob("vendor/rails/#{gem}*").first, "vendor/rails/#{gem}") + end + system "cd vendor/rails; gem unpack rails" end - - system "cd vendor/rails; gem unpack rails" FileUtils.mv(Dir.glob("vendor/rails/rails*").first, "vendor/rails/railties") end |