marty 2.3.10 → 2.3.11

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: 82cb1e811619559b239be3b6b9cfbc667f7a185b0f413624d950cc2aabd0033f
4
- data.tar.gz: 632d8afa1b77da5c04d79a4c6402991d90ab1cc15496b8266236dd1444fd84a8
3
+ metadata.gz: e7f7e9505911744ae6176df440699f8b59620c9cd6a003347fdd152e44f08d6f
4
+ data.tar.gz: 75e04ea3b70b4970dd2b3062fa39847128f8e0f20ae852bd3a44ca97ca9bad40
5
5
  SHA512:
6
- metadata.gz: 289e52fc9bd6e1c59d189142dd15ff30ba3a13c39c9ef4b8f7a60754cf1883dc1b8e708b958dec5b8561002ec4c0d12b3b0a22eed48620d6f43403ef4f1548ca
7
- data.tar.gz: d0ad40461a84317f2cb9ab87a36e851bc1b952d87a9216094a0f812310d16c5d71c96c1b2a6a90535c1fc594a986e6791772c8740ce6fafd7f4b693ff32d5abe
6
+ metadata.gz: 301260304d97650534613145146e9356fa6c32cac58bcebc977c619aa8e347f024c22ab0d3c7e3717ae8c40ff7ef5aa3e2917a89e5eee84ede603ede83997631
7
+ data.tar.gz: 503a1bc5a0cc8eba84c02c33296ff01afe709b4872aa96e3072f07a3728d15c90fc1ba452ae9fc1826441d20bbfe559eabf7f52085987b4df9799244a5609a95
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- marty (2.3.9)
4
+ marty (2.3.11)
5
5
  aws-sigv4 (~> 1.0, >= 1.0.2)
6
6
  axlsx (= 3.0.0pre)
7
7
  coderay
@@ -48,8 +48,9 @@ class Marty::DeloreanRule < Marty::BaseRule
48
48
  computed_guards.keys
49
49
  end
50
50
 
51
- def self.comp_res_keys(results, grids, ecl, pcfg = nil)
52
- defkeys = (pcfg || Marty::Config[results_cfg_var] || {}).keys
51
+ def self.comp_res_keys(results, grids, ecl, pcfg)
52
+ # FIXME in May 2019: remove this check (use as passed)
53
+ defkeys = pcfg.is_a?(Hash) ? pcfg.keys : pcfg
53
54
  results.keys.map {|k| k.ends_with?("_grid") ? ecl.grid_final_name(k) : k}.
54
55
  select{|k| defkeys.include?(k)} + grid_keys(grids, ecl)
55
56
  end
@@ -73,6 +74,7 @@ class Marty::DeloreanRule < Marty::BaseRule
73
74
  id, name, eclassname, computed_guards, grids, results, fixed_results =
74
75
  ruleh.values_at("id", "name", "engine", "computed_guards", "grids",
75
76
  "results", "fixed_results")
77
+ raise "Error in rule '#{id}:#{name}': bad metadata_opts" if !metadata_opts
76
78
  eclass = eclassname && eclassname.constantize || Marty::RuleScriptSet
77
79
  engine = eclass.new(params["pt"]).get_engine(ruleh) if
78
80
  computed_guards.present? || results.present?
@@ -157,9 +159,7 @@ class Marty::DeloreanRule < Marty::BaseRule
157
159
  end
158
160
  end
159
161
  end
160
- def self.base_compute(ruleh, params, dgparams=params)
161
- base_compute2(ruleh, nil, params, dgparams)
162
- end
162
+
163
163
  delorean_fn :route_compute, sig: 4 do
164
164
  |ruleh, pt, params, grid_names_p|
165
165
  kl = ruleh["classname"].constantize
@@ -186,8 +186,8 @@ class Marty::DeloreanRule < Marty::BaseRule
186
186
  kl.validate_grid_attrs(ruleh, gridname, addl_attrs)
187
187
  end
188
188
 
189
- def base_compute(params, dgparams=params)
190
- self.class.base_compute(self_as_hash, params, dgparams)
189
+ def base_compute2(metadata_opts, params, dgparams=params)
190
+ self.class.base_compute2(self_as_hash, metadata_opts, params, dgparams)
191
191
  end
192
192
 
193
193
  def self.get_matches_(pt, attrs, params)
@@ -1,3 +1,3 @@
1
1
  module Marty
2
- VERSION = "2.3.10"
2
+ VERSION = "2.3.11"
3
3
  end
@@ -51,6 +51,6 @@ class Gemini::MyRule < Marty::DeloreanRule
51
51
  end
52
52
 
53
53
  def compute(*args)
54
- base_compute(*args)
54
+ base_compute2(*args)
55
55
  end
56
56
  end
@@ -44,7 +44,7 @@ class Gemini::XyzRule < Marty::DeloreanRule
44
44
  end
45
45
 
46
46
  def compute(*args)
47
- base_compute(*args)
47
+ base_compute2(*args)
48
48
  end
49
49
  def compute_xyz(pt, xyz_param)
50
50
  # Given a set of parameters, compute the RULE adjustment. Returns
@@ -334,6 +334,7 @@ EOL
334
334
  fill_in("Range Guard 1", with: "[100,200)")
335
335
  fill_in("Range Guard 2", with: "[30,40)")
336
336
  press("OK")
337
+ wait_for_ajax
337
338
  r = Gemini::XyzRule.get_matches('infinity', {}, {"g_range1"=> 150,
338
339
  "g_range2"=> 35})
339
340
 
@@ -7,16 +7,9 @@ module Marty::RuleSpec
7
7
  save_clean_db(@save_file)
8
8
  marty_whodunnit
9
9
  Marty::Script.load_scripts
10
- Marty::Config['RULEOPTS_MYRULE']={'simple_result'=>{},
11
- 'computed_value'=>{},
12
- 'final_value'=>{},
13
- 'grid_sum'=>{},
14
- 'c1'=>{},
15
- 'sr2'=>{},
16
- }
17
- Marty::Config['RULEOPTS_XYZ']={'bvlength'=>{},
18
- 'bv'=>{},
19
- }
10
+ @ruleopts_myrule=['simple_result', 'computed_value', 'final_value',
11
+ 'grid_sum', 'c1', 'sr2']
12
+ @ruleopts_xyz=['bvlength', 'bv']
20
13
  end
21
14
  after(:all) do
22
15
  restore_clean_db(@save_file)
@@ -266,7 +259,7 @@ module Marty::RuleSpec
266
259
  let(:complex) { Gemini::MyRule.get_matches('infinity',
267
260
  {'rule_type'=>'ComplexRule'},
268
261
  {'g_string'=>'def'}).first }
269
- let(:xyz) { Gemini::XyzRule.get_matches('infinity',
262
+ let(:xyz) { Gemini::XyzRule.get_matches('infinity',
270
263
  {'rule_type'=>'ZRule'},
271
264
  {'g_integer'=> 2}).first }
272
265
  let(:simple) {
@@ -291,8 +284,8 @@ module Marty::RuleSpec
291
284
  {"g_string"=>"Hi Mom",
292
285
  "g_integer"=>11}).first }
293
286
  it "computed guards work" do
294
- c = complex.compute({"pt"=>Time.zone.now,
295
- 'param2'=>'def'})
287
+ c = complex.compute(@ruleopts_myrule, {"pt"=>Time.zone.now,
288
+ 'param2'=>'def'})
296
289
  expect(c).to eq({"cguard2"=>false})
297
290
  end
298
291
  it "returns simple results via #fixed_results" do
@@ -306,50 +299,53 @@ module Marty::RuleSpec
306
299
  expect(simple.fixed_results.count).to eq(5)
307
300
  allow_any_instance_of(Delorean::Engine).
308
301
  to receive(:evaluate).and_raise('hi mom')
309
- expect{simple.compute({"pt"=>Time.now})}.to raise_error(/hi mom/)
302
+ expect{simple.compute(@ruleopts_myrule,
303
+ {"pt"=>Time.now})}.to raise_error(/hi mom/)
310
304
  # simple2a should return results without evaluation (they are all fixed)
311
- expect(simple2a.compute({"pt"=>Time.zone.now})).to eq(
305
+ expect(simple2a.compute(@ruleopts_myrule, {"pt"=>Time.zone.now})).to eq(
312
306
  {"simple_result"=>"b value",
313
307
  "sr2"=>true,
314
308
  })
315
309
  # simple2b should return grid results without evaluation
316
- expect(simple2b.
317
- compute({"pt"=>Time.zone.now,
318
- 'param1'=> 66,
319
- 'param2'=>'abc',
320
- 'paramb'=>false})).to eq({"grid1_grid_result"=>3,
321
- "grid2_grid_result"=>1300})
310
+ expect(simple2b.compute(@ruleopts_myrule,
311
+ {"pt"=>Time.zone.now,
312
+ 'param1'=> 66,
313
+ 'param2'=>'abc',
314
+ 'paramb'=>false})).
315
+ to eq({"grid1_grid_result"=>3,
316
+ "grid2_grid_result"=>1300})
322
317
 
323
318
  end
324
319
  it "returns computed results" do
325
- c = complex.compute({"pt"=>Time.zone.now,
326
- 'param1'=> 66,
327
- 'param2'=>'abc',
328
- 'paramb'=>false})
320
+ c = complex.compute(@ruleopts_myrule, {"pt"=>Time.zone.now,
321
+ 'param1'=> 66,
322
+ 'param2'=>'abc',
323
+ 'paramb'=>false})
329
324
  expect(c).to eq({"simple_result"=>"c value",
330
325
  "computed_value"=>19, "grid1_grid_result"=>3,
331
326
  "grid2_grid_result"=>1300})
332
327
  end
333
328
  it "returns computed results (with delorean import)" do
334
- c = xyz.compute({"pt"=>Time.zone.now+1,
335
- "p1"=>12,
336
- "p2"=>3,
337
- "flavor"=>"cherry"})
329
+ c = xyz.compute(@ruleopts_xyz, {"pt"=>Time.zone.now+1,
330
+ "p1"=>12,
331
+ "p2"=>3,
332
+ "flavor"=>"cherry"})
338
333
  expect(c).to eq({"bvlength"=>13,"bv"=>"cherry --> 36",
339
334
  "grid1_grid_result"=>19})
340
335
  end
341
336
  it "reports bad grid name" do
342
337
  exp = Regexp.new("Error .results. in rule '\\d+:Rule4': "\
343
338
  "DataGridX grid not found")
344
- expect{gridcomputedname.compute({"pt"=>Time.zone.now,
345
- 'param1'=> 66,
346
- 'param2'=>'abc',
347
- 'paramb'=>false})}.to raise_error(exp)
339
+ expect{gridcomputedname.compute(@ruleopts_myrule,
340
+ {"pt"=>Time.zone.now,
341
+ 'param1'=> 66,
342
+ 'param2'=>'abc',
343
+ 'paramb'=>false})}.to raise_error(exp)
348
344
  end
349
345
  it "grids embedded in result work properly and receive prior attrs" do
350
- v = altgridmethod.compute({"pt"=>Time.zone.now,
351
- 'param1'=> 45,
352
- 'param2' => 1})
346
+ v = altgridmethod.compute(@ruleopts_myrule, {"pt"=>Time.zone.now,
347
+ 'param1'=> 45,
348
+ 'param2' => 1})
353
349
  expect(v["final_value"]).to eq(15)
354
350
  end
355
351
  it "exceptions/logging" do
@@ -363,9 +359,9 @@ module Marty::RuleSpec
363
359
  "p1"=>12,
364
360
  "p2"=>3,
365
361
  "flavor"=>"cherry"}
366
- v1 = r6.compute(input)
362
+ v1 = r6.compute(@ruleopts_xyz, input)
367
363
  begin
368
- v2 = r7.compute(input)
364
+ v2 = r7.compute(@ruleopts_xyz, input)
369
365
  rescue Marty::DeloreanRule::ComputeError => e
370
366
  exp = 'no implicit conversion of Integer into String'
371
367
  expect(e.message).to include(exp)
@@ -379,7 +375,7 @@ module Marty::RuleSpec
379
375
  expect(e.section).to eq('results')
380
376
  end
381
377
  begin
382
- v2 = r8.compute(input)
378
+ v2 = r8.compute(@ruleopts_xyz, input)
383
379
  rescue Marty::DeloreanRule::ComputeError => e
384
380
  exp = 'divided by 0'
385
381
  expect(e.message).to include(exp)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: marty
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.3.10
4
+ version: 2.3.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arman Bostani
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2018-09-28 00:00:00.000000000 Z
17
+ date: 2018-10-02 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: pg