summaryrefslogtreecommitdiff
path: root/tool/downloader.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-23 09:49:42 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-23 09:49:42 +0000
commit7a05e0ae9f1983bb6446ef64092b58cbaa26bc45 (patch)
tree6bc9ea314a63d2d90b8aa431bc4f540aea61b21f /tool/downloader.rb
parent6f3e8df133c7785ff6bb6f18d1faec81fefb3999 (diff)
* tool/config_files.rb: rename class ConfigFiles to Downloader.
* tool/get-config_files: ditto. * tool/make-snapshot: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46517 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'tool/downloader.rb')
-rw-r--r--tool/downloader.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/tool/downloader.rb b/tool/downloader.rb
new file mode 100644
index 0000000..83554fb
--- /dev/null
+++ b/tool/downloader.rb
@@ -0,0 +1,11 @@
+require 'open-uri'
+
+Downloader = "http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=%s;hb=HEAD"
+def Downloader.download(name, dir = nil)
+ uri = URI(self % name)
+ data = uri.read
+ file = dir ? File.join(dir, name) : name
+ open(file, "wb", 0755) {|f| f.write(data)}
+rescue => e
+ raise "failed to download #{name}\n#{e.message}: #{uri}"
+end