ruby-changes:45972
From: nobu <ko1@a...>
Date: Tue, 21 Mar 2017 16:19:29 +0900 (JST)
Subject: [ruby-changes:45972] nobu:r58043 (trunk): tool/downloader.rb: dryrun option [ci skip]
nobu 2017-03-21 16:19:23 +0900 (Tue, 21 Mar 2017) New Revision: 58043 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58043 Log: tool/downloader.rb: dryrun option [ci skip] Modified files: trunk/tool/downloader.rb Index: tool/downloader.rb =================================================================== --- tool/downloader.rb (revision 58042) +++ tool/downloader.rb (revision 58043) @@ -59,6 +59,7 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L59 class RubyGems < self def self.download(name, dir = nil, since = true, options = {}) require 'rubygems' + options = options.dup verify = options.delete(:verify) {Gem::VERSION >= "2.4."} options[:ssl_ca_cert] = Dir.glob(File.expand_path("../lib/rubygems/ssl_certs/**/*.pem", File.dirname(__FILE__))) file = under(dir, name) @@ -122,8 +123,14 @@ class Downloader https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L123 # download 'http://www.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt', # 'UnicodeData.txt', 'enc/unicode/data' def self.download(url, name, dir = nil, since = true, options = {}) + options = options.dup options.delete(:verify) file = under(dir, name) + dryrun = options.delete(:dryrun) + if dryrun + puts "Download #{url} into #{file}" + return false + end if since.nil? and File.exist?(file) if $VERBOSE $stdout.puts "#{name} already exists" @@ -213,6 +220,8 @@ if $0 == __FILE__ https://github.com/ruby/ruby/blob/trunk/tool/downloader.rb#L220 since = false when '-V' options[:verify] = true + when '-n', '--dryrun' + options[:dryrun] = true when /\A-/ abort "#{$0}: unknown option #{ARGV[0]}" else -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/