matt 1.1.0 → 1.1.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: 92deceb672378cd120f32646aa25b2359ed71dd6f839725b4b9f5f6399e61830
4
- data.tar.gz: b7e1f62d36921e21e5e5ef5d78c925500989f9fa6808c6f365bd80c3eeb6617a
3
+ metadata.gz: d0d982bf8b24d2c37f18bc1db92ba7f7382402d33b2cda5d9e63e23c3074856d
4
+ data.tar.gz: b6fdeddbf7570e4424c69e16718900b91fac8dc051f4a04bb6c8fe9246c128d2
5
5
  SHA512:
6
- metadata.gz: c661c1e3a8560513026e2d48cc435742e7db307866a0546006c2304290c809a5b912ee53eda7743f1be5980c90e9c36d9d7227698904dde9661cdb77c21b71ba
7
- data.tar.gz: b518ca0a0758c9828bb1ffcdbf30f85f851098007868a5fa91cf1ab5480c2794531ad4e310efee78d6f64daecd968b614f58afa7940e19ce1aa929514d5c1493
6
+ metadata.gz: 23144f539ac737c3f89454076a96961f350c8eb642661346056bebdc37abed009af67b5454a97c2806f972a43b0d2a60ac8ffe5fa5dca6bd01fdc6b3faae9064
7
+ data.tar.gz: d9d12f0a4289ab2ff1b6ac99093d15d6a374d8415f9eed06d37318281e9d6130a7d1ce3aecd09289c82b105a0ade2746e727fcca8ab2da3371db599533553f29
data/lib/matt/command.rb CHANGED
@@ -105,23 +105,20 @@ module Matt
105
105
  end
106
106
 
107
107
  def do_ping(argv)
108
- which_ones = if argv.empty?
109
- configuration.datasources.to_h.values
110
- else
111
- argv.map{|arg| datasource_exists!(arg) }
112
- end
108
+ which_ones = argv_to_xs(argv, :datasources)
113
109
  which_ones.each do |d|
114
110
  d.ping
115
111
  end
116
112
  end
117
113
 
118
114
  def do_export(argv)
119
- argv_count!(argv, 1)
120
- m = measure_exists!(argv.first)
121
- data = m.full_data.restrict(configuration.at_predicate)
122
- (@to || m.exporters).each do |e|
123
- exporter = exporter_exists!(e)
124
- exporter.export(m, data)
115
+ which_ones = argv_to_xs(argv, :measures)
116
+ which_ones.each do |m|
117
+ data = m.full_data.restrict(configuration.at_predicate)
118
+ (@to || m.exporters).each do |e|
119
+ exporter = exporter_exists!(e)
120
+ exporter.export(m, data)
121
+ end
125
122
  end
126
123
  end
127
124
 
@@ -190,25 +187,31 @@ module Matt
190
187
  abort
191
188
  end
192
189
 
193
- def measure_exists!(name)
194
- m = configuration.measures.send(name.to_sym)
195
- return m if m
196
- puts_err "No such measure #{name}"
190
+ def x_exists!(name, xs)
191
+ x = configuration.send(xs).send(name.to_sym)
192
+ return x if x
193
+ puts_err "No such #{xs[0...-1]} #{name}"
197
194
  abort
198
195
  end
199
196
 
197
+ def measure_exists!(name)
198
+ x_exists!(name, :measures)
199
+ end
200
+
200
201
  def exporter_exists!(name)
201
- m = configuration.exporters.send(name.to_sym)
202
- return m if m
203
- puts_err "No such exporter #{name}"
204
- abort
202
+ x_exists!(name, :exporters)
205
203
  end
206
204
 
207
205
  def datasource_exists!(name)
208
- d = configuration.datasources.send(name.to_sym)
209
- return d if d
210
- puts_err "No such datasource #{name}"
211
- abort
206
+ x_exists!(name, :datasources)
207
+ end
208
+
209
+ def argv_to_xs(argv, xs)
210
+ if argv.empty?
211
+ configuration.send(xs).to_h.values
212
+ else
213
+ argv.map{|arg| x_exists!(arg, xs) }
214
+ end
212
215
  end
213
216
 
214
217
  def abort
data/lib/matt/version.rb CHANGED
@@ -2,7 +2,7 @@ module Matt
2
2
  module Version
3
3
  MAJOR = 1
4
4
  MINOR = 1
5
- TINY = 0
5
+ TINY = 1
6
6
  end # module Version
7
7
  VERSION = [Version::MAJOR, Version::MINOR, Version::TINY].join(".")
8
8
  end # module Matt
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: matt
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bernard Lambeau