public
Description: Ruby on Rails
Homepage: http://rubyonrails.org
Clone URL: git://github.com/rails/rails.git
rake rails:freeze:edge using http://dev.rubyonrails.org/archives/rails_edge.zip 
instead of Subversion
jeremy (author)
Thu Apr 10 22:15:50 -0700 2008
commit  4b17082107aced980fc4b511028ee763247bc5ab
tree    39b070c260bef4e88b0bd42e1c2710ff40fa4ed9
parent  ed99dda174da439a0947cdabea3babf027c672ac
...
38
39
40
41
 
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
 
 
 
 
 
 
 
 
 
 
64
65
66
 
 
 
 
 
 
67
68
69
70
71
72
73
74
 
 
75
76
77
...
38
39
40
 
41
42
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
44
45
46
47
48
49
50
51
52
53
54
 
55
56
57
58
59
60
61
62
 
 
 
 
 
 
63
64
65
66
67
0
@@ -38,40 +38,30 @@ namespace :rails do
0
       end
0
     end
0
 
0
-    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)"
0
+    desc 'Lock to latest Edge Rails'
0
     task :edge do
0
-      $verbose = false
0
-      `svn --version` rescue nil
0
-      unless !$?.nil? && $?.success?
0
-        $stderr.puts "ERROR: Must have subversion (svn) available in the PATH to lock this application to Edge Rails"
0
-        exit 1
0
-      end
0
-            
0
-      rm_rf   "vendor/rails"
0
-      mkdir_p "vendor/rails"
0
-      
0
-      svn_root = "http://dev.rubyonrails.org/svn/rails/"
0
-
0
-      if ENV['TAG']
0
-        rails_svn = "#{svn_root}/tags/#{ENV['TAG']}"
0
-        touch "vendor/rails/TAG_#{ENV['TAG']}"
0
-      else
0
-        rails_svn = "#{svn_root}/trunk"
0
-
0
-        if ENV['REVISION'].nil?
0
-          ENV['REVISION'] = /^r(\d+)/.match(%x{svn -qr HEAD log #{svn_root}})[1]
0
-          puts "REVISION not set. Using HEAD, which is revision #{ENV['REVISION']}."
0
+      require 'open-uri'
0
+
0
+      chdir 'vendor' do
0
+        puts 'Downloading Rails'
0
+        File.open('rails_edge.zip', 'wb') do |dst|
0
+          open 'http://dev.rubyonrails.org/archives/rails_edge.zip' do |src|
0
+            while chunk = src.read(4096)
0
+              dst << chunk
0
+            end
0
+          end
0
         end
0
 
0
-        touch "vendor/rails/REVISION_#{ENV['REVISION']}"
0
+        puts 'Unpacking Rails'
0
+        rm_rf 'rails'
1
+        `unzip rails_edge.zip`
0
+        %w(rails_edge.zip rails/Rakefile rails/cleanlogs.sh rails/pushgems.rb rails/release.rb).each do |goner|
0
+          rm_f goner
0
+        end
0
       end
0
 
0
-      for framework in %w(railties actionpack activerecord actionmailer activesupport activeresource)
0
-        system "svn export #{rails_svn}/#{framework} vendor/rails/#{framework}" + (ENV['REVISION'] ? " -r #{ENV['REVISION']}" : "")
0
-      end
0
-      
0
-      puts "Updating current scripts, javascripts, and configuration settings"
0
-      Rake::Task["rails:update"].invoke
0
+      puts 'Updating current scripts, javascripts, and configuration settings'
0
+      Rake::Task['rails:update'].invoke
0
     end
0
   end
0
 

Comments

eric Fri Apr 11 08:08:16 -0700 2008 at railties/lib/tasks/framework.rake L80

Does “unzip” exist on Windows?

augustl Fri Apr 11 08:49:52 -0700 2008

Nope, not on Windows XP Professional SP2 at least.

technoweenie Fri Apr 11 09:02:07 -0700 2008

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 Fri Apr 11 13:16:26 -0700 2008

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

jeremymcanally Fri Apr 11 13:34:09 -0700 2008

Er why not use tar’s and vendor minitar?

atnan Sat Apr 12 07:43:07 -0700 2008

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

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

mk Sun Apr 13 06:54:52 -0700 2008

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 Sun Apr 13 09:24:02 -0700 2008

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

augustl Sun Apr 13 09:36:06 -0700 2008

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

foca Sun Apr 13 12:44:52 -0700 2008

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 Sun Apr 13 13:13:40 -0700 2008

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 Sun Apr 13 16:53:39 -0700 2008

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

augustl Sun Apr 13 19:00:15 -0700 2008

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 Mon Apr 14 06:55:49 -0700 2008

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 Mon Apr 14 07:39:53 -0700 2008

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

augustl Mon Apr 14 09:25:11 -0700 2008

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 Mon Apr 14 10:15:33 -0700 2008

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

tobi Mon Apr 14 10:16:15 -0700 2008

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 Mon Apr 14 10:29:52 -0700 2008

leethal: see comment # 3

yaroslav Mon Apr 14 10:39:50 -0700 2008

totally agree with technoweenie

augustl Thu Apr 17 05:57:33 -0700 2008

ping