minimum-term 0.2.3 → 0.2.4

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: bd99082e8bf637a89f103afa0d127ea4041bbccd
4
- data.tar.gz: 7b64bef3c97149111aedbbf8a7f8fdb148c490e4
3
+ metadata.gz: bcd9ab33f7e5c94673cfde9bf3c827711ad6e427
4
+ data.tar.gz: 9fa485769144e8e32e33a3cdcd4d6bc52d22b05b
5
5
  SHA512:
6
- metadata.gz: bf9603e5b45344d5f69c635ce0dcf00036965a8c753d7e8a72b6c665ba1d6629726a99aac983e7e9f5543ac4c61c9b41dc90e1f8e1fc044f8dc354ce7005ba7b
7
- data.tar.gz: ba5b5ca716bfbd8013afb287723de872fb39c743f7f1a446ac11d7582e2879a9dbfba66ea0fe751a9e70a477cbeb82df5a85e44c35f0f7134e27a5cfdcca3ffe
6
+ metadata.gz: 167416726cd4d4c3ff0b024af0ed019dd960ac92a1ae0157ff774f4c1df1d58f1ba9c5d380edbd1e2c432fac821e80f83db5366c57bd13cd02893301ed14eedf
7
+ data.tar.gz: 6570613fc59e6299275bd19f86f239fa23782c9713114709d185aff66b6e68e71f146614a89378b2fb506da1772e93ee75735e45519246ce4c867c0162b5ff3a
@@ -1,3 +1,6 @@
1
+ # 0.2.4 (23-Oct-15)
2
+ - fix deep clone bug for schema scoping
3
+
1
4
  # 0.2.3 (22-Oct-15)
2
5
  - ignore consumed objects from other publishers when validating
3
6
 
@@ -7,8 +7,9 @@ module MinimumTerm
7
7
  end
8
8
 
9
9
  def scoped_schema(service)
10
- filtered_schema = schema.clone
11
- schema['definitions'].select! do |k|
10
+ # Poor man's deep clone: json 🆗 🆒
11
+ filtered_schema = JSON.parse(schema.to_json)
12
+ filtered_schema['definitions'].select! do |k|
12
13
  k.underscore.start_with?(service.name.underscore+MinimumTerm::SCOPE_SEPARATOR)
13
14
  end
14
15
  filtered_schema
@@ -2,22 +2,21 @@ require 'active_support/core_ext/hash/indifferent_access'
2
2
 
3
3
  module MinimumTerm
4
4
  class Infrastructure
5
- attr_reader :services, :errors, :data_dir
5
+ attr_reader :errors, :data_dir
6
6
 
7
7
  def initialize(data_dir:, verbose: false)
8
8
  @verbose = !!verbose
9
9
  @data_dir = data_dir
10
- @mutex = Mutex.new
11
- load_services
10
+ @mutex1 = Mutex.new
11
+ @mutex2 = Mutex.new
12
12
  end
13
13
 
14
14
  def reload
15
- load_services
15
+ @services = nil
16
16
  end
17
17
 
18
18
  def contracts_fulfilled?
19
- load_services
20
- @mutex.synchronize do
19
+ @mutex1.synchronize do
21
20
  @errors = {}
22
21
  publishers.each do |publisher|
23
22
  publisher.satisfies_consumers?(verbose: @verbose)
@@ -59,16 +58,16 @@ module MinimumTerm
59
58
  Dir.glob(File.join(@data_dir, "/**/*.schema.json"))
60
59
  end
61
60
 
62
- private
63
-
64
- def load_services
65
- @mutex.synchronize do
61
+ def services
62
+ @mutex2.synchronize do
63
+ return @services if @services
66
64
  @services = {}.with_indifferent_access
67
65
  dirs = Dir.glob(File.join(@data_dir, "*/"))
68
66
  dirs.each do |dir|
69
67
  service = MinimumTerm::Service.new(self, dir)
70
68
  @services[service.name] = service
71
69
  end
70
+ @services
72
71
  end
73
72
  end
74
73
  end
@@ -14,7 +14,7 @@ module MinimumTerm
14
14
  end
15
15
 
16
16
  def consuming_from
17
- consumed_objects.map(&:publisher)
17
+ consumed_objects.map(&:publisher).uniq
18
18
  end
19
19
 
20
20
  def consumers
@@ -1,3 +1,3 @@
1
1
  module MinimumTerm
2
- VERSION = '0.2.3'
2
+ VERSION = '0.2.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimum-term
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jannis Hermanns
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-10-22 00:00:00.000000000 Z
11
+ date: 2015-10-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport