test_ids 0.8.1 → 0.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/config/version.rb +1 -1
- data/lib/test_ids/allocator.rb +15 -4
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 131ee6beb6b36186d39111f96c2ba0c06d9a71fd
|
4
|
+
data.tar.gz: 5d4fc2e812a336213246939bf1f23b61739a35c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91110e14f7c4ff5f63fdb3011abca0e3ecaf774423a1002a6a5db73ce3bdf0fd33bc31cdde8e6d3887cf4c1e5dd37c5dd8fc0112fc7ca1c096320e9bcae50530
|
7
|
+
data.tar.gz: fed24675c4d9754fce08d539b43039a7bda4c838c5cd5daa378d94fbcff05151a314b70a20185c514b4a15012371e5aab9fe5d9b3b0324acefe20bddbf89d37e
|
data/config/version.rb
CHANGED
data/lib/test_ids/allocator.rb
CHANGED
@@ -26,8 +26,19 @@ module TestIds
|
|
26
26
|
|
27
27
|
def range_item(range, options)
|
28
28
|
orig_options = options.dup
|
29
|
-
#
|
30
|
-
|
29
|
+
# Now Check if the database (JSON file) exists.
|
30
|
+
# If file exists, load the database and create the alias for ['pointer']['ranges']
|
31
|
+
if file && File.exist?(file)
|
32
|
+
lines = File.readlines(file)
|
33
|
+
# Remove any header comment lines since these are not valid JSON
|
34
|
+
lines.shift while lines.first =~ /^\/\// && !lines.empty?
|
35
|
+
s = JSON.load(lines.join("\n"))
|
36
|
+
rangehash = s['pointers']['ranges']
|
37
|
+
rangehash = Hash[rangehash.map { |k, v| [k.to_sym, v] }]
|
38
|
+
else
|
39
|
+
# Create an alias for the databse that stores the pointers per range
|
40
|
+
rangehash = store['pointers']['ranges'] ||= {}
|
41
|
+
end
|
31
42
|
# Check the database to see if the passed in range has already been included in the database hash
|
32
43
|
if rangehash.key?(:"#{range}")
|
33
44
|
# Read out the database hash to see what the last_softbin given out was for that range.
|
@@ -47,12 +58,12 @@ module TestIds
|
|
47
58
|
assigned_value = range.to_a[@pointer]
|
48
59
|
end
|
49
60
|
# Now update the database pointers to point to the lastest assigned softbin for a given range.
|
50
|
-
rangehash.merge!("#{range}"
|
61
|
+
rangehash.merge!(:"#{range}" => "#{range.to_a[@pointer]}")
|
51
62
|
else
|
52
63
|
# This is the case for a brand new range that has not been passed before
|
53
64
|
# We start from the first value as the assigned softbin and update the database to reflect.
|
54
65
|
@pointer = 0
|
55
|
-
rangehash.merge!("#{range}"
|
66
|
+
rangehash.merge!(:"#{range}" => "#{range.to_a[@pointer]}")
|
56
67
|
assigned_value = range.to_a[@pointer]
|
57
68
|
end
|
58
69
|
unless !assigned_value.nil? && assigned_value.between?(range.min, range.max)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: test_ids
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stephen McGinty
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-05-
|
11
|
+
date: 2018-05-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: origen
|