提交 6ed9e68e 编写于 作者: M Michael Koziarski

Allow freezing to specific releases with rake rails:freeze:edge RELEASE=1.2.0 ...

Allow freezing to specific releases with rake rails:freeze:edge RELEASE=1.2.0  per-release zip files are generated automatically by git-archive on dev.rubyonrails.org.
上级 4364c361
...@@ -38,14 +38,17 @@ namespace :rails do ...@@ -38,14 +38,17 @@ namespace :rails do
end end
end end
desc 'Lock to latest Edge Rails' desc 'Lock to latest Edge Rails, for a specific release use RELEASE=1.2.0'
task :edge do task :edge do
require 'open-uri' require 'open-uri'
version = ENV["RELEASE"] || "edge"
target = "rails_#{version}.zip"
url = "http://dev.rubyonrails.org/archives/#{target}"
chdir 'vendor' do chdir 'vendor' do
puts 'Downloading Rails' puts "Downloading Rails from #{url}"
File.open('rails_edge.zip', 'wb') do |dst| File.open('rails.zip', 'wb') do |dst|
open 'http://dev.rubyonrails.org/archives/rails_edge.zip' do |src| open url do |src|
while chunk = src.read(4096) while chunk = src.read(4096)
dst << chunk dst << chunk
end end
...@@ -54,8 +57,8 @@ namespace :rails do ...@@ -54,8 +57,8 @@ namespace :rails do
puts 'Unpacking Rails' puts 'Unpacking Rails'
rm_rf 'rails' rm_rf 'rails'
`unzip rails_edge.zip` `unzip rails.zip`
%w(rails_edge.zip rails/Rakefile rails/cleanlogs.sh rails/pushgems.rb rails/release.rb).each do |goner| %w(rails.zip rails/Rakefile rails/cleanlogs.sh rails/pushgems.rb rails/release.rb).each do |goner|
rm_f goner rm_f goner
end end
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册