lacerda 0.10.2 → 0.11.0

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: df7a0e578ebe770967b35f9a0e2bb6279a12f721
4
- data.tar.gz: fc7b2c819b292131386d96ee82ef074f564c9a7e
3
+ metadata.gz: ff23a2681e40e382e4e01fb4ce0b67aaab1c24ce
4
+ data.tar.gz: 605bd530f4bc51914bbc2f6e513156e4e7eedc20
5
5
  SHA512:
6
- metadata.gz: 304c14f4567c78f02454ac992ab2d512a5fa8b7a2bcdfdf6559535462e01fa33c31227ee7f0ada642a2dc2e4a002b617018646f7b08c007316933b642d56c718
7
- data.tar.gz: 3f226bd986dde94bd80ebdbec1efb8f0848a8dfe08d0bde1a94cb0880c2eea0dbaabc82543bf595f66c3bcf5b88c47e527f0741168c6b7b71cb87b5d811d1e4d
6
+ metadata.gz: 131589ccbb3c6ff9ada1e8498ce3836ad151eaa0cb778675086c67f23f5b3e36494c8914f7bcbf041156f4c0b49d23738ef8f6a424e186b1504fa5310fe4b9e4
7
+ data.tar.gz: d7d6ae3c7d5506772fe8eb787dc73365b8fa1337afc36977cf5685936007291f7aa9232da56512904bdf679e6f883cf07ee65f923959376c0a948aee35621c06
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,7 @@
1
+ # 0.11.0 (04-Nov-15)
2
+ - rename ConsumeContract and PublishContract to ConsumeSpecification and PublishSpecification
3
+ - omit redundant service name in model names of publish contracts
4
+
1
5
  # 0.10.2 (04-Nov-15)
2
6
  - report all missing definitions instead of just the first (fixes #8)
3
7
 
data/README.md CHANGED
@@ -37,10 +37,10 @@ and smoke it:
37
37
  ```shell
38
38
  /home/dev/lacerda$ DATA_DIR=contracts/ rake lacerda:mson_to_json_schema
39
39
  Converting 4 files:
40
- OK /home/dev/lacerda/contracts/consumer/consume.mson
41
- OK /home/dev/lacerda/contracts/invalid_property/consume.mson
42
- OK /home/dev/lacerda/contracts/missing_required/consume.mson
43
- OK /home/dev/lacerda/contracts/publisher/publish.mson
40
+ OK /home/dev/lacerda/specifications/consumer/consume.mson
41
+ OK /home/dev/lacerda/specifications/invalid_property/consume.mson
42
+ OK /home/dev/lacerda/specifications/missing_required/consume.mson
43
+ OK /home/dev/lacerda/specifications/publisher/publish.mson
44
44
  /home/dev/lacerda$
45
45
  ```
46
46
 
@@ -59,9 +59,9 @@ By converting all files in a directory this gem will build up the following rela
59
59
  - Infrastructure
60
60
  - Service
61
61
  - Contracts
62
- - Publish contract
62
+ - Publish specification
63
63
  - PublishedObjects
64
- - Consume contract
64
+ - Consume specification
65
65
  - ConsumedObjects
66
66
 
67
67
  # References
data/lib/lacerda.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require 'lacerda/conversion'
2
- require 'lacerda/publish_contract'
3
- require 'lacerda/consume_contract'
2
+ require 'lacerda/publish_specification'
3
+ require 'lacerda/consume_specification'
4
4
  require 'lacerda/service'
5
5
  require 'lacerda/infrastructure'
6
6
  require 'lacerda/compare/json_schema'
@@ -1,7 +1,7 @@
1
- require 'lacerda/contract'
1
+ require 'lacerda/specification'
2
2
 
3
3
  module Lacerda
4
- class ConsumeContract < Lacerda::Contract
4
+ class ConsumeSpecification < Lacerda::Specification
5
5
  def object_description_class
6
6
  Lacerda::ConsumedObject
7
7
  end
@@ -6,6 +6,26 @@ module Lacerda
6
6
  PRIMITIVES = %w{boolean string number array enum object}
7
7
 
8
8
  def self.scope(scope, string)
9
+ # This allows users to enter either
10
+ #
11
+ # # Message
12
+ # - id (number, required)
13
+ # - ...
14
+ #
15
+ # or
16
+ #
17
+ # # MessageService::Message
18
+ # - id (number, required)
19
+ # - ...
20
+ #
21
+ # in their publish.mson specification files. Including the service name in
22
+ # a publish specification is redundant and not necessary, but let's let our
23
+ # friendly users do this if they wish.
24
+ #
25
+ scope = nil if Lacerda.underscore(string.to_s).start_with?(Lacerda.underscore(scope.to_s))
26
+
27
+ # Now that this is out of the way, let's put a
28
+ # scope in front and return the string.
9
29
  Lacerda.underscore(
10
30
  [scope, string.to_s].compact.join(Lacerda::SCOPE_SEPARATOR)
11
31
  )
@@ -1,7 +1,11 @@
1
- require 'lacerda/contract'
1
+ require 'lacerda/specification'
2
2
 
3
3
  module Lacerda
4
- class PublishContract < Lacerda::Contract
4
+ class PublishSpecification < Lacerda::Specification
5
+
6
+ def initialize(service, schema_or_file)
7
+ super
8
+ end
5
9
 
6
10
  def errors
7
11
  return [] unless @comparator
@@ -85,8 +85,8 @@ module Lacerda
85
85
  private
86
86
 
87
87
  def load_contracts
88
- @publish = Lacerda::PublishContract.new(self, File.join(@data_dir, "publish.schema.json"))
89
- @consume = Lacerda::ConsumeContract.new(self, File.join(@data_dir, "consume.schema.json"))
88
+ @publish = Lacerda::PublishSpecification.new(self, File.join(@data_dir, "publish.schema.json"))
89
+ @consume = Lacerda::ConsumeSpecification.new(self, File.join(@data_dir, "consume.schema.json"))
90
90
  end
91
91
  end
92
92
  end
@@ -3,7 +3,7 @@ require 'lacerda/published_object'
3
3
  require 'lacerda/consumed_object'
4
4
 
5
5
  module Lacerda
6
- class Contract
6
+ class Specification
7
7
  attr_reader :service, :schema
8
8
 
9
9
  def initialize(service, schema_or_file)
@@ -1,3 +1,3 @@
1
1
  module Lacerda
2
- VERSION = '0.10.2'
2
+ VERSION = '0.11.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lacerda
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.2
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jannis Hermanns
@@ -213,16 +213,15 @@ files:
213
213
  - lacerda.gemspec
214
214
  - lib/lacerda.rb
215
215
  - lib/lacerda/compare/json_schema.rb
216
- - lib/lacerda/consume_contract.rb
216
+ - lib/lacerda/consume_specification.rb
217
217
  - lib/lacerda/consumed_object.rb
218
- - lib/lacerda/contract.rb
219
218
  - lib/lacerda/conversion.rb
220
219
  - lib/lacerda/conversion/apiary_to_json_schema.rb
221
220
  - lib/lacerda/conversion/data_structure.rb
222
221
  - lib/lacerda/conversion/error.rb
223
222
  - lib/lacerda/infrastructure.rb
224
223
  - lib/lacerda/object_description.rb
225
- - lib/lacerda/publish_contract.rb
224
+ - lib/lacerda/publish_specification.rb
226
225
  - lib/lacerda/published_object.rb
227
226
  - lib/lacerda/reporter.rb
228
227
  - lib/lacerda/reporters/multi.rb
@@ -231,6 +230,7 @@ files:
231
230
  - lib/lacerda/rspec_integration.rb
232
231
  - lib/lacerda/service.rb
233
232
  - lib/lacerda/service/error.rb
233
+ - lib/lacerda/specification.rb
234
234
  - lib/lacerda/tasks.rb
235
235
  - lib/lacerda/version.rb
236
236
  homepage: https://github.com/moviepilot/lacerda