[前][次][番号順一覧][スレッド一覧]

ruby-changes:41525

From: nobu <ko1@a...>
Date: Wed, 20 Jan 2016 17:13:47 +0900 (JST)
Subject: [ruby-changes:41525] nobu:r53599 (trunk): extlibs.rb: add --cache option

nobu	2016-01-20 17:14:24 +0900 (Wed, 20 Jan 2016)

  New Revision: 53599

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=53599

  Log:
    extlibs.rb: add --cache option

  Modified files:
    trunk/ChangeLog
    trunk/tool/extlibs.rb
Index: tool/extlibs.rb
===================================================================
--- tool/extlibs.rb	(revision 53598)
+++ tool/extlibs.rb	(revision 53599)
@@ -3,9 +3,6 @@ require 'fileutils' https://github.com/ruby/ruby/blob/trunk/tool/extlibs.rb#L3
 require 'digest'
 require_relative 'downloader'
 
-cache_dir = ".downloaded-cache"
-FileUtils.mkdir_p(cache_dir)
-
 def do_download(url, base, cache_dir)
   Downloader.download(url, base, cache_dir, nil)
 end
@@ -74,23 +71,36 @@ def do_patch(dest, patch, args) https://github.com/ruby/ruby/blob/trunk/tool/extlibs.rb#L71
   $?.success? or raise "failed to patch #{patch}"
 end
 
-case ARGV[0]
-when '--download'
-  mode = :download
-  ARGV.shift
-when '--extract'
-  mode = :extract
-  ARGV.shift
-when '--patch'
-  mode = :patch
-  ARGV.shift
-when '--all'
-  mode = :all
+cache_dir = ENV['CACHE_DIR'] || ".downloaded-cache"
+mode = :all
+until ARGV.empty?
+  case ARGV[0]
+  when '--download'
+    mode = :download
+  when '--extract'
+    mode = :extract
+  when '--patch'
+    mode = :patch
+  when '--all'
+    mode = :all
+  when '--cache'
+    ARGV.shift
+    cache_dir = ARGV[0]
+  when /\A--cache=/
+    cache_dir = $'
+  when '--'
+    ARGV.shift
+    break
+  when /\A-/
+    abort "unknown option: #{ARGV[0]}"
+  else
+    break
+  end
   ARGV.shift
-else
-  mode = :all
 end
 
+FileUtils.mkdir_p(cache_dir)
+
 success = true
 ARGV.each do |dir|
   Dir.glob("#{dir}/**/extlibs") do |list|
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 53598)
+++ ChangeLog	(revision 53599)
@@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Wed Jan 20 17:13:39 2016  Nobuyoshi Nakada  <nobu@r...>
+
+
+
 Tue Jan 19 17:03:40 2016  Martin Duerst  <duerst@i...>
 
 	* common.mk: Added Unicode data file CaseFolding.txt to be additionally

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]