ruby-changes:35644
From: nobu <ko1@a...>
Date: Sun, 28 Sep 2014 20:27:36 +0900 (JST)
Subject: [ruby-changes:35644] nobu:r47726 (trunk): downloader.rb
nobu 2014-09-28 20:27:22 +0900 (Sun, 28 Sep 2014) New Revision: 47726 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=47726 Log: downloader.rb * configure.in: use tool/downloader.rb directly. * tool/get-config_files: no longer used. Removed files: trunk/tool/get-config_files Modified files: trunk/common.mk trunk/configure.in trunk/tool/downloader.rb Index: configure.in =================================================================== --- configure.in (revision 47725) +++ configure.in (revision 47726) @@ -50,10 +50,7 @@ else https://github.com/ruby/ruby/blob/trunk/configure.in#L50 fi AC_SUBST(BASERUBY) -for conf in config.guess config.sub; do - test -f "$srcdir/tool/$conf" && continue - $BASERUBY -C "$srcdir/tool" get-config_files $conf -done +$BASERUBY -C "$srcdir/tool" downloader.rb -e gnu config.guess config.sub AC_DEFUN([RUBY_MINGW32], [AS_CASE(["$host_os"], Index: common.mk =================================================================== --- common.mk (revision 47725) +++ common.mk (revision 47726) @@ -1092,9 +1092,8 @@ update-gems: PHONY https://github.com/ruby/ruby/blob/trunk/common.mk#L1092 update-unicode: $(ECHO) Downloading Unicode data files... - $(Q) $(BASERUBY) -I$(srcdir)/tool -rdownloader -w \ - -C "$(srcdir)/enc/unicode/data" \ - -e 'ARGV.each{|f|Downloader::Unicode.download(f)}' \ + $(Q) $(BASERUBY) -C "$(srcdir)/enc/unicode/data" \ + ../../../tool/downloader.rb unicode \ UnicodeData.txt CompositionExclusions.txt NormalizationTest.txt info: info-program info-libruby_a info-libruby_so info-arch Index: tool/get-config_files =================================================================== --- tool/get-config_files (revision 47725) +++ tool/get-config_files (revision 47726) @@ -1,12 +0,0 @@ https://github.com/ruby/ruby/blob/trunk/tool/get-config_files#L0 -#!/usr/bin/ruby -require File.expand_path('../downloader', __FILE__) -ARGV.each {|n| - STDOUT.print "Downloading #{n}..."; STDOUT.flush - begin - Downloader.download(:gnu, n) - STDOUT.puts - rescue => e - STDOUT.puts - abort("#{$0}: #{e.message}") - end -} Index: tool/downloader.rb =================================================================== --- tool/downloader.rb (revision 47725) +++ tool/downloader.rb (revision 47726) @@ -53,6 +53,7 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L53 # download :unicode, 'UnicodeData.txt', 'enc/unicode/data' def self.download(url, name, dir = nil, ims = true) file = dir ? File.join(dir, name) : name + return true if ims.nil? and File.exist?(file) url = URI(url) if $VERBOSE $stdout.print "downloading #{name} ... " @@ -89,3 +90,35 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L90 raise e.class, "failed to download #{name}\n#{e.message}: #{url}", e.backtrace end end + +if $0 == __FILE__ + ims = true + until ARGV.empty? + case ARGV[0] + when '-d' + destdir = ARGV[1] + ARGV.shift(2) + when '-e' + ims = nil + ARGV.shift + when /\A-/ + abort "#{$0}: unknown option #{ARGV[0]}" + else + break + end + end + dl = Downloader.constants.find do |name| + ARGV[0].casecmp(name.to_s) == 0 + end + $VERBOSE = true + if dl + dl = Downloader.const_get(dl) + ARGV.shift + ARGV.each do |name| + dl.download(name, destdir, ims) + end + else + abort "usage: #{$0} url name" unless ARGV.size == 2 + Downloader.download(*ARGV, destdir, ims) + end +end -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/