summaryrefslogtreecommitdiff
path: root/tool/downloader.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-27 17:10:56 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-06-27 17:10:56 +0000
commit5522d79803766d715c37a7826e079b1c05c11e59 (patch)
tree4d07d0d2cc3bb2d51a98653b4017c6a4e9e51ecd /tool/downloader.rb
parent5cfda37971da176ceba204d57acb5821c293d555 (diff)
downloader.rb: get rid of symlinks
* tool/downloader.rb: do not save downloaded files to cache. [ruby-core:81780] [Bug #13684] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/downloader.rb')
-rw-r--r--tool/downloader.rb14
1 files changed, 12 insertions, 2 deletions
diff --git a/tool/downloader.rb b/tool/downloader.rb
index 0498e3f95c..9ea9899682 100644
--- a/tool/downloader.rb
+++ b/tool/downloader.rb
@@ -129,6 +129,9 @@ class Downloader
else
name = File.basename(url.path)
end
+ cache_save = options.delete(:cache_save) {
+ ENV["CACHE_SAVE"] != "no"
+ }
cache = cache_file(url, name, options.delete(:cache_dir))
file ||= cache
if since.nil? and file.exist?
@@ -136,7 +139,9 @@ class Downloader
$stdout.puts "#{file} already exists"
$stdout.flush
end
- save_cache(cache, file, name)
+ if cache_save
+ save_cache(cache, file, name)
+ end
return file.to_path
end
if dryrun
@@ -197,7 +202,7 @@ class Downloader
end
if dest.eql?(cache)
link_cache(cache, file, name)
- else
+ elsif cache_save
save_cache(cache, file, name)
end
return file.to_path
@@ -282,6 +287,11 @@ if $0 == __FILE__
since = false
when '-n', '--dryrun'
options[:dryrun] = true
+ when '--cache-dir'
+ options[:cache_dir] = ARGV[1]
+ ARGV.shift
+ when /\A--cache-dir=(.*)/m
+ options[:cache_dir] = $1
when /\A-/
abort "#{$0}: unknown option #{ARGV[0]}"
else