Skip to content
Browse files

rake rails:freeze:edge using http://dev.rubyonrails.org/archives/rail…

…s_edge.zip 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
View
48 railties/lib/tasks/framework.rake
@@ -38,40 +38,30 @@ namespace :rails do
end
end
- 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 = "http://dev.rubyonrails.org/svn/rails/"
-
- 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'
+ File.open('rails_edge.zip', 'wb') do |dst|
+ open 'http://dev.rubyonrails.org/archives/rails_edge.zip' do |src|
+ while chunk = src.read(4096)
+ dst << chunk
+ end
+ end
end
- touch "vendor/rails/REVISION_#{ENV['REVISION']}"
+ puts 'Unpacking Rails'
+ rm_rf 'rails'
+ `unzip rails_edge.zip`
@eric
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_edge.zip rails/Rakefile rails/cleanlogs.sh rails/pushgems.rb rails/release.rb).each do |goner|
+ rm_f goner
+ end
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
end
end

21 comments on commit 4b17082

@augustl

Nope, not on Windows XP Professional SP2 at least.

@technoweenie

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).

@imajes

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

@jm
Ruby on Rails member

Er why not use tar’s and vendor minitar?

@atnan

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

http://github.com/tarballs/rails-rails-master.tar.gz

@mk

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.

@yaroslav

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

@augustl

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

@foca

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.

@augustl

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 rails_edge.zip” will only open the zip in explorer. Oh the beauty of Windows’ API.

@ELLIOTTCABLE

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

@augustl

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.

@queso

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?

@geoffgarside

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

@augustl

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?

@tobi

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

@tobi

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?

@technoweenie

leethal: see comment # 3

@yaroslav

totally agree with technoweenie

@augustl

http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/2-rake-rails-freeze-edge-on-windows

Awful code, apply sexyness please.

@augustl

ping

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