zeta 0.6.0 → 0.7.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 33dba0f87028556b8a40c997928f7ce62cce45c5
4
- data.tar.gz: 2bb3a4a2d42cf896dece1440843da8639269a329
3
+ metadata.gz: 08d5fed9062a49f2b57a91870f9dbf9dd2dbd8b8
4
+ data.tar.gz: 997e37353292f45a5dd1d181f60ed1c3822c049c
5
5
  SHA512:
6
- metadata.gz: 61878194f934accfad3689ff54aa20a67d909a057b9eb269eebe7b031007c2f781e15218cfc58fee99876fd2d553dc7e0b248eae30e3b5fd29e43092eda805b6
7
- data.tar.gz: 88fc2e2f54523dbf7290b4111eec5e7de128d24f6c5f4314f87df67a753eff6ac3e279d8da616334b2f67376061e0bd60cb58a77eacbf9a5a591d9a12e9affe8
6
+ metadata.gz: 33cc3885df8146f28d3c3a12706c0ce9a1c2878968bcb92fba7882a04cb5a3d315d899f56dc2339d2f13c8677d8fd44603c955f077397495808e5ecba67d87d9
7
+ data.tar.gz: b1d8f24c554461b40d335ed5c398c55d1174d99f7f9af61870aaf67eb660d9579d7135e45d97027f7a067a327e7b1c7e3d767b85c44fb98cabc13de5c8c57fa0
data/CHANGELOG.markdown CHANGED
@@ -1,3 +1,17 @@
1
+ # 0.7.0
2
+ - update Lacerda to ~> 0.12
3
+ - add Zeta.convert_all! convenience method
4
+
5
+ # 0.6.0 (06-Nov-15)
6
+ - update Lacerda
7
+
8
+ # 0.6.2 (04-Nov-15)
9
+ - update Lacerda
10
+ - add --trace option so we don't bother people with exception traces all the time
11
+
12
+ # 0.6.1 (03-Nov-15)
13
+ - make rspec integration a little more convenient
14
+
1
15
  # 0.6.0 (03-Nov-15)
2
16
  - make reporter configurable for contracts_fulfilled?
3
17
  - add rspec integration
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Zeta [![Circle CI](https://circleci.com/gh/moviepilot/zeta.svg?style=svg)](https://circleci.com/gh/moviepilot/zeta) [![Coverage Status](https://coveralls.io/repos/moviepilot/zeta/badge.svg?branch=master&service=github)](https://coveralls.io/github/moviepilot/zeta?branch=master) [![Code Climate](https://codeclimate.com/github/moviepilot/zeta/badges/gpa.svg)](https://codeclimate.com/github/moviepilot/zeta) [![Dependency Status](https://gemnasium.com/moviepilot/zeta.svg)](https://gemnasium.com/moviepilot/zeta)
1
+ # Zeta [![Circle CI](https://circleci.com/gh/moviepilot/zeta.svg?style=shield)](https://circleci.com/gh/moviepilot/zeta) [![Coverage Status](https://coveralls.io/repos/moviepilot/zeta/badge.svg?branch=master&service=github)](https://coveralls.io/github/moviepilot/zeta?branch=master) [![Code Climate](https://codeclimate.com/github/moviepilot/zeta/badges/gpa.svg)](https://codeclimate.com/github/moviepilot/zeta) [![Dependency Status](https://gemnasium.com/moviepilot/zeta.svg)](https://gemnasium.com/moviepilot/zeta) [![Gem Version](https://badge.fury.io/rb/zeta.svg)](https://badge.fury.io/rb/zeta)
2
2
 
3
3
  ![](https://dl.dropboxusercontent.com/u/1953503/zeta.jpg)
4
4
 
@@ -48,9 +48,6 @@ These are simple markdown files in the wonderful [MSON](https://github.com/apiar
48
48
  ### A publish specification:
49
49
  `contracts/publish.mson`:
50
50
  ```shell
51
- # Data Structures
52
- This file defines what MessageService may publish.
53
-
54
51
  # Message
55
52
  - id: (number, required)
56
53
  - sender_id: (number, required)
@@ -64,9 +61,6 @@ So far so good. This way *MessageService* can tell the world what exactly it mea
64
61
  ### A consume specification:
65
62
  `contracts/consume.mson`:
66
63
  ```shell
67
- # Data Structures
68
- We just consume one object type, and it comes from the MessageService. Check it out!
69
-
70
64
  # MessageService::Message
71
65
  - sender_id: (number, required)
72
66
  - recipient_id: (number, required)
@@ -162,7 +156,7 @@ Whenever you add a service to the infrastructure, you just add it to this centra
162
156
 
163
157
  ### 3. Authentication
164
158
 
165
- If your infrastruture configuration file is HTTP Basic auth protected, or in a private repository on github (that would be a good idea), make sure you `export HTTP_USER=username` and `HTTP_PASSWORD=secret` and *Zeta* will use that. If you host on github, the use your username and generate an API token to use as the password.
159
+ If your infrastruture configuration file is HTTP Basic auth protected, or in a private repository on github (that would be a good idea), make sure you `export HTTP_USER=username` and `HTTP_PASSWORD=secret` and *Zeta* will use that. If you host on github, then use your github username as `HTTP_USER` and generate an API token to use as the `HTTP_PASSWORD`.
166
160
 
167
161
  ### 4. Usage: Without ruby (CLI)
168
162
 
@@ -175,6 +169,7 @@ Specific options:
175
169
  -c, --config=CONFIG_FILE Config file (default: config/zeta.yml)
176
170
  -e, --env=ENVIRONMENT Environment (default: RAILS_ENV, if it is set)
177
171
  -s, --silent No output, just an appropriate return code
172
+ -t, --trace Print exception stack traces
178
173
 
179
174
  Common options:
180
175
  -h, --help Show this message
@@ -220,11 +215,12 @@ If you use *Zeta* in ruby, it will automatically know the current service, i.e.
220
215
  ```ruby
221
216
  [1] pry(main)> ls Zeta
222
217
  Zeta.methods:
223
- cache_dir current_service update_own_contracts
224
- config env validate_object_to_consume
225
- config_file errors validate_object_to_consume!
226
- consume_object infrastructure validate_object_to_publish
227
- contracts_fulfilled? update_contracts validate_object_to_publish!
218
+ cache_dir current_service validate_object_to_consume
219
+ clear_cache env validate_object_to_consume!
220
+ config errors validate_object_to_publish
221
+ config_file infrastructure validate_object_to_publish!
222
+ consume_object update_contracts verbose=
223
+ contracts_fulfilled? update_own_contracts
228
224
  [2] pry(main)>
229
225
  ```
230
226
 
@@ -234,3 +230,17 @@ Each and every one of these goes directly to your instance `Lacerda::Infrastruct
234
230
  - `Zeta.consume_object('MessageService::Message', received_data)` will give you an instance of the [Blumquist](https://github.com/moviepilot/blumquist#readme) class, which is an obect that has getters for all properties you specified in `consume.mson`
235
231
 
236
232
  If you use these in your servies, they will help keeping the publish and consume specifications in sync with what's actually happening in the code.
233
+
234
+ ### RSpec integration
235
+
236
+ Of course you'll want to have your infrastructure checked in CI. If you're using RSpec, we've got you covered. Just place the following lines in, for example, `spec/zeta_spec.rb`:
237
+
238
+ ```ruby
239
+ require_relative 'spec_helper'
240
+
241
+ require 'zeta/rspec'
242
+ Zeta::RSpec.update_contracts
243
+ Zeta::RSpec.run
244
+ ```
245
+
246
+ This will do the same as a `zeta -e test full_check` would do on the command line, but reporting to RSpec instead of printing its output directly. Whether or not you run `Zeta::RSpec.update_contracts` is up to you - perhaps you have HTTP requests disabled in your test suite, or you don't want to be network dependant for every run. If you remove it, however, make sure you run `zeta -e test fetch_remote_contracts` often enough to not be outdated.
data/lib/zeta/instance.rb CHANGED
@@ -27,6 +27,13 @@ class Zeta
27
27
  true
28
28
  end
29
29
 
30
+ def convert_all!
31
+ i = infrastructure
32
+ @mutex.synchronize do
33
+ i.convert_all!
34
+ end
35
+ end
36
+
30
37
  def update_own_contracts
31
38
  contract_files.each do |file|
32
39
  source_file = File.join(config[:contracts_path], file)
data/lib/zeta/rspec.rb CHANGED
@@ -1,24 +1,35 @@
1
1
  require 'lacerda/reporters/rspec'
2
+ require 'zeta'
2
3
 
3
4
  # Include this file in your spec/spec_helper.rb
4
- class Zeta
5
- def self.run_specs
5
+ class Zeta::RSpec
6
+ def self.ensure_contracts_present(force = false)
6
7
  Zeta.verbose = false
7
- unless File.directory?(Zeta.cache_dir)
8
- RSpec.describe "Update Zeta infrastructure once" do
9
- it "download infrastructure" do
10
- expect{
11
- Zeta.config
12
- }.to_not raise_error
13
- end
8
+ if force || !File.directory?(Zeta.cache_dir)
9
+ update_contracts
10
+ end
11
+ end
12
+
13
+ def self.update_contracts
14
+ RSpec.describe "Update Zeta infrastructure once" do
15
+ it "download infrastructure" do
16
+ expect{
17
+ Zeta.config
18
+ }.to_not raise_error
19
+ end
14
20
 
15
- it "download specifications" do
16
- expect{
17
- Zeta.update_contracts
18
- }.to_not raise_error
19
- end
21
+ it "download specifications" do
22
+ expect{
23
+ Zeta.update_contracts
24
+ }.to_not raise_error
20
25
  end
21
26
  end
27
+ end
28
+
29
+ def self.run
30
+ Zeta.verbose = false
31
+ ensure_contracts_present
32
+ Zeta.update_own_contracts
22
33
  Zeta.contracts_fulfilled?(Lacerda::Reporters::RSpec.new)
23
34
  end
24
35
  end
data/lib/zeta/runner.rb CHANGED
@@ -40,6 +40,10 @@ class Zeta::Runner
40
40
  options[:silent] = s
41
41
  end
42
42
 
43
+ opts.on("-t", "--trace", "Print exception stack traces") do |t|
44
+ options[:trace] = t
45
+ end
46
+
43
47
  opts.separator ""
44
48
  opts.separator "Common options:".yellow
45
49
 
@@ -85,7 +89,7 @@ class Zeta::Runner
85
89
  end
86
90
  end
87
91
  rescue => e
88
- if options[:verbose]
92
+ if options[:trace]
89
93
  raise
90
94
  else
91
95
  puts "ERROR: ".red + e.message
data/lib/zeta/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  class Zeta
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
data/zeta.gemspec CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_runtime_dependency 'rake', '~> 10.2'
22
- spec.add_runtime_dependency 'lacerda', '~> 0.9'
22
+ spec.add_runtime_dependency 'lacerda', '~> 0.12'
23
23
  spec.add_runtime_dependency 'activesupport'
24
24
  spec.add_runtime_dependency 'httparty', '~> 0.13'
25
25
  spec.add_runtime_dependency 'colorize'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zeta
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
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-11-03 00:00:00.000000000 Z
11
+ date: 2015-11-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.9'
33
+ version: '0.12'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.9'
40
+ version: '0.12'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement