zeta 0.2.2 → 0.2.5
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 +7 -0
- data/README.md +13 -14
- data/Rakefile +1 -1
- data/lib/zeta/instance.rb +3 -3
- data/lib/zeta/runner.rb +22 -6
- data/lib/zeta/version.rb +1 -1
- data/lib/zeta.rb +1 -1
- data/zeta.gemspec +2 -2
- metadata +9 -14
- data/contracts/cache/service_1/consume.mson +0 -1
- data/contracts/cache/service_1/publish.mson +0 -1
- data/contracts/cache/service_2/consume.mson +0 -1
- data/contracts/cache/service_2/publish.mson +0 -1
- data/todo.txt +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 332c4c04e173a5ca9b3e1735e865c0b396791076
|
4
|
+
data.tar.gz: 2e55416065c24e91fa7317a65da8f98d4025353b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2fa4f37b8b19938103f9cf33233475684b756eb8b3d72a2d53a97b95ea1a2114c0dbe0ad5f8dad4808c25ce77a829c4f89172265757fd04d4b3e512de3681d9c
|
7
|
+
data.tar.gz: 2b25dd75a9bf73dfc5e87129ae5b5560428cdc4967218f34bdfc2e33d56eeae686fd059aa82885827de543a11bedc805975b03510345efe8c3d9d2c0abce7499
|
data/CHANGELOG.markdown
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
[](https://circleci.com/gh/moviepilot/zeta) [](https://coveralls.io/github/moviepilot/zeta?branch=master) [](https://codeclimate.com/github/moviepilot/zeta)
|
1
|
+
# Zeta [](https://circleci.com/gh/moviepilot/zeta) [](https://coveralls.io/github/moviepilot/zeta?branch=master) [](https://codeclimate.com/github/moviepilot/zeta) [](https://gemnasium.com/moviepilot/zeta)
|
2
2
|
|
3
3
|

|
4
4
|
|
5
|
-
# Old Maid
|
6
5
|
|
7
6
|
```
|
8
7
|
TLDR:
|
@@ -10,14 +9,14 @@ TLDR:
|
|
10
9
|
- these contracts are formatted in human readable markdown
|
11
10
|
- you never have to know/care about other services or repositories
|
12
11
|
|
13
|
-
|
12
|
+
Zeta will:
|
14
13
|
- know the rest of your infrastructure and fetches the contracts of all other services
|
15
14
|
- alert you if your change in service X breaks service Y
|
16
15
|
```
|
17
16
|
|
18
|
-
In an infrastructure where many services are talking with each other, it's sometimes hard to know **how changes in one service affect other services**, as each
|
17
|
+
In an infrastructure where many services are talking with each other, it's sometimes hard to know **how changes in one service affect other services**, as each service often just knows about itself. Even if local tests pass, you can't know what other services might be affected when you make changes to a service.
|
19
18
|
|
20
|
-
*
|
19
|
+
*Zeta* tackles this problem by allowing each service to define which objects it consumes, and which objects it publishes - in simple Markdown (specifically [MSON](https://github.com/apiaryio/mson)).It doesn't matter if these objected are transported via a HTTP, a message broker like RabbitMQ or any other mean.
|
21
20
|
|
22
21
|
|
23
22
|
## Walk this way
|
@@ -39,7 +38,7 @@ Wouldn't it be nice of some test local to the **MessageService** repository to t
|
|
39
38
|
|
40
39
|
## Yes, it would!
|
41
40
|
|
42
|
-
Each
|
41
|
+
Each service has to contain two files in order for *Zeta* to do its job:
|
43
42
|
|
44
43
|
1. `contracts/publish.mson`
|
45
44
|
2. `contracts/consume.mson`
|
@@ -85,7 +84,7 @@ As you can see, this consumer expects the `recipient_id` property to be present
|
|
85
84
|
## Getting started
|
86
85
|
|
87
86
|
### 1. Installation
|
88
|
-
First, add *
|
87
|
+
First, add *Zeta* to your `Gemfile` or install manually:
|
89
88
|
|
90
89
|
```shell
|
91
90
|
$ gem install zeta
|
@@ -93,7 +92,7 @@ $ gem install zeta
|
|
93
92
|
|
94
93
|
### 2. Configuration
|
95
94
|
|
96
|
-
If you're using ruby on rails, *
|
95
|
+
If you're using ruby on rails, *Zeta* will automatically know your
|
97
96
|
environment and look for its configuration in `config/zeta.yml`, which could look like this:
|
98
97
|
|
99
98
|
```yaml
|
@@ -105,15 +104,15 @@ common: &common
|
|
105
104
|
# Which directory contains the publish.mson and consume.mson
|
106
105
|
contracts_path: contracts
|
107
106
|
|
108
|
-
# Where to cache the contracts from all other
|
109
|
-
# infrastructure.
|
107
|
+
# Where to cache the contracts from all other services that are part of the
|
108
|
+
# infrastructure. Zeta will fetch these for you.
|
110
109
|
contracts_cache_path: contracts/.cache
|
111
110
|
|
112
111
|
|
113
112
|
development:
|
114
113
|
<<: *common
|
115
114
|
# The services file contains all services that are part of your infrastructure
|
116
|
-
# and tested with
|
115
|
+
# and tested with Zeta. It's just another yaml file, but the nice thing is
|
117
116
|
# that it's outside of the service's repository and has to be maintained only
|
118
117
|
# in one place.
|
119
118
|
services_file:
|
@@ -136,7 +135,7 @@ production:
|
|
136
135
|
|
137
136
|
```
|
138
137
|
|
139
|
-
You typically just create the above file once and then don't touch it anymore. If that file is in a private repository (that would be a good idea), make sure you `export
|
138
|
+
You typically just create the above file once and then don't touch it anymore. If that file is in a private repository (that would be a good idea), make sure you `export GITHUB_USER=youruser` and `GITHUB_TOKEN=yourtoken` and *Zeta* will use that.
|
140
139
|
|
141
140
|
Here's how `github.com/jensmander/zeta-config/infrastructure/master.yml` might look in our example above:
|
142
141
|
|
@@ -176,7 +175,7 @@ Common options:
|
|
176
175
|
-v, --version Show version
|
177
176
|
```
|
178
177
|
|
179
|
-
Example time. You can tell *
|
178
|
+
Example time. You can tell *Zeta* to validate the whole infrastructure like this:
|
180
179
|
|
181
180
|
```shell
|
182
181
|
$ zeta -e development full_check
|
@@ -185,7 +184,7 @@ $ zeta -e development full_check
|
|
185
184
|
The above command performs the following three steps:
|
186
185
|
|
187
186
|
1. Fetch all contracts from remote repositories and put them into the cache directory configured above
|
188
|
-
2. Copy the current
|
187
|
+
2. Copy the current services contracts (that you might have changed) into the cache directory
|
189
188
|
3. Validate all contracts (i.e. make sure that every publishing service satisfies its consumers)
|
190
189
|
|
191
190
|
The above commands can also be run in isolation:
|
data/Rakefile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
1
|
require "bundler/gem_tasks"
|
2
|
-
require "
|
2
|
+
require "lacerda/tasks"
|
data/lib/zeta/instance.rb
CHANGED
@@ -2,7 +2,7 @@ require 'active_support/core_ext/hash/indifferent_access'
|
|
2
2
|
require 'yaml'
|
3
3
|
require 'fileutils'
|
4
4
|
require 'tmpdir'
|
5
|
-
require '
|
5
|
+
require 'lacerda'
|
6
6
|
|
7
7
|
require 'zeta/local_or_remote_file'
|
8
8
|
|
@@ -48,7 +48,7 @@ class Zeta
|
|
48
48
|
def infrastructure
|
49
49
|
@mutex.synchronize do
|
50
50
|
return @infrastructure if @infrastructure
|
51
|
-
@infrastructure =
|
51
|
+
@infrastructure = Lacerda::Infrastructure.new(data_dir: cache_dir, verbose: verbose?)
|
52
52
|
@infrastructure
|
53
53
|
end
|
54
54
|
end
|
@@ -131,7 +131,7 @@ class Zeta
|
|
131
131
|
if config[:services]
|
132
132
|
return config[:services]
|
133
133
|
elsif config[:services_file]
|
134
|
-
file = LocalOrRemoteFile.new(config[:services_file].merge(
|
134
|
+
file = LocalOrRemoteFile.new(config[:services_file].merge(verbose: verbose?))
|
135
135
|
services = YAML.load(file.read)
|
136
136
|
begin
|
137
137
|
services.with_indifferent_access
|
data/lib/zeta/runner.rb
CHANGED
@@ -2,15 +2,31 @@
|
|
2
2
|
require 'optparse'
|
3
3
|
|
4
4
|
class Zeta::Runner
|
5
|
-
COMMANDS =
|
5
|
+
COMMANDS = {
|
6
|
+
'full_check' => 'Update contracts and validate infrastructure',
|
7
|
+
'validate' => 'Validate the architecture in the contracts cache dir',
|
8
|
+
'update_own_contracts' => 'Update your own contracts in the contracts cache dir',
|
9
|
+
'fetch_remote_contracts' => 'Download remote contracts and update your own contracts in the contracts cache dir'
|
10
|
+
}
|
6
11
|
|
7
12
|
def self.run
|
8
13
|
options = {}
|
9
14
|
parser = OptionParser.new do |opts|
|
10
|
-
opts.banner = "Usage: zeta [options]
|
15
|
+
opts.banner = "#{'Usage:'.red} zeta [options] command"
|
11
16
|
|
12
17
|
opts.separator ""
|
13
|
-
opts.separator "
|
18
|
+
opts.separator "Commands:".yellow
|
19
|
+
|
20
|
+
longest_command = COMMANDS.keys.map(&:length).sort.last + 1
|
21
|
+
command_list = []
|
22
|
+
COMMANDS.each do |cmd, desc|
|
23
|
+
padded_cmd = "#{cmd}:".ljust(longest_command, " ")
|
24
|
+
command_list << " #{padded_cmd} #{desc}"
|
25
|
+
end
|
26
|
+
opts.separator command_list
|
27
|
+
|
28
|
+
opts.separator ""
|
29
|
+
opts.separator "Specific options:".yellow
|
14
30
|
|
15
31
|
opts.on("-c CONFIG_FILE", "--config=CONFIG_FILE", "Config file (default: config/zeta.yml)") do |c|
|
16
32
|
options[:config_file] = c
|
@@ -25,7 +41,7 @@ class Zeta::Runner
|
|
25
41
|
end
|
26
42
|
|
27
43
|
opts.separator ""
|
28
|
-
opts.separator "Common options:"
|
44
|
+
opts.separator "Common options:".yellow
|
29
45
|
|
30
46
|
opts.on_tail("-h", "--help", "Show this message") do
|
31
47
|
puts opts
|
@@ -41,7 +57,7 @@ class Zeta::Runner
|
|
41
57
|
parser.parse!
|
42
58
|
|
43
59
|
commands = ARGV
|
44
|
-
if commands.empty? or !(commands-COMMANDS).empty?
|
60
|
+
if commands.empty? or !(commands-COMMANDS.keys).empty?
|
45
61
|
puts parser
|
46
62
|
exit(-1)
|
47
63
|
end
|
@@ -66,7 +82,7 @@ class Zeta::Runner
|
|
66
82
|
zeta.contracts_fulfilled?
|
67
83
|
unless zeta.errors.empty?
|
68
84
|
puts JSON.pretty_generate(zeta.errors)
|
69
|
-
puts "#{zeta.errors.length}
|
85
|
+
puts "#{zeta.errors.length} contract violations".red
|
70
86
|
exit(-1)
|
71
87
|
end
|
72
88
|
puts "All contracts valid 🙌".green if options[:verbose]
|
data/lib/zeta/version.rb
CHANGED
data/lib/zeta.rb
CHANGED
data/zeta.gemspec
CHANGED
@@ -19,8 +19,8 @@ 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 '
|
23
|
-
spec.add_runtime_dependency 'activesupport'
|
22
|
+
spec.add_runtime_dependency 'lacerda', '~> 0.3.2'
|
23
|
+
spec.add_runtime_dependency 'activesupport'
|
24
24
|
spec.add_runtime_dependency 'httparty', '~> 0.13'
|
25
25
|
spec.add_runtime_dependency 'colorize'
|
26
26
|
spec.add_runtime_dependency 'webmock'
|
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.2.
|
4
|
+
version: 0.2.5
|
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-
|
11
|
+
date: 2015-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -25,33 +25,33 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '10.2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: lacerda
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.3.2
|
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:
|
40
|
+
version: 0.3.2
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activesupport
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
47
|
+
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: httparty
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -168,16 +168,11 @@ files:
|
|
168
168
|
- Rakefile
|
169
169
|
- bin/zeta
|
170
170
|
- circle.yml
|
171
|
-
- contracts/cache/service_1/consume.mson
|
172
|
-
- contracts/cache/service_1/publish.mson
|
173
|
-
- contracts/cache/service_2/consume.mson
|
174
|
-
- contracts/cache/service_2/publish.mson
|
175
171
|
- lib/zeta.rb
|
176
172
|
- lib/zeta/instance.rb
|
177
173
|
- lib/zeta/local_or_remote_file.rb
|
178
174
|
- lib/zeta/runner.rb
|
179
175
|
- lib/zeta/version.rb
|
180
|
-
- todo.txt
|
181
176
|
- zeta.gemspec
|
182
177
|
homepage: https://github.com/moviepilot/zeta
|
183
178
|
licenses: []
|
@@ -1 +0,0 @@
|
|
1
|
-
Some MSON
|
@@ -1 +0,0 @@
|
|
1
|
-
Some MSON
|
@@ -1 +0,0 @@
|
|
1
|
-
Some MSON
|
@@ -1 +0,0 @@
|
|
1
|
-
Some MSON
|
data/todo.txt
DELETED