test_track_rails_client 4.0.0.alpha18 → 4.0.0.alpha19

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
  SHA1:
3
- metadata.gz: 6575966b336fbeb1e629c106c617da678c5c5748
4
- data.tar.gz: 5094cc3db273abac8c895cfea170ebea07ecb09a
3
+ metadata.gz: 8f0e3ba5a8b25543717d72ce97b118814bb59106
4
+ data.tar.gz: e24f6f23172eaffd2f42bbb2225224c61ff8c3fb
5
5
  SHA512:
6
- metadata.gz: b4234462a6cdd16f2045a5f20c36be3b754aadbd6f60aa34e7eba6866320822630cfa48c518b0ed704dda24ad705ba02af6f709a4665f461a4ad906cba3ac48d
7
- data.tar.gz: 8473ab0407dabbcb0f8dc8a766f3923607f9362c00737f5d9def6408325079be8b512ec31d143fa9495182a41de2fcdee457e6ea378cea3dccc2c76be9b765b3
6
+ metadata.gz: 07457a7ca53f7433eca21e33a53fe28a41df6aca0445c8ebce62e08915e120b31ed56f5dbf67a39159b255745ce87a127912c2cea751d6320a2646e8b4a3235c
7
+ data.tar.gz: f84f8e74c6b82ce0630bc81e7c66c224180053e42125cff661dc468d88d6cd089f8ef79685335aaf77f75903178fcb7904d8a609b7aeb898ddc68a7ddd246d26
@@ -18,27 +18,46 @@ class TestTrack::Fake::SplitRegistry
18
18
  private
19
19
 
20
20
  def split_hash
21
- if test_track_schema_yml.present?
22
- test_track_schema_yml[:splits]
21
+ if schema_registry.present?
22
+ schema_registry
23
+ elsif legacy_test_track_schema_yml.present?
24
+ legacy_test_track_schema_yml[:splits]
23
25
  else
24
26
  {}
25
27
  end
26
28
  end
27
29
 
28
- def test_track_schema_yml
29
- unless instance_variable_defined?(:@test_track_schema_yml)
30
- @test_track_schema_yml = _test_track_schema_yml
30
+ def schema_registry
31
+ @schema_registry = _schema_registry unless instance_variable_defined?(:@schema_registry)
32
+ @schema_registry
33
+ end
34
+
35
+ def _schema_registry
36
+ file = YAML.load_file(schema_yml_path)
37
+ file && file['splits'].each_with_object(ActiveSupport::HashWithIndifferentAccess.new) do |split, h|
38
+ h[split['name']] = split['weights']
39
+ end
40
+ end
41
+
42
+ def schema_yml_path
43
+ base = ENV['TEST_TRACK_SCHEMA_ROOT'] || Rails.root
44
+ File.join(base, 'testtrack', 'schema.yml')
45
+ end
46
+
47
+ def legacy_test_track_schema_yml
48
+ unless instance_variable_defined?(:@legacy_test_track_schema_yml)
49
+ @legacy_test_track_schema_yml = _legacy_test_track_schema_yml
31
50
  end
32
- @test_track_schema_yml
51
+ @legacy_test_track_schema_yml
33
52
  end
34
53
 
35
- def _test_track_schema_yml
36
- YAML.load_file(test_track_schema_yml_path).with_indifferent_access
54
+ def _legacy_test_track_schema_yml
55
+ YAML.load_file(legacy_test_track_schema_yml_path).with_indifferent_access
37
56
  rescue
38
57
  nil
39
58
  end
40
59
 
41
- def test_track_schema_yml_path
60
+ def legacy_test_track_schema_yml_path
42
61
  ENV["TEST_TRACK_SCHEMA_FILE_PATH"] || Rails.root.join('db', 'test_track_schema.yml')
43
62
  end
44
63
 
@@ -1,3 +1,3 @@
1
1
  module TestTrackRailsClient
2
- VERSION = "4.0.0.alpha18" # rubocop:disable Style/MutableConstant
2
+ VERSION = "4.0.0.alpha19" # rubocop:disable Style/MutableConstant
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: test_track_rails_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.0.0.alpha18
4
+ version: 4.0.0.alpha19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan O'Neill
@@ -13,7 +13,7 @@ authors:
13
13
  autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
- date: 2019-05-04 00:00:00.000000000 Z
16
+ date: 2019-05-05 00:00:00.000000000 Z
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
19
19
  name: airbrake