diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-21 07:19:23 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-21 07:19:23 +0000 |
commit | da78d6efd2f41d2f23a8d6cb21e808a2c0869b3a (patch) | |
tree | ebe76b490849f1f80985f45c3d64c2e3caa59b03 /tool | |
parent | 3f7d45bf26f31d99e0b053683d7758c1deb03d98 (diff) | |
download | ruby-da78d6efd2f41d2f23a8d6cb21e808a2c0869b3a.tar.gz |
tool/downloader.rb: dryrun option [ci skip]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58043 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool')
-rw-r--r-- | tool/downloader.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/tool/downloader.rb b/tool/downloader.rb index d4f958e69a..941c1e7d51 100644 --- a/tool/downloader.rb +++ b/tool/downloader.rb @@ -59,6 +59,7 @@ class Downloader 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 # 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__ since = false when '-V' options[:verify] = true + when '-n', '--dryrun' + options[:dryrun] = true when /\A-/ abort "#{$0}: unknown option #{ARGV[0]}" else |