miga-base 1.3.3.1 → 1.3.4.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: bbde5de18171f236e86625c6220a26243a66540fd27194c29541be12c1d89682
4
- data.tar.gz: 99a9d4aabfb239cc456e1d118809e5f843c0908f1a395457d8f97af82732d621
3
+ metadata.gz: 592c54ffc82b3c7355a101b81feb4c492dde4e2e0c21876056b700d8fbb191ab
4
+ data.tar.gz: 727e25670485ab5677fc99d93aa017d63d5a22d1ec4ec6f1260fd1b14ffc7075
5
5
  SHA512:
6
- metadata.gz: 6efbbc1082e92dee7611a7b42d573012a652a84343cb0778081bc2c2ed5aeb81089d2fadecbe3dd8f88538187a6d57fb57ad6b7ee0822c0e2b986ad261768b1c
7
- data.tar.gz: d524db7505c561128605a3773a384482383addee341d5769acd053f88721e4160ebc1c5f25fcf4ab55d435a42ef9a29c78bcefb419b8e09d81b4765b95dfa0c8
6
+ metadata.gz: 2f3980c26d56a8ad66c2a4263dac067d5f1d84e53ec40c5b1d0a81bdd86724388176a0d15f7773f2dec8783fc593c47aaa023edc89c8ae0badad084c00cb2f2f
7
+ data.tar.gz: ab051d7030764a4bc67844a6b44b471b0fbaa23c2b06be39bb02ba8e6d38e686f559b46951c655c3a614ed71a6f9fbdb98f15651beb61606309931aeaa7d831b
@@ -26,7 +26,8 @@ class MiGA::Cli::Action::Doctor < MiGA::Cli::Action
26
26
  '--only TASK',
27
27
  'Perform only the specified task (see --ignore)'
28
28
  ) do |v|
29
- op_k = @@OPERATIONS.find { |_, i| i[0] == v.downcase }.first
29
+ op_k = @@OPERATIONS.find { |_, i| i[0] == v.downcase }&.first
30
+ op_k or raise "Unknown task: #{v}"
30
31
  @@OPERATIONS.each_key { |i| cli[i] = false }
31
32
  cli[op_k] = true
32
33
  end
@@ -9,7 +9,7 @@ end
9
9
  module MiGA::Cli::Action::Download::Base
10
10
  def cli_base_flags(opt)
11
11
  opt.on(
12
- '--max INT', Integer,
12
+ '--max-download INT', Integer,
13
13
  'Maximum number of datasets to download (by default: unlimited)'
14
14
  ) { |v| cli[:max_datasets] = v }
15
15
  opt.on(
@@ -37,6 +37,11 @@ module MiGA::Cli::Action::Download::Base
37
37
  opt, 'get-metadata',
38
38
  'Only download and update metadata for existing datasets', :get_md
39
39
  )
40
+ opt.on(
41
+ '--updated-before DATE',
42
+ 'Only download metadata for datasets last updated before the given date',
43
+ 'Requires --get-metadata, supports date or date-time'
44
+ ) { |v| cli[:updated_before] = DateTime.parse(v) }
40
45
  end
41
46
 
42
47
  def cli_save_actions(opt)
@@ -79,6 +84,7 @@ module MiGA::Cli::Action::Download::Base
79
84
  p = cli.load_project
80
85
  ds = remote_list
81
86
  ds = discard_excluded(ds)
87
+ ds = exclude_newer(ds)
82
88
  ds = impose_limit(ds)
83
89
  [p, ds]
84
90
  end
@@ -110,6 +116,16 @@ module MiGA::Cli::Action::Download::Base
110
116
  ds
111
117
  end
112
118
 
119
+ def exclude_newer(ds)
120
+ return ds unless cli[:updated_before]
121
+
122
+ project = cli.load_project
123
+ ds.select do |name|
124
+ d = project.dataset(name)
125
+ d && DateTime.parse(d.metadata[:updated]) < cli[:updated_before]
126
+ end
127
+ end
128
+
113
129
  def impose_limit(ds)
114
130
  max = cli[:max_datasets].to_i
115
131
  if !max.zero? && max < ds.size
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, 3, 1].freeze
15
+ VERSION = [1.3, 4, 1].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(2023, 3, 29)
23
+ VERSION_DATE = Date.new(2023, 3, 30)
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.3.3.1
4
+ version: 1.3.4.1
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: 2023-03-29 00:00:00.000000000 Z
11
+ date: 2023-03-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daemons