Skip to content
Browse files

rake rails:freeze:edge using…

… instead of Subversion
  • Loading branch information...
1 parent ed99dda commit 4b17082107aced980fc4b511028ee763247bc5ab @jeremy jeremy committed
Showing with 19 additions and 29 deletions.
  1. +19 −29 railties/lib/tasks/framework.rake
48 railties/lib/tasks/framework.rake
@@ -38,40 +38,30 @@ namespace :rails do
- desc "Lock to latest Edge Rails or a specific revision with REVISION=X (ex: REVISION=4021) or a tag with TAG=Y (ex: TAG=rel_1-1-0)"
+ desc 'Lock to latest Edge Rails'
task :edge do
- $verbose = false
- `svn --version` rescue nil
- unless !$?.nil? && $?.success?
- $stderr.puts "ERROR: Must have subversion (svn) available in the PATH to lock this application to Edge Rails"
- exit 1
- end
- rm_rf "vendor/rails"
- mkdir_p "vendor/rails"
- svn_root = ""
- if ENV['TAG']
- rails_svn = "#{svn_root}/tags/#{ENV['TAG']}"
- touch "vendor/rails/TAG_#{ENV['TAG']}"
- else
- rails_svn = "#{svn_root}/trunk"
- if ENV['REVISION'].nil?
- ENV['REVISION'] = /^r(\d+)/.match(%x{svn -qr HEAD log #{svn_root}})[1]
- puts "REVISION not set. Using HEAD, which is revision #{ENV['REVISION']}."
+ require 'open-uri'
+ chdir 'vendor' do
+ puts 'Downloading Rails'
+'', 'wb') do |dst|
+ open '' do |src|
+ while chunk =
+ dst << chunk
+ end
+ end
- touch "vendor/rails/REVISION_#{ENV['REVISION']}"
+ puts 'Unpacking Rails'
+ rm_rf 'rails'
+ `unzip`
eric added a note

Does “unzip” exist on Windows?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
+ %w( rails/Rakefile rails/ rails/pushgems.rb rails/release.rb).each do |goner|
+ rm_f goner
+ end
- for framework in %w(railties actionpack activerecord actionmailer activesupport activeresource)
- system "svn export #{rails_svn}/#{framework} vendor/rails/#{framework}" + (ENV['REVISION'] ? " -r #{ENV['REVISION']}" : "")
- end
- puts "Updating current scripts, javascripts, and configuration settings"
- Rake::Task["rails:update"].invoke
+ puts 'Updating current scripts, javascripts, and configuration settings'
+ Rake::Task['rails:update'].invoke

21 comments on commit 4b17082


Nope, not on Windows XP Professional SP2 at least.


Suggestions: Perhaps zip/zipfilesystem and fallback to the `unzip` command if it’s not available (with a helpful message asking you to install rubyzip if unzip is unavailable).


that’s still yet another dependency. on OS X, you could just call open on it too.

Ruby on Rails member

Er why not use tar’s and vendor minitar?


There’s also the option of using Github’s tarball export:


will this changeset still be pushed into svn? Then we could just do rake rails:freeze:edge twice and be on the latest revision.

The zip doesnt seem to be working, yet. It’s got 0k here.


It can dl a file and unpack on POSIX systems and just dl and puts a warning like “unzip it into …” on Windows.


Most users has winrar installed, which afaik has some command line interface. A bit weird to rely on winrar, though.


I don’t have windows atm, but if you install the gui version of winrar I’m almost sure you don’t get the cli version. And in any case you’d require that *nix users have the `unrar` command operating on their command line.

I’d say it’s preferable to add another dependency but ensure cross-compatibility if it “just works” for everybody.


Windows XP has unzip functionality, but apparently it’s impossible to call it from the command line. There is the “compact” command, but that only works on .cab archives. “rundll32 zipfldr.dll,RouteTheCall” will only open the zip in explorer. Oh the beauty of Windows’ API.


I’m down for using another dependency in the vendor folder, and making it work for everybody.


Then again, it was required to have subversion before. So, asking people to install some freeware command line unzipper doesn’t seem too much to ask. After all, you can achieve the same thing by simply downloading the zip and unpacking it to vendor/rails manually, this is just a shortcut.


Why not just require rubyzip to be installed? Seems like then you can just make the call to it and not worry about which os it is. You could even provide fall thru support for OS’es that do support zip from the command line. leethal is right, svn was a dependency before, why not make rubyzip a dependency now?


heck rake’s a dependency, so I don’t really see anything wrong with making rubyzip or some other unarchiver another dependency


Yeah, I think the fact that this being a shortcut for downloading it manually means that one can live with some dependencies.

Oh hai, core team, any say on this?


We are looking at using ruby’s build in zlib to extract the files.


However, we are all on unix systems so there is not that big of an itch. Any windows users want to raise up to the task?


leethal: see comment # 3


totally agree with technoweenie


Awful code, apply sexyness please.



Please sign in to comment.
Something went wrong with that request. Please try again.