old-maid 0.1.0 → 0.2.1

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: ed6b6a7595c3aa411fdedaf288d321679f6d6da3
4
- data.tar.gz: c306bb9b594a81ed20936bd877d333c92c3d6165
3
+ metadata.gz: 6ef3f21c07651c53c6a6d4fcb87715b9020fc8c1
4
+ data.tar.gz: ccc7998fe646024552f8a129569a2f476bd4384b
5
5
  SHA512:
6
- metadata.gz: bd329a694dec5688f6839b4d0d3907a2eb7a97da950a4311ba7b579e5417337043ff55155c5b937420a493bba18cdac7d0af0cf95d6d7f51183cada2b3324e68
7
- data.tar.gz: 36ea6465c7bf2498a30278cdfbd09e26f7f21d64c12c54083dccc4f78ee112c7debbb18c23eae78a83145c7d8ddf09c35343a094c49f8b7f949494ca6937c3a9
6
+ metadata.gz: 01617337f3dd092a3286b13b7f15babc66b0cbc93792e71c92870f5e9ecc66258b52d128c8bc7936fec61df2d391bf1a234563548ccce761902c1bebfb57d2ca
7
+ data.tar.gz: 99d74e6a57f959c359e830243361a2936547c62eb5cd66704b2856a627362b4e9c1bea68b7087312348dc1caa7589ccc0223cdb32d5a5a64dbab849951c7c98a
@@ -0,0 +1,2 @@
1
+ # 0.1.2 (20-Oct-15)
2
+ - add `old-maid` runner
data/Guardfile CHANGED
@@ -3,8 +3,8 @@ guard :bundler do
3
3
  watch(/^.+\.gemspec/)
4
4
  end
5
5
 
6
- guard :rspec, cmd: 'rspec', all_on_start: true do
7
- watch(%r{^spec/.+$}) { "spec" }
6
+ guard :rspec, cmd: 'TEST=1 rspec', all_on_start: true do
7
+ watch(%r{^spec/.+\.rb$}) { "spec" }
8
8
  watch(%r{^lib/(.+)\.rb$}) { "spec" }
9
9
  watch('spec/spec_helper.rb') { "spec" }
10
10
  end
data/README.md CHANGED
@@ -1,39 +1,208 @@
1
- # OldMaid
1
+ ![](https://dl.dropboxusercontent.com/u/1953503/old-maid.jpg)
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/old_maid`. To experiment with that code, run `bin/console` for an interactive prompt.
3
+ [![Circle CI](https://circleci.com/gh/moviepilot/old-maid.svg?style=svg)](https://circleci.com/gh/moviepilot/old-maid) [![Coverage Status](https://coveralls.io/repos/moviepilot/old-maid/badge.svg?branch=master&service=github)](https://coveralls.io/github/moviepilot/old-maid?branch=master) [![Code Climate](https://codeclimate.com/github/moviepilot/old-maid/badges/gpa.svg)](https://codeclimate.com/github/moviepilot/old-maid)
4
+ # Old Maid
4
5
 
5
- TODO: Delete this and the text above, and describe your gem
6
+ ```
7
+ TLDR:
8
+ - each service defines which objects it publishes or consumes
9
+ - these contracts are formatted in human readable markdown
10
+ - you never have to know/care about other services or repositories
11
+
12
+ Old Maid will:
13
+ - know the rest of your infrastructure and fetches the contracts of all other services
14
+ - alert you if your change in service X breaks service Y
15
+ ```
16
+
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 project 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.
18
+
19
+ *Old Maid* 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.
20
+
21
+
22
+ ## Walk this way
23
+
24
+ Let's imagine an imaginary chat app that is split up into three independent services that communicate via a message broker:
25
+
26
+ - **MessageService** keeps track of the state of to do items
27
+ - **SearchService** makes your chat history searchable
28
+ - **NotificationService**: sends an email when a private message is received
29
+
30
+ Each time a message is sent, MessageService publishes the full message to the message broker. While the SearchService is likely interested in the full message with all of its properties to index it probably, the NotificationService might just care about the sender and the receiver of the message, discarding all other properties.
31
+
32
+ An intern is asked to implement a feature that allows one message to be sent to multiple people at the same time. They go ahead and just change the numerical `recepient_id` property of a message to an `recipient_ids` array. They run their tests and all looks good.
33
+
34
+ 😱But **THE INTERN JUST BROKE THE NOTIFICATION SERVICE** because it depends on the `recipient_id` property 😱
35
+
36
+ Wouldn't it be nice of some test local to the **MessageService** repository to tell the poorintern that removing the `recipient_id` property breaks the expectations other services have of the *MessageService* BEFORE they deploy?
37
+
38
+
39
+ ## Yes, it would!
40
+
41
+ Each project have to contain two files in order for *Old Maid* to do its job:
42
+
43
+ 1. `contracts/publish.mson`
44
+ 2. `contracts/consume.mson`
45
+
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
+
48
+ ### A publish specification:
49
+ ```shell
50
+ /home/dev/message-service$ cat contracts/publish.mson
51
+ # Data Structures
52
+ This file defines what MessageService may publish.
53
+
54
+ # Message
55
+ - id: (number, required)
56
+ - sender_id: (number, required)
57
+ - recipients: (Array[number], required)
58
+ - text: (string, required)
59
+ - emoji: (string)
60
+ ```
61
+
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
+
64
+ ### A consume specification:
65
+ ```shell
66
+ /home/dev/notification-service$ cat contracts/consume.mson
67
+ # Data Structures
68
+ We just consume one object type, and it comes from the MessageService. Check it out!
69
+
70
+ # MessageService:Message
71
+ - sender_id: (number, required)
72
+ - recipient_id: (number, required)
73
+ ```
74
+
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
+
77
+ ```
78
+ # MessageService:Message
79
+ | `---------- object name
80
+ `------------------------- service name
6
81
 
7
- ## Installation
82
+ ```
83
+
84
+ ## Getting started
8
85
 
9
- Add this line to your application's Gemfile:
86
+ ### 1. Installation
87
+ First, add *Old Maid* to your `Gemfile` or install manually:
10
88
 
11
- ```ruby
12
- gem 'old-maid'
89
+ ```shell
90
+ $ gem install old-maid
13
91
  ```
14
92
 
15
- And then execute:
93
+ ### 2. Configuration
94
+
95
+ If you're using ruby on rails, *Old Maid* will automatically know your
96
+ environment and look for its configuration in `config/old-maid.yml`, which could look like this:
97
+
98
+ ```yaml
99
+ common: &common
100
+ # This name will be used by other services to identify objects they consume
101
+ # from the MessageService
102
+ service_name: MessageService
103
+
104
+ # Which directory contains the publish.mson and consume.mson
105
+ contracts_path: contracts
106
+
107
+ # Where to cache the contracts from all other projects that are part of the
108
+ # infrastructure. Old Maid will fetch these for you.
109
+ contracts_cache_path: contracts/.cache
110
+
16
111
 
17
- $ bundle
112
+ development:
113
+ <<: *common
114
+ # The services file contains all services that are part of your infrastructure
115
+ # and tested with Old Maid. It's just another yaml file, but the nice thing is
116
+ # that it's outside of the service's repository and has to be maintained only
117
+ # in one place.
118
+ services_file:
18
119
 
19
- Or install it yourself as:
120
+ # The file name to look for
121
+ file: 'development.yml'
20
122
 
21
- $ gem install old-maid
123
+ # You can either host the file yourself via HTTP, but it's quite convenient
124
+ # to have it version controlled and hosted by a service like github. We'll
125
+ # call this repo old-maid-config for this example:
126
+ github:
127
+ repo: jensmander/old-maid-config
128
+ branch: master
129
+ path: infrastructure
22
130
 
23
- ## Usage
131
+ # And here we can adjust things for each environment as needed
132
+ production:
133
+ <<: *common
134
+ ...
24
135
 
25
- TODO: Write usage instructions here
136
+ ```
137
+
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_USERNAME=youruser` and `GITHUB_TOKEN=yourtoken` and *Old Maid* will use that.
139
+
140
+ Here's how `github.com/jensmander/old-maid-config/infrastructure/master.yml` might look in our example above:
141
+
142
+ ```yaml
143
+ MessageService:
144
+ github:
145
+ repo: 'jensmander/messages'
146
+ branch: 'master'
147
+ path: 'contracts'
148
+ SearchService:
149
+ github:
150
+ repo: 'jensmander/search'
151
+ branch: 'master'
152
+ path: 'contracts'
153
+ NotificationService:
154
+ github:
155
+ repo: 'jensmander/notifications'
156
+ branch: 'master'
157
+ path: 'contracts'
158
+ ```
159
+
160
+ Whenever you add a service to the infrastructure, you just add it to this central file and all existing services will automatically know about your new service.
26
161
 
27
- ## Development
28
162
 
29
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `bin/console` for an interactive prompt that will allow you to experiment.
163
+ ### 3. Usage
30
164
 
31
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release` to create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
165
+ ```shell
166
+ Usage: old-maid [options] full_check|fetch_remote_contracts|update_own_contracts|validate
167
+
168
+ Specific options:
169
+ -c, --config=CONFIG_FILE Config file (default: config/old-maid.yml)
170
+ -e, --env=ENVIRONMENT Environment (default: RAILS_ENV, if it is set)
171
+ -s, --silent No output, just an appropriate return code
172
+
173
+ Common options:
174
+ -h, --help Show this message
175
+ -v, --version Show version
176
+ ```
32
177
 
33
- ## Contributing
178
+ Example time. You can tell *Old Maid* to validate the whole infrastructure like this:
179
+
180
+ ```shell
181
+ $ old-maid -e development full_check
182
+ ```
183
+
184
+ The above command performs the following three steps:
185
+
186
+ 1. Fetch all contracts from remote repositories and put them into the cache directory configured above
187
+ 2. Copy the current projects contracts (that you might have changed) into the cache directory
188
+ 3. Validate all contracts (i.e. make sure that every publishing service satisfies its consumers)
189
+
190
+ The above commands can also be run in isolation:
191
+
192
+ ```shell
193
+ $ old-maid -e development fetch_contracts
194
+ ```
195
+
196
+ This command will populate the `contracts/.cache` directory with the current version of all contracts and then copy over your local changes to your contract. You can then validate your infrastructure like this:
197
+
198
+ ```shell
199
+ $ old-maid -e development validate
200
+ ```
201
+
202
+ If you just made changes to your local contracts, you can copy them over to the cache and validate your infrastructure like this:
203
+
204
+ ```shell
205
+ $ old-maid -e development update_own_contracts validate
206
+ ```
34
207
 
35
- 1. Fork it ( https://github.com/[my-github-username]/old-maid/fork )
36
- 2. Create your feature branch (`git checkout -b my-new-feature`)
37
- 3. Commit your changes (`git commit -am 'Add some feature'`)
38
- 4. Push to the branch (`git push origin my-new-feature`)
39
- 5. Create a new Pull Request
208
+ Otherwise it will exit with an error and display any contract violations in JSON.
data/bin/old-maid ADDED
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require 'old-maid'
5
+ require 'old-maid/runner'
6
+
7
+ OldMaid::Runner.run
data/circle.yml ADDED
@@ -0,0 +1,3 @@
1
+ machine:
2
+ ruby:
3
+ version: 2.2.1
@@ -0,0 +1 @@
1
+ Some MSON
@@ -0,0 +1 @@
1
+ Some MSON
@@ -0,0 +1 @@
1
+ Some MSON
@@ -0,0 +1 @@
1
+ Some MSON
@@ -0,0 +1,145 @@
1
+ require 'active_support/core_ext/hash/indifferent_access'
2
+ require 'yaml'
3
+ require 'fileutils'
4
+ require 'tmpdir'
5
+ require 'minimum-term'
6
+
7
+ require 'old-maid/local_or_remote_file'
8
+
9
+ class OldMaid
10
+ module Instance
11
+ attr_reader :config
12
+
13
+ def initialize(options = {})
14
+ @mutex = Mutex.new
15
+ @options = options
16
+ puts "Using config file #{config_file}" if verbose?
17
+ end
18
+
19
+ def update_contracts
20
+ i = infrastructure
21
+ @mutex.synchronize do
22
+ puts "Updating #{cache_dir}" if verbose?
23
+ update_other_contracts
24
+ update_own_contracts
25
+ i.convert_all!
26
+ end
27
+ true
28
+ end
29
+
30
+ def update_own_contracts
31
+ contract_files.each do |file|
32
+ source_file = File.join(config[:contracts_path], file)
33
+ target_file = File.join(cache_dir, config[:service_name], file)
34
+ puts "cp #{source_file} #{target_file}" if verbose?
35
+ FileUtils.rm_f(target_file)
36
+ FileUtils.cp(source_file, target_file) if File.exists?(source_file)
37
+ end
38
+ end
39
+
40
+ def errors
41
+ infrastructure.errors
42
+ end
43
+
44
+ def contracts_fulfilled?
45
+ infrastructure.contracts_fulfilled?
46
+ end
47
+
48
+ def infrastructure
49
+ @mutex.synchronize do
50
+ return @infrastructure if @infrastructure
51
+ @infrastructure = MinimumTerm::Infrastructure.new(data_dir: cache_dir, verbose: verbose?)
52
+ @infrastructure
53
+ end
54
+ end
55
+
56
+ def config_file
57
+ return File.expand_path(@options[:config_file]) if @options[:config_file]
58
+ File.join(Dir.pwd, 'config', 'old-maid.yml')
59
+ end
60
+
61
+ def env
62
+ return @options[:env].to_sym if @options[:env]
63
+ if Object.const_defined?('Rails')
64
+ Rails.env.to_sym
65
+ else
66
+ guessed = ENV['RAILS_ENV'] || ENV['RACK_ENV']
67
+ raise "No environment given" unless guessed
68
+ guessed
69
+ end
70
+ end
71
+
72
+ def cache_dir
73
+ return @cache_dir if @cache_dir
74
+ full_path = File.expand_path(config[:contracts_cache_path])
75
+ FileUtils.mkdir_p(full_path)
76
+ @cache_dir = full_path
77
+ end
78
+
79
+ def config
80
+ return @config if @config
81
+ full_config = YAML.load_file(config_file).with_indifferent_access
82
+ env_config = full_config[env]
83
+
84
+ raise "No config for environment '#{env}' found in #{config_file}" unless env_config
85
+
86
+ # TODO validate it properly
87
+ [:service_name, :contracts_path, :contracts_cache_path].each do |k|
88
+ raise ":#{k} missing in #{full_config.to_json}" unless env_config[k]
89
+ end
90
+
91
+ @config = env_config
92
+ end
93
+
94
+ private
95
+
96
+ def verbose?
97
+ @options[:verbose]
98
+ end
99
+
100
+ def fetch_service_contracts(service_name, config)
101
+ target_dir = File.join(cache_dir, service_name)
102
+ FileUtils.mkdir_p(target_dir)
103
+
104
+ contract_files.each do |contract|
105
+ file = File.join(target_dir, contract)
106
+ FileUtils.rm_f(file)
107
+
108
+ File.open(file, 'w') do |out|
109
+ contract = LocalOrRemoteFile.new(config.merge(file: contract, verbose: verbose?)).read
110
+ raise "Invalid contract:\n\n#{contract}\n#{'~'*80}" unless contract_looks_valid?(contract)
111
+ out.puts contract
112
+ end
113
+ end
114
+ end
115
+
116
+ def contract_looks_valid?(contract)
117
+ true # TODO
118
+ end
119
+
120
+ def update_other_contracts
121
+ services.each do |service_name, config|
122
+ fetch_service_contracts(service_name, config)
123
+ end
124
+ end
125
+
126
+ def contract_files
127
+ ['publish.mson', 'consume.mson']
128
+ end
129
+
130
+ def services
131
+ if config[:services]
132
+ return config[:services]
133
+ elsif config[:services_file]
134
+ file = LocalOrRemoteFile.new(config[:services_file].merge(debug: verbose?))
135
+ services = YAML.load(file.read)
136
+ begin
137
+ services.with_indifferent_access
138
+ rescue
139
+ raise "Could not load services from #{config[:services_file].to_json}"
140
+ end
141
+ end
142
+ end
143
+
144
+ end
145
+ end
@@ -0,0 +1,61 @@
1
+ require 'colorize'
2
+ require 'httparty'
3
+ require 'open-uri'
4
+
5
+ require 'pry'
6
+
7
+ class OldMaid::LocalOrRemoteFile
8
+ def initialize(options)
9
+ @options = options
10
+ end
11
+
12
+ def read
13
+ if @options[:path]
14
+ read_local
15
+ elsif @options[:github]
16
+ read_from_github
17
+ else
18
+ raise "Unknown file location #{@options}"
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ def read_local
25
+ open(File.join(@options[:path], @options[:file])).read
26
+ end
27
+
28
+ def read_from_github
29
+ self.class.http_get(github_url, verbose?)
30
+ end
31
+
32
+ def self.http_get(url, verbose)
33
+ masked_url = ENV['GITHUB_TOKEN'].blank? ? url : url.sub(ENV['GITHUB_TOKEN'], '***')
34
+ print "GET #{masked_url}... " if verbose
35
+ result = HTTParty.get url
36
+ raise "Error #{result.code}" unless result.code == 200
37
+ print "OK\n".green if verbose
38
+ result.to_s
39
+ rescue
40
+ print "ERROR\n".blue if verbose
41
+ raise
42
+ end
43
+
44
+ def verbose?
45
+ !!@options[:verbose]
46
+ end
47
+
48
+ def github_url
49
+ repo = @options[:github][:repo]
50
+ branch = @options[:github][:branch]
51
+ path = @options[:github][:path]
52
+ file = @options[:file]
53
+
54
+ uri = [branch, path, file].compact.join('/')
55
+ if u = ENV['GITHUB_USER'] and t = ENV['GITHUB_TOKEN']
56
+ "https://#{u}:#{t}@raw.githubusercontent.com/#{repo}/#{uri}"
57
+ else
58
+ "https://raw.githubusercontent.com/#{repo}/#{uri}"
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,83 @@
1
+ # encoding: UTF-8
2
+ require 'optparse'
3
+
4
+ class OldMaid::Runner
5
+ COMMANDS = %w{full_check fetch_remote_contracts update_own_contracts validate}
6
+
7
+ def self.run
8
+ options = {}
9
+ parser = OptionParser.new do |opts|
10
+ opts.banner = "Usage: old-maid [options] #{COMMANDS.join('|')}"
11
+
12
+ opts.separator ""
13
+ opts.separator "Specific options:"
14
+
15
+ opts.on("-c CONFIG_FILE", "--config=CONFIG_FILE", "Config file (default: config/old-maid.yml)") do |c|
16
+ options[:config_file] = c
17
+ end
18
+
19
+ opts.on("-e ENVIRONMENT", "--env=ENVIRONMENT", "Environment (default: RAILS_ENV, if it is set)") do |e|
20
+ options[:env] = e
21
+ end
22
+
23
+ opts.on("-s", "--silent", "No output, just an appropriate return code") do |s|
24
+ options[:silent] = s
25
+ end
26
+
27
+ opts.separator ""
28
+ opts.separator "Common options:"
29
+
30
+ opts.on_tail("-h", "--help", "Show this message") do
31
+ puts opts
32
+ exit
33
+ end
34
+
35
+ # Another typical switch to print the version.
36
+ opts.on_tail("-v", "--version", "Show version") do
37
+ puts OldMaid::VERSION
38
+ exit
39
+ end
40
+ end
41
+ parser.parse!
42
+
43
+ commands = ARGV
44
+ if commands.empty? or !(commands-COMMANDS).empty?
45
+ puts parser
46
+ exit(-1)
47
+ end
48
+
49
+ options[:verbose] = !options.delete(:silent)
50
+ maid = OldMaid.new(options)
51
+
52
+ begin
53
+ if commands.include?('fetch_remote_contracts') or commands.include?('full_check')
54
+ maid.update_contracts
55
+ puts "\n" if options[:verbose]
56
+ end
57
+
58
+ if commands.include?('update_own_contracts')
59
+ puts "Copying #{maid.config[:service_name].to_s.camelize} contracts..." if options[:verbose]
60
+ maid.update_own_contracts
61
+ puts "\n" if options[:verbose]
62
+ end
63
+
64
+ if commands.include?('validate') or commands.include?('full_check')
65
+ puts "Validating your infrastructure with #{maid.infrastructure.publishers.length} publishers and #{maid.infrastructure.consumers.length} consumers..." if options[:verbose]
66
+ maid.contracts_fulfilled?
67
+ unless maid.errors.empty?
68
+ puts JSON.pretty_generate(maid.errors)
69
+ puts "#{maid.errors.length} invalid contracts".red
70
+ exit(-1)
71
+ end
72
+ puts "All contracts valid 🙌".green if options[:verbose]
73
+ end
74
+ rescue => e
75
+ if options[:verbose]
76
+ raise
77
+ else
78
+ puts "ERROR: ".red + e.message
79
+ end
80
+ exit(-1)
81
+ end
82
+ end
83
+ end
@@ -1,3 +1,3 @@
1
1
  class OldMaid
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.1"
3
3
  end
data/lib/old-maid.rb CHANGED
@@ -1,19 +1,23 @@
1
- require 'yaml'
2
- require 'active_support/core_ext/hash/indifferent_access'
1
+ require 'forwardable'
3
2
  require 'old-maid/version'
3
+ require 'old-maid/instance'
4
4
 
5
5
  class OldMaid
6
- attr_reader :config
6
+ include OldMaid::Instance
7
+ MUTEX = Mutex.new
7
8
 
8
- def initialize(config_file, env)
9
- full_config = YAML.load_file(config_file).with_indifferent_access
10
- @config = full_config[env]
9
+ # Not using the SingleForwardable module here so that, when
10
+ # somebody tries to figure out how OldMaid works by looking at
11
+ # its methods, they don't get confused.
12
+ OldMaid::Instance.instance_methods.each do |method|
13
+ define_singleton_method method do |*args|
14
+ send_args = [method, args].flatten.compact
15
+ MUTEX.synchronize do
16
+ @singleton ||= new
17
+ @singleton.send(*send_args)
18
+ end
19
+ end
11
20
  end
21
+ end
12
22
 
13
- def update_contracts
14
-
15
- end
16
23
 
17
- def validate_contracts
18
- end
19
- end
data/old-maid.gemspec CHANGED
@@ -15,19 +15,18 @@ Gem::Specification.new do |spec|
15
15
 
16
16
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
17
17
  spec.bindir = 'bin'
18
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
18
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ['lib']
20
20
 
21
- if spec.respond_to?(:metadata)
22
- spec.metadata['allowed_push_host'] = 'https://gems.moviepilot.com'
23
- end
24
-
25
21
  spec.add_runtime_dependency 'rake', '~> 10.2'
26
- spec.add_runtime_dependency 'minimum-term'
27
- spec.add_runtime_dependency "activesupport", ["~> 4.2"]
22
+ spec.add_runtime_dependency 'minimum-term', '~> 0.2'
23
+ spec.add_runtime_dependency 'activesupport', '~> 4.2'
24
+ spec.add_runtime_dependency 'httparty', '~> 0.13'
25
+ spec.add_runtime_dependency 'colorize'
28
26
 
29
27
  spec.add_development_dependency 'bundler', '~> 1.9'
30
- spec.add_development_dependency 'rake', '~> 10.0'
31
28
  spec.add_development_dependency 'guard-bundler'
32
29
  spec.add_development_dependency 'guard-rspec'
30
+ spec.add_development_dependency 'webmock'
31
+ spec.add_development_dependency "coveralls", ["~> 0.8"]
33
32
  end
metadata CHANGED
@@ -1,153 +1,203 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: old-maid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.1
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-14 00:00:00.000000000 Z
11
+ date: 2015-10-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '10.2'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '10.2'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: minimum-term
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: '0.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: '0'
40
+ version: '0.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
47
  version: '4.2'
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
54
  version: '4.2'
55
+ - !ruby/object:Gem::Dependency
56
+ name: httparty
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.13'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.13'
69
+ - !ruby/object:Gem::Dependency
70
+ name: colorize
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: bundler
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
- - - ~>
87
+ - - "~>"
60
88
  - !ruby/object:Gem::Version
61
89
  version: '1.9'
62
90
  type: :development
63
91
  prerelease: false
64
92
  version_requirements: !ruby/object:Gem::Requirement
65
93
  requirements:
66
- - - ~>
94
+ - - "~>"
67
95
  - !ruby/object:Gem::Version
68
96
  version: '1.9'
69
97
  - !ruby/object:Gem::Dependency
70
- name: rake
98
+ name: guard-bundler
71
99
  requirement: !ruby/object:Gem::Requirement
72
100
  requirements:
73
- - - ~>
101
+ - - ">="
74
102
  - !ruby/object:Gem::Version
75
- version: '10.0'
103
+ version: '0'
76
104
  type: :development
77
105
  prerelease: false
78
106
  version_requirements: !ruby/object:Gem::Requirement
79
107
  requirements:
80
- - - ~>
108
+ - - ">="
81
109
  - !ruby/object:Gem::Version
82
- version: '10.0'
110
+ version: '0'
83
111
  - !ruby/object:Gem::Dependency
84
- name: guard-bundler
112
+ name: guard-rspec
85
113
  requirement: !ruby/object:Gem::Requirement
86
114
  requirements:
87
- - - '>='
115
+ - - ">="
88
116
  - !ruby/object:Gem::Version
89
117
  version: '0'
90
118
  type: :development
91
119
  prerelease: false
92
120
  version_requirements: !ruby/object:Gem::Requirement
93
121
  requirements:
94
- - - '>='
122
+ - - ">="
95
123
  - !ruby/object:Gem::Version
96
124
  version: '0'
97
125
  - !ruby/object:Gem::Dependency
98
- name: guard-rspec
126
+ name: webmock
99
127
  requirement: !ruby/object:Gem::Requirement
100
128
  requirements:
101
- - - '>='
129
+ - - ">="
102
130
  - !ruby/object:Gem::Version
103
131
  version: '0'
104
132
  type: :development
105
133
  prerelease: false
106
134
  version_requirements: !ruby/object:Gem::Requirement
107
135
  requirements:
108
- - - '>='
136
+ - - ">="
109
137
  - !ruby/object:Gem::Version
110
138
  version: '0'
139
+ - !ruby/object:Gem::Dependency
140
+ name: coveralls
141
+ requirement: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '0.8'
146
+ type: :development
147
+ prerelease: false
148
+ version_requirements: !ruby/object:Gem::Requirement
149
+ requirements:
150
+ - - "~>"
151
+ - !ruby/object:Gem::Version
152
+ version: '0.8'
111
153
  description: Vlad
112
154
  email:
113
155
  - jannis@gmail.com
114
- executables: []
156
+ executables:
157
+ - old-maid
115
158
  extensions: []
116
159
  extra_rdoc_files: []
117
160
  files:
118
- - .gitignore
119
- - .rspec
120
- - .travis.yml
161
+ - ".gitignore"
162
+ - ".rspec"
163
+ - ".travis.yml"
164
+ - CHANGELOG.markdown
121
165
  - Gemfile
122
166
  - Guardfile
123
167
  - README.md
124
168
  - Rakefile
125
- - bin/console
126
- - bin/setup
169
+ - bin/old-maid
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
127
175
  - lib/old-maid.rb
176
+ - lib/old-maid/instance.rb
177
+ - lib/old-maid/local_or_remote_file.rb
178
+ - lib/old-maid/runner.rb
128
179
  - lib/old-maid/version.rb
129
180
  - old-maid.gemspec
130
181
  homepage: https://github.com/moviepilot/old-maid
131
182
  licenses: []
132
- metadata:
133
- allowed_push_host: https://gems.moviepilot.com
183
+ metadata: {}
134
184
  post_install_message:
135
185
  rdoc_options: []
136
186
  require_paths:
137
187
  - lib
138
188
  required_ruby_version: !ruby/object:Gem::Requirement
139
189
  requirements:
140
- - - '>='
190
+ - - ">="
141
191
  - !ruby/object:Gem::Version
142
192
  version: '0'
143
193
  required_rubygems_version: !ruby/object:Gem::Requirement
144
194
  requirements:
145
- - - '>='
195
+ - - ">="
146
196
  - !ruby/object:Gem::Version
147
197
  version: '0'
148
198
  requirements: []
149
199
  rubyforge_project:
150
- rubygems_version: 2.0.14
200
+ rubygems_version: 2.4.8
151
201
  signing_key:
152
202
  specification_version: 4
153
203
  summary: Collects and validates the publish/consume contracts of your infrastructure
data/bin/console DELETED
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "old-maid"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- require "pry"
11
- Pry.start
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here