[前][次][番号順一覧][スレッド一覧]

ruby-changes:34454

From: hsbt <ko1@a...>
Date: Tue, 24 Jun 2014 10:26:34 +0900 (JST)
Subject: [ruby-changes:34454] hsbt:r46535 (trunk): * tool/downloader.rb: make Downloader class to general download utility.

hsbt	2014-06-24 10:26:21 +0900 (Tue, 24 Jun 2014)

  New Revision: 46535

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=46535

  Log:
    * tool/downloader.rb: make Downloader class to general download utility.
      It can be used without config.guess and configu.sub.
    * tool/get-config_files: ditto.
    * tool/make-snapshot: ditto.

  Modified files:
    trunk/ChangeLog
    trunk/tool/downloader.rb
    trunk/tool/get-config_files
    trunk/tool/make-snapshot
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46534)
+++ ChangeLog	(revision 46535)
@@ -1,3 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue Jun 24 10:20:35 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
+
+	* tool/downloader.rb: make Downloader class to general download utility.
+	  It can be used without config.guess and configu.sub.
+	* tool/get-config_files: ditto.
+	* tool/make-snapshot: ditto.
+
 Tue Jun 24 06:17:52 2014  NARUSE, Yui  <naruse@r...>
 
 	* eval.c (setup_exception): "mesg == sysstack_error" and
Index: tool/get-config_files
===================================================================
--- tool/get-config_files	(revision 46534)
+++ tool/get-config_files	(revision 46535)
@@ -3,7 +3,8 @@ require File.expand_path('../downloader' https://github.com/ruby/ruby/blob/trunk/tool/get-config_files#L3
 ARGV.each {|n|
   STDOUT.print "Downloading #{n}..."; STDOUT.flush
   begin
-    Downloader.download(n)
+    url = "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=%s;hb=HEAD" % n
+    Downloader.download(url, n)
     STDOUT.puts
   rescue => e
     STDOUT.puts
Index: tool/downloader.rb
===================================================================
--- tool/downloader.rb	(revision 46534)
+++ tool/downloader.rb	(revision 46535)
@@ -1,11 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L1
 require 'open-uri'
 
-Downloader = "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=%s;hb=HEAD"
-def Downloader.download(name, dir = nil)
-  uri = URI(self % name)
-  data = uri.read
-  file = dir ? File.join(dir, name) : name
-  open(file, "wb", 0755) {|f| f.write(data)}
-rescue => e
-  raise "failed to download #{name}\n#{e.message}: #{uri}"
+class Downloader
+  def self.download(url, name, dir = nil)
+    data = URI(url).read
+    file = dir ? File.join(dir, name) : name
+    open(file, "wb", 0755) {|f| f.write(data)}
+  rescue => e
+    raise "failed to download #{name}\n#{e.message}: #{uri}"
+  end
 end
Index: tool/make-snapshot
===================================================================
--- tool/make-snapshot	(revision 46534)
+++ tool/make-snapshot	(revision 46535)
@@ -222,7 +222,8 @@ def package(rev, destdir) https://github.com/ruby/ruby/blob/trunk/tool/make-snapshot#L222
       rescue LoadError
         abort "Error!!! Copy 'downloader.rb' from 'tool' directory of the recent ruby repository!"
       end
-      Downloader.download(conf, "tool")
+      url = "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=%s;hb=HEAD" % conf
+      Downloader.download(url, conf, "tool")
     end
     File.open(clean.add("cross.rb"), "w") do |f|
       f.puts "Object.__send__(:remove_const, :CROSS_COMPILING) if defined?(CROSS_COMPILING)"

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]