mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
downloader.rb
* configure.in: use tool/downloader.rb directly. * tool/get-config_files: no longer used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47726 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3bbea8ed37
commit
1c01280d17
4 changed files with 36 additions and 19 deletions
|
@ -1092,9 +1092,8 @@ update-gems: PHONY
|
|||
|
||||
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
|
||||
|
|
|
@ -50,10 +50,7 @@ else
|
|||
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"],
|
||||
|
|
|
@ -53,6 +53,7 @@ class Downloader
|
|||
# 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
|
|||
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
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
#!/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
|
||||
}
|
Loading…
Reference in a new issue