miga-base 1.2.5.1 → 1.2.6.0

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: 2992b5ad14069f7dc68885cc65eb81eaa8073c07dd8482e6f399e1c2215ee496
4
- data.tar.gz: 7f18d3552baa5ef56757e47387dcb26f1555ec078b113508497ecd8c97a4b282
3
+ metadata.gz: a68d83e5dac07c94aa2bafe0eda06ba074d5b87f9d7bf97e521a5be3e59aa296
4
+ data.tar.gz: d9309d82f51e9bfce7cc18c8b32de6ab1491cf1fc3fd9b5af660298490bac2b8
5
5
  SHA512:
6
- metadata.gz: '0806bfd3c1c33685c00e9f794845de2566ea7d62c0b1950c576f964fa2a3b1045de3e024b696592cdf1c44e6dc601dbfe5135974cec97d8ce8f2a18c490ee803'
7
- data.tar.gz: 95a072ff6fbc247ef717435506ab114f396615dbf74efe5319d965aa9858e860c2aeac2dfadf2edbe3c64b05679c5cf9f9930bbf3ae4dbb5eb565c84f5ef8ba7
6
+ metadata.gz: 9a88c56adfc6fe0b32a708605aca18f798fdfe94a2d4ae62b5dda27b1bd85f8b7d2be4a6fb589c8cd8c56de6c3bdef3b271a2c61112092e01c01058aa7b68f7b
7
+ data.tar.gz: d71d65c936ee269d4f7f582f39e680452bf818d4fac827178ccb97ca0b468f5fa0a381148d40b5f92c25b1e57b9a93220e95a510309134b07fe484801cd75210
@@ -121,19 +121,17 @@ class MiGA::Cli::Action::Add < MiGA::Cli::Action
121
121
  raise 'Some files are duplicated, files must be unique.' if
122
122
  files.size != files.uniq.size
123
123
 
124
- expected_files = 1
125
124
  if cli[:input_type].to_s =~ /_paired$/
126
125
  if files.size.odd?
127
126
  raise 'Odd number of files incompatible with input type.'
128
127
  end
129
128
 
130
- expected_files = 2
131
129
  files = Hash[*files].to_a
132
130
  else
133
131
  files = files.map { |i| [i] }
134
132
  end
135
133
 
136
- if files.size != expected_files && !cli[:dataset].nil?
134
+ if files.size != 1 && !cli[:dataset].nil?
137
135
  raise 'The dataset name (-D) can only be specified with one input set.'
138
136
  end
139
137
  end
@@ -12,6 +12,7 @@ class MiGA::Cli::Action::GetDb < MiGA::Cli::Action
12
12
  local: File.expand_path('.miga_db', ENV['MIGA_HOME']),
13
13
  host: MiGA::MiGA.known_hosts(:miga_db),
14
14
  pb: true,
15
+ reuse_archive: false,
15
16
  overwrite: true
16
17
  }
17
18
  cli.parse do |opt|
@@ -39,6 +40,10 @@ class MiGA::Cli::Action::GetDb < MiGA::Cli::Action
39
40
  '--list-versions',
40
41
  'List available versions of the database and exit'
41
42
  ) { |v| cli[:list_versions] = v }
43
+ opt.on(
44
+ '--reuse-archive',
45
+ 'Reuse a previously downloaded archive if available'
46
+ ) { |v| cli[:reuse_archive] = v }
42
47
  opt.on(
43
48
  '--no-overwrite',
44
49
  'Exit without downloading if the target database already exists'
@@ -67,7 +72,7 @@ class MiGA::Cli::Action::GetDb < MiGA::Cli::Action
67
72
  check_target and return
68
73
 
69
74
  # Download and expand
70
- file = download_file(@ftp, ver[:path])
75
+ file = download_file(@ftp, ver[:path], cli[:reuse_archive])
71
76
  check_digest(ver, file)
72
77
  unarchive(file)
73
78
  register_database(manif, db, ver)
@@ -89,13 +94,17 @@ class MiGA::Cli::Action::GetDb < MiGA::Cli::Action
89
94
  MiGA::MiGA.remote_connection(cli[:host])
90
95
  end
91
96
 
92
- def download_file(ftp, path)
97
+ def download_file(ftp, path, reuse = false)
93
98
  cli.say "Downloading '#{path}'"
94
99
  file = File.expand_path(path, cli[:local])
95
- MiGA::MiGA.download_file_ftp(ftp, path, file) do |n, size|
96
- cli.advance("#{path}:", n, size) if cli[:pb]
100
+ if reuse && File.exist?(file)
101
+ cli.say "Reusing #{file}"
102
+ else
103
+ MiGA::MiGA.download_file_ftp(ftp, path, file) do |n, size|
104
+ cli.advance("#{path}:", n, size) if cli[:pb]
105
+ end
106
+ cli.print "\n" if cli[:pb]
97
107
  end
98
- cli.print "\n" if cli[:pb]
99
108
  file
100
109
  end
101
110
 
data/lib/miga/common.rb CHANGED
@@ -115,7 +115,7 @@ class MiGA::MiGA
115
115
  { T: 4, G: 3, M: 2, K: 1 }.each do |k, x|
116
116
  v = (bin ? 1024 : 1e3)**x
117
117
  if n > v
118
- n = '%.1f' % (n / v)
118
+ n = '%.1f' % (n.to_f / v)
119
119
  p = k
120
120
  break
121
121
  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.2, 5, 1].freeze
15
+ VERSION = [1.2, 6, 0].freeze
16
16
 
17
17
  ##
18
18
  # Nickname for the current major.minor version.
@@ -20,7 +20,7 @@ module MiGA
20
20
 
21
21
  ##
22
22
  # Date of the current gem relese.
23
- VERSION_DATE = Date.new(2022, 5, 9)
23
+ VERSION_DATE = Date.new(2022, 5, 23)
24
24
 
25
25
  ##
26
26
  # References of MiGA
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: miga-base
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.5.1
4
+ version: 1.2.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Luis M. Rodriguez-R
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-05-09 00:00:00.000000000 Z
11
+ date: 2022-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons