miga-base 1.3.12.0 → 1.3.12.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 45ab052e74f73fe87a2383443285dae3fb218c659618c1d2d7278ff8bb0de6f4
4
- data.tar.gz: 553c70d1a5c15093686260a0dec176a0f8ecd196f0884218484ff9964e416661
3
+ metadata.gz: 728f619f35f3e43fbd400b82372165e92b9126076d97e8a38883cf85f210be36
4
+ data.tar.gz: 94c49190af3cfb2325352ce2bbe8f8c4218c0beba4631cadeb2bbbf833af097f
5
5
  SHA512:
6
- metadata.gz: 27a87882655d6875f482042d388273ce46135329919f9738913022af6fd97f411e9db6238b4bd7fbcc50d7d605da51f447d85b68ff77758cf324ce9e59c7e592
7
- data.tar.gz: 116737b9a5ca99d97a8ad8f704a5df9146177c2d9603c8c4b19e631baa52e60183888369dcec96f671238f6ad934ce8c6324bc368aaff8bc8645f3b1d3dee247
6
+ metadata.gz: eef58d0024f7a17818f3b4802325817ca1c4f33398f38d9a444645b89526aa68e3a0b70b7b4ba23c4789b5c9367005ca7f2d27f69b42b6c8b5e87c0e2187f897
7
+ data.tar.gz: be8aa042bb9733da10d559fbc6b0210c4904c94aa66c1bd5de6ea84e2c5f0d9ede5ca77f64cf9e90671c54cc1e85ffdb895b2f77df237ef686302b3121b546f1
@@ -69,9 +69,10 @@ module MiGA::Cli::Action::Download::Base
69
69
  'Path to an output file with the list of all datasets listed remotely'
70
70
  ) { |v| cli[:remote_list] = v }
71
71
  opt.on(
72
- '--ncbi-taxonomy-dump STRING',
73
- 'Path to an NCBI Taxonomy dump directory to query instead of API calls'
74
- ) { |v| cli[:ncbi_taxonomy_dump] = v }
72
+ '--ncbi-taxonomy-dump [path]',
73
+ 'Path to an NCBI Taxonomy dump directory to query instead of API calls',
74
+ 'If the path is not passed, the dump is automatically downloaded'
75
+ ) { |v| cli[:ncbi_taxonomy_dump] = v || true }
75
76
  end
76
77
 
77
78
  def generic_perform
@@ -97,8 +98,21 @@ module MiGA::Cli::Action::Download::Base
97
98
  def load_ncbi_taxonomy_dump
98
99
  return unless cli[:ncbi_taxonomy_dump]
99
100
 
100
- cli.say "Reading NCBI Taxonomy dump: #{cli[:ncbi_taxonomy_dump]}"
101
- MiGA::RemoteDataset.use_ncbi_taxonomy_dump(cli[:ncbi_taxonomy_dump], cli)
101
+ if cli[:ncbi_taxonomy_dump] == true
102
+ cli.say 'Downloading and reading NCBI Taxonomy dump'
103
+ Dir.mktmpdir do |dir|
104
+ file = 'taxdump.tar.gz'
105
+ path = File.join(dir, file)
106
+ url = 'https://ftp.ncbi.nih.gov/pub/taxonomy/%s' % file
107
+
108
+ File.open(path, 'wb') { |fh| fh.print MiGA::MiGA.net_method(:get, url) }
109
+ MiGA::MiGA.run_cmd('cd "%s" && tar -zxf "%s"' % [dir, file])
110
+ MiGA::RemoteDataset.use_ncbi_taxonomy_dump(dir, cli)
111
+ end
112
+ else
113
+ cli.say "Reading NCBI Taxonomy dump: #{cli[:ncbi_taxonomy_dump]}"
114
+ MiGA::RemoteDataset.use_ncbi_taxonomy_dump(cli[:ncbi_taxonomy_dump], cli)
115
+ end
102
116
  end
103
117
 
104
118
 
@@ -123,10 +123,11 @@ module MiGA::Common::Net
123
123
 
124
124
  def net_method(method, uri, *opts)
125
125
  attempts ||= 0
126
+ uri = URI.parse(uri) if uri.is_a? String
126
127
  DEBUG "#{method.to_s.upcase}: #{uri} #{opts}"
127
128
  case method.to_sym
128
129
  when :ftp
129
- download_file_ftp(uri)
130
+ download_file_ftp(uri, *opts)
130
131
  else
131
132
  http_request(method, uri, *opts)
132
133
  end
data/lib/miga/version.rb CHANGED
@@ -12,7 +12,7 @@ module MiGA
12
12
  # - String indicating release status:
13
13
  # - rc* release candidate, not released as gem
14
14
  # - [0-9]+ stable release, released as gem
15
- VERSION = [1.3, 12, 0].freeze
15
+ VERSION = [1.3, 12, 1].freeze
16
16
 
17
17
  ##
18
18
  # Nickname for the current major.minor version.
data/test/net_test.rb CHANGED
@@ -37,15 +37,13 @@ class FormatTest < Test::Unit::TestCase
37
37
  f = tmpfile('t/test.txt')
38
38
  d = File.dirname(f)
39
39
  assert(!Dir.exist?(d))
40
- # TODO
41
- # Bring back when I can connect to the Gatech's FTP
42
- ### m = MiGA::MiGA
43
- ### m.download_file_ftp(:miga_online_ftp, 'api_test.txt', f)
44
- ### assert(Dir.exist?(d))
45
- ### assert_equal('miga', File.read(f).chomp)
46
- ### File.unlink(f)
47
- ### m.download_file_ftp(:miga_db, '../api_test.txt', f)
48
- ### assert_equal('miga', File.read(f).chomp)
40
+ m = MiGA::MiGA
41
+ m.download_file_ftp(:miga_online_ftp, 'api_test.txt', f)
42
+ assert(Dir.exist?(d))
43
+ assert_equal('miga', File.read(f).chomp)
44
+ File.unlink(f)
45
+ m.download_file_ftp(:miga_db, '../api_test.txt', f)
46
+ assert_equal('miga', File.read(f).chomp)
49
47
  end
50
48
 
51
49
  def test_encoding
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.12.0
4
+ version: 1.3.12.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R