File: download.rb

package info (click to toggle)
ruby-pgplot 0.1.9-3
  • links: PTS, VCS
  • area: contrib
  • in suites: buster, stretch
  • size: 604 kB
  • ctags: 144
  • sloc: ruby: 1,607; makefile: 76; ansic: 57; sh: 17
file content (14 lines) | stat: -rw-r--r-- 327 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
require 'uri'
require 'net/ftp'

pkg_uri = ARGV[0] || "ftp://ftp.astro.caltech.edu/pub/pgplot/pgplot5.2.tar.gz"

uri = URI.parse(pkg_uri)
tar_file = File.basename(uri.path)

Net::FTP.open(uri.host) do |ftp|
  ftp.login
  ftp.passive = true
  puts "downloading #{tar_file} ..."
  ftp.getbinaryfile(uri.path, tar_file, 1024)
end