ncbi-blast-dbs 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,10 +1,25 @@
1
1
  require 'net/ftp'
2
2
 
3
+ # Downloads tarball at the given URL if a local copy does not exist, or if the
4
+ # local copy is older than at the given URL, or if the local copy is corrupt.
3
5
  def download(url)
4
6
  file = File.basename(url)
5
- sh "wget -Nc #{url} && wget -Nc #{url}.md5 &&"\
6
- " md5sum -c #{file}.md5 && tar xvf #{file}"\
7
- " || rm #{file} #{file}.md5"
7
+ # Download tarball if the local copy is older than at the given URL or fetch
8
+ # it for the first time.
9
+ sh "wget -N #{url}"
10
+ # Resume aborted download. Do nothing if the file is already fully retrieved
11
+ # (at the cost is a round trip to server).
12
+ sh "wget -c #{url}"
13
+
14
+ # Always download md5 and verify the tarball. Re-download tarball if corrupt;
15
+ # extract otherwise.
16
+ sh "wget #{url}.md5 && md5sum -c #{file}.md5" do |matched, _|
17
+ if !matched
18
+ sh "rm #{file} #{file}.md5"; download(url)
19
+ else
20
+ sh "tar xvf #{file}"
21
+ end
22
+ end
8
23
  end
9
24
 
10
25
  def databases
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
2
2
  s.authors = ['Anurag Priyam']
3
3
  s.email = ['anurag08priyam@gmail.com']
4
4
  s.name = 'ncbi-blast-dbs'
5
- s.version = '0.0.3'
5
+ s.version = '0.0.4'
6
6
  s.summary = 'Fast download BLAST databases from NCBI.'
7
7
  s.description = <<DESC
8
8
  Downloads BLAST databases from NCBI. Database files (volumes) are downloaded in
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ncbi-blast-dbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: