zeta 0.4.0 → 0.5.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 +4 -4
- data/CHANGELOG.markdown +4 -0
- data/README.md +8 -8
- data/lib/zeta.rb +2 -1
- data/lib/zeta/instance.rb +2 -1
- data/lib/zeta/runner.rb +0 -3
- data/lib/zeta/version.rb +1 -1
- data/zeta.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 688a5287b3424e9c923bbd1f9e118ae6b61c9546
|
4
|
+
data.tar.gz: c9e220790340b1abd33bd3fd1fa913bc9e9eef46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ce397967dbcee851e5b438d88e360de94f5718adbb34b11efe8dac2c6fe98ade363a8751642cdf32ae3cbd2cdf86287171b712af45bb44ce4857877e0d9a49f0
|
7
|
+
data.tar.gz: ae3cbf5c2e485478ddb9c591ee223a36dd7cda9b291c8d9d7e179002f68897595af98fa2fa6a1bb1899a41a9ab1b983ae7b18ac09bf6afdf2731dcfa2679ebf5
|
data/CHANGELOG.markdown
CHANGED
data/README.md
CHANGED
@@ -46,7 +46,7 @@ Each service has to contain two files in order for *Zeta* to do its job:
|
|
46
46
|
These are simple markdown files in the wonderful [MSON](https://github.com/apiaryio/mson) format. Let's look at the contracts dir of **MessageService**, shall we?
|
47
47
|
|
48
48
|
### A publish specification:
|
49
|
-
`contracts/publish.mson
|
49
|
+
`contracts/publish.mson`:
|
50
50
|
```shell
|
51
51
|
# Data Structures
|
52
52
|
This file defines what MessageService may publish.
|
@@ -62,7 +62,7 @@ This file defines what MessageService may publish.
|
|
62
62
|
So far so good. This way *MessageService* can tell the world what exactly it means when a `Message` object is published. Much the same, the *NotificationService* could define which properties of a `Message` object from the `MessageService` it is actually interested in:
|
63
63
|
|
64
64
|
### A consume specification:
|
65
|
-
`contracts/consume.mson
|
65
|
+
`contracts/consume.mson`:
|
66
66
|
```shell
|
67
67
|
# Data Structures
|
68
68
|
We just consume one object type, and it comes from the MessageService. Check it out!
|
@@ -75,7 +75,7 @@ We just consume one object type, and it comes from the MessageService. Check it
|
|
75
75
|
As you can see, this consumer expects the `recipient_id` property to be present when a `Message` object is received from `MessageService`. While a publish specification just defines objects, a consume specification prefixes the names of objects it consumes with the name of the service publishing the object. As in our example above:
|
76
76
|
|
77
77
|
```
|
78
|
-
# MessageService
|
78
|
+
# MessageService::Message
|
79
79
|
| `---------- object name
|
80
80
|
`------------------------- service name
|
81
81
|
|
@@ -139,7 +139,7 @@ You typically just create the above file once in each project and then don't tou
|
|
139
139
|
|
140
140
|
Here's how the infrastructure configuration file might look for our example above:
|
141
141
|
|
142
|
-
`git@github.com:jensmander/zeta-config/infrastructure/master.yml
|
142
|
+
`git@github.com:jensmander/zeta-config/infrastructure/master.yml`:
|
143
143
|
```yaml
|
144
144
|
MessageService:
|
145
145
|
github:
|
@@ -164,7 +164,7 @@ Whenever you add a service to the infrastructure, you just add it to this centra
|
|
164
164
|
|
165
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.
|
166
166
|
|
167
|
-
### 4. Usage:
|
167
|
+
### 4. Usage: Without ruby (CLI)
|
168
168
|
|
169
169
|
Zeta comes with a `zeta` command that takes care of all the things:
|
170
170
|
|
@@ -213,9 +213,9 @@ $ zeta -e development update_own_contracts validate
|
|
213
213
|
|
214
214
|
Otherwise it will exit with an error and display any contract violations in JSON.
|
215
215
|
|
216
|
-
### 5. Usage:
|
216
|
+
### 5. Usage: With ruby
|
217
217
|
|
218
|
-
If you use *Zeta* in ruby, it will automatically know the current service, i.e. the one that it's running in. It will create a singleton `Lacerda::Infrastructure` instance from the [Lacerda gem](https://github.com/moviepilot/
|
218
|
+
If you use *Zeta* in ruby, it will automatically know the current service, i.e. the one that it's running in. It will create a singleton `Lacerda::Infrastructure` instance from the [Lacerda gem](https://github.com/moviepilot/lacerda#readme), which gives you access to a bunch of interesting functions. If you're using [pry](https://github.com/pry/pry#readme), go ahead and do a quick `ls Zeta` and you will something like this, likely outdated, list:
|
219
219
|
|
220
220
|
```ruby
|
221
221
|
[1] pry(main)> ls Zeta
|
@@ -231,6 +231,6 @@ Zeta.methods:
|
|
231
231
|
Each and every one of these goes directly to your instance `Lacerda::Infrastructure`, as defined by `config/zeta.yml`. Feel free to explore them a bit, but the ones' that might be of most interest are:
|
232
232
|
|
233
233
|
- `Zeta.validate_object_to_publish('Post', data_to_send)` makes sure that the content in `data_to_send` conforms to your 'Post' specification in your local `publish.mson`
|
234
|
-
- `Zeta.consume_object('MessageService::Message', received_data)` will give you an instance of the [Blumquist](https://github.com/moviepilot/blumquist) class, which is an obect that has getters for all properties you specified in `consume.mson`
|
234
|
+
- `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
235
|
|
236
236
|
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.
|
data/lib/zeta.rb
CHANGED
@@ -9,7 +9,8 @@ class Zeta
|
|
9
9
|
# Not using the SingleForwardable module here so that, when
|
10
10
|
# somebody tries to figure out how Zeta works by looking at
|
11
11
|
# its methods, they don't get confused.
|
12
|
-
Zeta::Instance.instance_methods
|
12
|
+
methods = Zeta::Instance.instance_methods - Object.instance_methods
|
13
|
+
methods.each do |method|
|
13
14
|
define_singleton_method method do |*args|
|
14
15
|
send_args = [method, args].flatten.compact
|
15
16
|
MUTEX.synchronize do
|
data/lib/zeta/instance.rb
CHANGED
data/lib/zeta/runner.rb
CHANGED
@@ -81,11 +81,8 @@ class Zeta::Runner
|
|
81
81
|
puts "Validating your infrastructure with #{zeta.infrastructure.publishers.length} publishers and #{zeta.infrastructure.consumers.length} consumers..." if options[:verbose]
|
82
82
|
zeta.contracts_fulfilled?
|
83
83
|
unless zeta.errors.empty?
|
84
|
-
puts JSON.pretty_generate(zeta.errors)
|
85
|
-
puts "#{zeta.errors.length} contract violations".red
|
86
84
|
exit(-1)
|
87
85
|
end
|
88
|
-
puts "All contracts valid 🙌".green if options[:verbose]
|
89
86
|
end
|
90
87
|
rescue => e
|
91
88
|
if options[:verbose]
|
data/lib/zeta/version.rb
CHANGED
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.
|
22
|
+
spec.add_runtime_dependency 'lacerda', '~> 0.8'
|
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.
|
4
|
+
version: 0.5.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
|
+
date: 2015-11-02 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.
|
33
|
+
version: '0.8'
|
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.
|
40
|
+
version: '0.8'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|