rabbitmq-spec 0.0.0 → 1.0.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: 17d6b4106ff0256f52e18bc4d7379fac0e052d06
4
- data.tar.gz: 353c420f475babca60c11b9a76f56f3022220a9e
3
+ metadata.gz: 4a9f34c7df10979441244efee2a0a2fa56ec5c26
4
+ data.tar.gz: f406382890793b3ddae3920d2ee5fde551265a19
5
5
  SHA512:
6
- metadata.gz: 9b01a47fe523832c899f59a66f3cf480eb2d137990e79f875306330079bb59495ef1a7573416deaf3020bff276e0a78aa7bd3af25eddbadcf34d0fc0e425af99
7
- data.tar.gz: 2ec72238ae30585ad9d6b1c5a78d3d09e1751737c190f6c37396f789bc44fa0fc7d352a00a28b6c71d4a2a334323f8cea59c00c639214e5f7e95a3c34575e1fe
6
+ metadata.gz: 6965db045ff2714dc83385ed154dddfe5b5d83a9dea5842596b8d8e843cdbeb962c6f87af7e5dcfe049709c9aca205bf73451c05334a6ca0e0be24704e67141f
7
+ data.tar.gz: 94396fb9fdd69bea1bbba4ac590dffd3ebec59e5c11b1d6eafae65bee5245a2aae697f1e16cbbb866818a17ce67a224fd1db10bf667ac4c0a969ae8606133952
data/.codeclimate.yml ADDED
@@ -0,0 +1,23 @@
1
+ engines:
2
+ rubocop:
3
+ enabled: true
4
+ #checks:
5
+ # Rubocop/Metrics/ClassLength:
6
+ # enabled: false
7
+ brakeman:
8
+ enabled: false
9
+ eslint:
10
+ enabled: false
11
+ csslint:
12
+ enabled: false
13
+ duplication:
14
+ enabled: true
15
+ config:
16
+ languages:
17
+ - ruby:
18
+ - javascript:
19
+ ratings:
20
+ paths:
21
+ - lib/**
22
+ exclude_paths:
23
+ - spec/**/*
data/.gitignore CHANGED
@@ -7,3 +7,6 @@
7
7
  /pkg/
8
8
  /spec/reports/
9
9
  /tmp/
10
+ .DS_Store
11
+ .byebug_history
12
+ *.gem
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
data/.rubocop.yml ADDED
@@ -0,0 +1,16 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ Documentation:
4
+ Enabled: false
5
+
6
+ Style/ClassAndModuleChildren:
7
+ Enabled: false
8
+
9
+ Style/FrozenStringLiteralComment:
10
+ Enabled: false
11
+
12
+ AllCops:
13
+ Exclude:
14
+ - 'exe/**/*'
15
+ - 'bin/**/*'
16
+ - 'spec/**/*'
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,69 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2017-07-14 03:46:09 -0300 using RuboCop version 0.49.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 2
10
+ # Cop supports --auto-correct.
11
+ # Configuration parameters: EnforcedStyleAlignWith, SupportedStylesAlignWith, AutoCorrect.
12
+ # SupportedStylesAlignWith: keyword, variable, start_of_line
13
+ Lint/EndAlignment:
14
+ Exclude:
15
+ - 'lib/rabbitmq-spec/dsl/builder/base.rb'
16
+
17
+ # Offense count: 1
18
+ Lint/RescueException:
19
+ Exclude:
20
+ - 'lib/rabbitmq-spec/setup.rb'
21
+
22
+ # Offense count: 1
23
+ Metrics/AbcSize:
24
+ Max: 16
25
+
26
+ # Offense count: 7
27
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
28
+ # URISchemes: http, https
29
+ Metrics/LineLength:
30
+ Max: 104
31
+
32
+ # Offense count: 1
33
+ # Configuration parameters: CountComments.
34
+ Metrics/MethodLength:
35
+ Max: 12
36
+
37
+ # Offense count: 1
38
+ Style/AccessorMethodName:
39
+ Exclude:
40
+ - 'lib/rabbitmq-spec/dsl/builder/base.rb'
41
+
42
+ # Offense count: 1
43
+ # Configuration parameters: ExpectMatchingDefinition, Regex, IgnoreExecutableScripts, AllowedAcronyms.
44
+ # AllowedAcronyms: CLI, DSL, ACL, API, ASCII, CPU, CSS, DNS, EOF, GUID, HTML, HTTP, HTTPS, ID, IP, JSON, LHS, QPS, RAM, RHS, RPC, SLA, SMTP, SQL, SSH, TCP, TLS, TTL, UDP, UI, UID, UUID, URI, URL, UTF8, VM, XML, XMPP, XSRF, XSS
45
+ Style/FileName:
46
+ Exclude:
47
+ - 'lib/rabbitmq-spec.rb'
48
+
49
+ # Offense count: 2
50
+ # Configuration parameters: MinBodyLength.
51
+ Style/GuardClause:
52
+ Exclude:
53
+ - 'lib/rabbitmq-spec/dsl/builder/base.rb'
54
+ - 'rabbitmq-spec.gemspec'
55
+
56
+ # Offense count: 2
57
+ Style/MethodMissing:
58
+ Exclude:
59
+ - 'lib/rabbitmq-spec/dsl/builder/base.rb'
60
+
61
+ # Offense count: 1
62
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
63
+ # NamePrefix: is_, has_, have_
64
+ # NamePrefixBlacklist: is_, has_, have_
65
+ # NameWhitelist: is_a?
66
+ Style/PredicateName:
67
+ Exclude:
68
+ - 'spec/**/*'
69
+ - 'lib/rabbitmq-spec/dsl/builder/base.rb'
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ rabbitmq-spec
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 2.4.1
data/.travis.yml ADDED
@@ -0,0 +1,26 @@
1
+ env:
2
+ global:
3
+ - CC_TEST_REPORTER_ID=4d256099898a6b6b235c5a1cc42a1d27b0276b31b5dcca3065e53440844541c4
4
+ - GIT_COMMITTED_AT=$(if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then git log -1 --pretty=format:%ct; else git log -1 --skip 1 --pretty=format:%ct; fi)
5
+
6
+ language: ruby
7
+
8
+ cache:
9
+ bundler: true
10
+
11
+ rvm:
12
+ - "2.4.1"
13
+
14
+ bundler_args: "--binstubs --standalone --without documentation --path ../bundle"
15
+
16
+ before_script:
17
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
18
+ - chmod +x ./cc-test-reporter
19
+
20
+ script:
21
+ - bundle exec rubocop -c .rubocop.yml
22
+ - bundle exec rspec
23
+ - if [ "$TRAVIS_PULL_REQUEST" == "false" ]; then ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT; fi
24
+
25
+ notifications:
26
+ email: false
data/README.md CHANGED
@@ -1,15 +1,21 @@
1
- # Rabbitmq::Spec
1
+ rabbitmq-spec
2
+ ==========
3
+ [![Travis](https://travis-ci.org/viniciusoyama/rabbitmq-spec.svg?branch=master)](https://travis-ci.org/viniciusoyama/rabbitmq-spec)
4
+ [![Code Climate](https://codeclimate.com/github/viniciusoyama/rabbitmq-spec/badges/gpa.svg)](https://codeclimate.com/github/viniciusoyama/rabbitmq-spec)
5
+ [![Test Coverage](https://codeclimate.com/github/viniciusoyama/rabbitmq-spec/badges/coverage.svg)](https://codeclimate.com/github/viniciusoyama/rabbitmq-spec)
2
6
 
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/rabbitmq/spec`. To experiment with that code, run `bin/console` for an interactive prompt.
7
+ Gem for documenting and configuring RabbitMQ.
4
8
 
5
- TODO: Delete this and the text above, and describe your gem
9
+ It uses the specification files themselves to setup all the exchanges, queues and bindings on RabbitMQ.
6
10
 
7
- ## Installation
11
+ # Installation
8
12
 
9
13
  Add this line to your application's Gemfile:
10
14
 
11
15
  ```ruby
16
+
12
17
  gem 'rabbitmq-spec'
18
+
13
19
  ```
14
20
 
15
21
  And then execute:
@@ -20,22 +26,100 @@ Or install it yourself as:
20
26
 
21
27
  $ gem install rabbitmq-spec
22
28
 
23
- ## Usage
29
+ # Usage
30
+
31
+ ## Specification files
32
+
33
+ You can document your RabbitMQ architecture using this gem DSL.
34
+
35
+ We suggest to make a new folder called mqspecs and put your RabbitMQ Specification there. You can define everything in one file or split in many files/subfolders.
36
+
37
+ Example:
38
+
39
+ ```
40
+
41
+ ├── my_app/
42
+ │ ├── ...
43
+ ├── mqspecs/
44
+ │ ├── exchange1_mqspec.rb
45
+ │ ├── exchange2_mqspec.rb
46
+ │ ├── ...
47
+
48
+ ```
49
+
50
+ On each mqspec file. You can use the following syntax:
51
+
52
+ `````ruby
53
+
54
+ exchange 'exchange-name' do
55
+ description 'exchange-description' # optional
56
+
57
+ # exchange options are forwarded to Bunny Channel#exchanged method
58
+ # http://reference.rubybunny.info/Bunny/Channel.html#exchange-instance_method
59
+ options do
60
+ type 'topic'
61
+ durable true
62
+ end
63
+
64
+ queue 'queue-name' do
65
+ description 'queue1 description' # optional
66
+ routing_key 'my-custom-routing-key' # optional
67
+
68
+ # queue options are forwarded to Bunny Channel#queue method
69
+ # http://reference.rubybunny.info/Bunny/Channel.html#queue-instance_methodChannel.html#exchange-instance_method
70
+ options do
71
+ durable true
72
+ end
73
+ end
74
+ end
75
+ `````
24
76
 
25
- TODO: Write usage instructions here
77
+ ## RabbitMQ Setup
78
+
79
+ To understant how to use rabbitmq-spec just type the following on your shell after installing the gem:
80
+
81
+ ```shell
82
+
83
+ rabbitmq-spec
84
+
85
+ ```
86
+
87
+ It will list all the available commands and how to use them. Example:
88
+
89
+ ```
90
+
91
+ $ rabbitmq-spec
92
+ USAGE
93
+ rabbitmq-spec command [options]
94
+
95
+ COMMANDS
96
+ setup
97
+ Usage: rabbitmq-spec setup ./mqspec [-u 'amqp://guest:guest@localhost:5672']
98
+ Configure RabbitMQ using the mqspecs files.
99
+ If you pass a ruby file it will evaluate it.
100
+ If you pass a folder it will look for all the files finishing with "_mqspec.rb" and evaluate them.
101
+
102
+
103
+ OPTIONS
104
+ -h --help show help for rabbitmq-spec
105
+
106
+ ```
26
107
 
27
108
  ## Development
28
109
 
29
- After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
110
+ After checking out the repo, run `bin/setup` to install dependencies.
111
+
112
+ No additional configuration is needed.
30
113
 
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`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
114
+ Here we're using Rspec with simplecov and rubocop.
32
115
 
33
116
  ## Contributing
34
117
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/rabbitmq-spec.
118
+ If you have any idea for a feature or have found any bugs feel free to open a new issue at.
119
+
120
+ https://github.com/viniciusoyama/rabbitmq-spec.
36
121
 
37
122
 
38
123
  ## License
39
124
 
40
125
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
-
data/Rakefile CHANGED
@@ -1,2 +1,2 @@
1
- require "bundler/gem_tasks"
2
- task :default => :spec
1
+ require 'bundler/gem_tasks'
2
+ task default: :spec
data/bin/console CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
- require "bundler/setup"
4
- require "rabbitmq/spec"
3
+ require 'bundler/setup'
4
+ require 'rabbitmq/spec'
5
5
 
6
6
  # You can add fixtures and/or initialization code here to make experimenting
7
7
  # with your gem easier. You can also use a different console, if you like.
@@ -10,5 +10,5 @@ require "rabbitmq/spec"
10
10
  # require "pry"
11
11
  # Pry.start
12
12
 
13
- require "irb"
13
+ require 'irb'
14
14
  IRB.start
data/exe/rabbitmq-spec ADDED
@@ -0,0 +1,61 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require 'cri'
4
+ require 'rabbitmq-spec'
5
+
6
+ root_cmd = Cri::Command.define do
7
+ name 'rabbitmq-spec'
8
+ usage 'rabbitmq-spec command [options]'
9
+
10
+ flag :h, :help, 'show help for rabbitmq-spec' do |_value, cmd|
11
+ puts cmd.help
12
+ exit 0
13
+ end
14
+
15
+ run do |_opts, _args, cmd|
16
+ puts cmd.help
17
+ exit 0
18
+ end
19
+ end
20
+
21
+ cmd_setup = Cri::Command.define do
22
+ name 'setup'
23
+ usage 'rabbitmq-spec setup [options]'
24
+ summary %{
25
+ Usage: rabbitmq-spec setup ./mqspec [-u 'amqp://guest:guest@localhost:5672']
26
+ Configure RabbitMQ using the mqspecs files.
27
+ If you pass a ruby file it will evaluate it.
28
+ If you pass a folder it will look for all the files finishing with "_mqspec.rb" and evaluate them.
29
+ }
30
+
31
+ required :u, :"broker-url", 'AMPQ Broker Url - Defaults to localhost:5672', argument: :required
32
+
33
+ run do |opts, args, _cmd|
34
+ opts[:'broker-url'] ||= 'amqp://guest:guest@localhost:5672'
35
+ if args.count.zero?
36
+ puts 'Please pass a folder or a file name.'
37
+ exit 0
38
+ else
39
+ paths = args.map do |target_path|
40
+ if File.file?(target_path)
41
+ target_path
42
+ else
43
+ Dir.glob("#{target_path}/**/*_mqspec.rb").reject { |file_path| File.directory? file_path }
44
+ end
45
+ end.flatten
46
+ if paths.count.zero?
47
+ puts "ERROR: No *_mqspec.rb files found."
48
+ else
49
+ puts "Parsing files:"
50
+ puts paths
51
+ RabbitMQSpec::Setup.run(files_paths: paths, url: opts[:'broker-url'])
52
+ puts "Setup finished on #{opts[:'broker-url']}'"
53
+ end
54
+ end
55
+ exit 0
56
+ end
57
+ end
58
+
59
+ root_cmd.add_command(cmd_setup)
60
+
61
+ root_cmd.run(ARGV)
@@ -0,0 +1,79 @@
1
+ class RabbitMQSpec::DSL::Builder::Base
2
+ # class methods
3
+ def self.define_dsl_attribute(attribute_name)
4
+ @allowed_dsl_attributes ||= []
5
+ @allowed_dsl_attributes << attribute_name.to_sym
6
+ end
7
+
8
+ def self.define_entity_class(entity_class)
9
+ @entity_class = entity_class
10
+ end
11
+
12
+ def self.get_entity_class
13
+ @entity_class
14
+ end
15
+
16
+ def self.has_dsl_attribute?(attribute_name)
17
+ @allowed_dsl_attributes.include?(attribute_name.to_sym)
18
+ end
19
+
20
+ def self.build(default_entity_values = {}, &block)
21
+ builder = new(default_entity_values)
22
+ builder.instance_eval(&block)
23
+ builder.build_entity
24
+ end
25
+
26
+ # instance methods
27
+ def initialize(default_entity_values = {})
28
+ @builded_attributes = {}.merge(default_entity_values)
29
+ end
30
+
31
+ def method_missing(method_name, *args, &block)
32
+ if self.class.has_dsl_attribute?(method_name.to_sym)
33
+ @builded_attributes[method_name.to_sym] = if block_given?
34
+ build_hash_from_block(&block)
35
+ else
36
+ args[0]
37
+ end
38
+ else
39
+ raise "Configuration '#{method_name}' is not allowed for #{self}"
40
+ end
41
+ end
42
+
43
+ def build_entity
44
+ raise "Entity class is not defined for #{self.class}" if self.class.get_entity_class.nil?
45
+ entity = self.class.get_entity_class.new
46
+ @builded_attributes.each_pair do |k, v|
47
+ entity.send("#{k}=", v)
48
+ end
49
+ entity
50
+ end
51
+
52
+ private
53
+
54
+ class HashBuilder
55
+ def initialize
56
+ @hash = {}
57
+ end
58
+
59
+ def build
60
+ @hash
61
+ end
62
+
63
+ def method_missing(method_name, *args, &block)
64
+ @hash[method_name.to_sym] = if block_given?
65
+ builder = HashBuilder.new
66
+ builder.instance_eval(&block)
67
+ builder.build
68
+ else
69
+ args[0]
70
+ end
71
+ end
72
+ end
73
+
74
+ def build_hash_from_block(&block)
75
+ builder = HashBuilder.new
76
+ builder.instance_eval(&block)
77
+ builder.build
78
+ end
79
+ end
@@ -0,0 +1,12 @@
1
+ class RabbitMQSpec::DSL::Builder::Exchange < RabbitMQSpec::DSL::Builder::Base
2
+ define_entity_class RabbitMQSpec::Entity::Exchange
3
+
4
+ define_dsl_attribute :name
5
+ define_dsl_attribute :description
6
+ define_dsl_attribute :options
7
+
8
+ def queue(name, &block)
9
+ @builded_attributes[:queues] ||= []
10
+ @builded_attributes[:queues] << RabbitMQSpec::DSL::Builder::Queue.build(name: name, &block)
11
+ end
12
+ end
@@ -0,0 +1,8 @@
1
+ class RabbitMQSpec::DSL::Builder::Queue < RabbitMQSpec::DSL::Builder::Base
2
+ define_entity_class RabbitMQSpec::Entity::Queue
3
+
4
+ define_dsl_attribute :name
5
+ define_dsl_attribute :description
6
+ define_dsl_attribute :routing_key
7
+ define_dsl_attribute :options
8
+ end
@@ -0,0 +1,5 @@
1
+ class RabbitMQSpec::DSL::Builder
2
+ autoload :Base, 'rabbitmq-spec/dsl/builder/base'
3
+ autoload :Queue, 'rabbitmq-spec/dsl/builder/queue'
4
+ autoload :Exchange, 'rabbitmq-spec/dsl/builder/exchange'
5
+ end
@@ -0,0 +1,12 @@
1
+ class RabbitMQSpec::DSL::World
2
+ attr_reader :exchanges
3
+
4
+ def initialize
5
+ @exchanges = []
6
+ end
7
+
8
+ def exchange(name, &block)
9
+ new_exchange = RabbitMQSpec::DSL::Builder::Exchange.build(name: name, &block)
10
+ @exchanges << new_exchange
11
+ end
12
+ end
@@ -0,0 +1,10 @@
1
+ module RabbitMQSpec::DSL
2
+ autoload :World, 'rabbitmq-spec/dsl/world'
3
+ autoload :Builder, 'rabbitmq-spec/dsl/builder'
4
+
5
+ def self.evaluate(dsl)
6
+ world = World.new
7
+ world.instance_eval(dsl)
8
+ world
9
+ end
10
+ end
@@ -0,0 +1,11 @@
1
+ class RabbitMQSpec::Entity::Exchange
2
+ attr_accessor :name
3
+ attr_accessor :description
4
+ attr_accessor :queues
5
+ attr_accessor :options
6
+
7
+ def initialize
8
+ @queues = []
9
+ @options = {}
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ class RabbitMQSpec::Entity::Queue
2
+ attr_accessor :name
3
+ attr_accessor :description
4
+ attr_accessor :routing_key
5
+ attr_accessor :options
6
+
7
+ def initialize
8
+ @options = {}
9
+ end
10
+ end
@@ -0,0 +1,4 @@
1
+ module RabbitMQSpec::Entity
2
+ autoload :Exchange, 'rabbitmq-spec/entity/exchange'
3
+ autoload :Queue, 'rabbitmq-spec/entity/queue'
4
+ end
@@ -0,0 +1,20 @@
1
+ class RabbitMQSpec::Setup::Runner
2
+ def initialize(paths_to_read, client)
3
+ @paths_to_read = paths_to_read
4
+ @client = client
5
+ end
6
+
7
+ def run
8
+ worlds.each do |world|
9
+ setup_world(world)
10
+ end
11
+ end
12
+
13
+ def worlds
14
+ @paths_to_read.map { |path| RabbitMQSpec::Setup::WorldFetcher.call(path) }
15
+ end
16
+
17
+ def setup_world(world)
18
+ RabbitMQSpec::Setup::WorldSetupper.call(world, @client)
19
+ end
20
+ end
@@ -0,0 +1,8 @@
1
+ module RabbitMQSpec::Setup::WorldFetcher
2
+ class << self
3
+ def call(mqspec_file_path)
4
+ dsl_string = File.read(mqspec_file_path)
5
+ RabbitMQSpec::DSL.evaluate(dsl_string)
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,21 @@
1
+ module RabbitMQSpec::Setup::WorldSetupper
2
+ class << self
3
+ def call(world, client)
4
+ world.exchanges.each do |exchange|
5
+ setup_exchange(exchange, client)
6
+ end
7
+ end
8
+
9
+ def setup_exchange(exchange, client)
10
+ client.exchange(exchange.name, exchange.options)
11
+ exchange.queues.each do |queue|
12
+ client_queue = client.queue(queue.name, queue.options)
13
+ if queue.routing_key.nil?
14
+ client_queue.bind(exchange.name)
15
+ else
16
+ client_queue.bind(exchange.name, routing_key: queue.routing_key)
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,30 @@
1
+ require 'bunny'
2
+
3
+ class RabbitMQSpec::Setup
4
+ autoload :Runner, 'rabbitmq-spec/setup/runner'
5
+ autoload :WorldSetupper, 'rabbitmq-spec/setup/world_setupper'
6
+ autoload :WorldFetcher, 'rabbitmq-spec/setup/world_fetcher'
7
+
8
+ class << self
9
+ def run(files_paths:, url:)
10
+ with_client(url) do |client|
11
+ RabbitMQSpec::Setup::Runner.new(files_paths, client).run
12
+ end
13
+ end
14
+
15
+ def with_client(ampq_broker_url)
16
+ client = Bunny.new(ampq_broker_url, automatically_recover: false)
17
+ channel = nil
18
+ begin
19
+ client.start
20
+ channel = client.create_channel
21
+ yield(channel)
22
+ rescue Exception => ex
23
+ raise ex
24
+ ensure
25
+ channel&.close
26
+ client&.close
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,3 @@
1
+ module RabbitMQSpec
2
+ VERSION = '1.0.0'.freeze
3
+ end
@@ -0,0 +1,7 @@
1
+ require 'rabbitmq-spec/version'
2
+
3
+ module RabbitMQSpec
4
+ autoload :DSL, 'rabbitmq-spec/dsl'
5
+ autoload :Entity, 'rabbitmq-spec/entity'
6
+ autoload :Setup, 'rabbitmq-spec/setup'
7
+ end
@@ -1,32 +1,40 @@
1
1
  # coding: utf-8
2
+
2
3
  lib = File.expand_path('../lib', __FILE__)
3
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'rabbitmq/spec/version'
5
+ require 'rabbitmq-spec/version'
5
6
 
6
7
  Gem::Specification.new do |spec|
7
- spec.name = "rabbitmq-spec"
8
- spec.version = Rabbitmq::Spec::VERSION
9
- spec.authors = ["Vinicius Oyama"]
10
- spec.email = ["vinicius.oyama@codus.com.br"]
8
+ spec.name = 'rabbitmq-spec'
9
+ spec.version = RabbitMQSpec::VERSION
10
+ spec.authors = ['Vinicius Oyama']
11
+ spec.email = ['vinicius.oyama@codus.com.br']
11
12
 
12
- spec.summary = %q{Gem for documenting and configuring RabbitMQ brokers}
13
- spec.description = %q{Gem for documenting and configuring RabbitMQ brokers}
14
- spec.homepage = "https://github.com/viniciusoyama/rabbitmq-spec"
15
- spec.license = "MIT"
13
+ spec.summary = 'Gem for documenting and configuring RabbitMQ brokers.'
14
+ spec.description = "Use this gem DSL to create RabbitMQ architecture specification and evaluate it in order to configure RabbitMQ in one shot."
15
+ spec.homepage = 'https://github.com/viniciusoyama/rabbitmq-spec'
16
+ spec.license = 'MIT'
16
17
 
17
18
  # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
19
  # delete this section to allow pushing this gem to any host.
19
20
  if spec.respond_to?(:metadata)
20
- spec.metadata['allowed_push_host'] = "https://rubygems.org"
21
+ spec.metadata['allowed_push_host'] = 'https://rubygems.org'
21
22
  else
22
- raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
+ raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
23
24
  end
24
25
 
25
26
  spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- spec.bindir = "exe"
27
+ spec.bindir = 'exe'
27
28
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
- spec.require_paths = ["lib"]
29
+ spec.require_paths = ['lib']
30
+
31
+ spec.add_runtime_dependency 'cri', '~> 2.7'
32
+ spec.add_runtime_dependency 'bunny', '~> 2.0'
29
33
 
30
- spec.add_development_dependency "bundler", "~> 1.11"
31
- spec.add_development_dependency "rake", "~> 10.0"
34
+ spec.add_development_dependency 'bundler', '~> 1.11'
35
+ spec.add_development_dependency 'rake', '~> 10.0'
36
+ spec.add_development_dependency 'byebug'
37
+ spec.add_development_dependency 'rubocop', '0.49'
38
+ spec.add_development_dependency 'simplecov'
39
+ spec.add_development_dependency 'rspec', '~> 3.6'
32
40
  end
metadata CHANGED
@@ -1,15 +1,43 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabbitmq-spec
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vinicius Oyama
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-11 00:00:00.000000000 Z
11
+ date: 2017-07-15 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: cri
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.7'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.7'
27
+ - !ruby/object:Gem::Dependency
28
+ name: bunny
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '2.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '2.0'
13
41
  - !ruby/object:Gem::Dependency
14
42
  name: bundler
15
43
  requirement: !ruby/object:Gem::Requirement
@@ -38,22 +66,101 @@ dependencies:
38
66
  - - "~>"
39
67
  - !ruby/object:Gem::Version
40
68
  version: '10.0'
41
- description: Gem for documenting and configuring RabbitMQ brokers
69
+ - !ruby/object:Gem::Dependency
70
+ name: byebug
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rubocop
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - '='
88
+ - !ruby/object:Gem::Version
89
+ version: '0.49'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - '='
95
+ - !ruby/object:Gem::Version
96
+ version: '0.49'
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rspec
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '3.6'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '3.6'
125
+ description: Use this gem DSL to create RabbitMQ architecture specification and evaluate
126
+ it in order to configure RabbitMQ in one shot.
42
127
  email:
43
128
  - vinicius.oyama@codus.com.br
44
- executables: []
129
+ executables:
130
+ - rabbitmq-spec
45
131
  extensions: []
46
132
  extra_rdoc_files: []
47
133
  files:
134
+ - ".codeclimate.yml"
48
135
  - ".gitignore"
136
+ - ".rspec"
137
+ - ".rubocop.yml"
138
+ - ".rubocop_todo.yml"
139
+ - ".ruby-gemset"
140
+ - ".ruby-version"
141
+ - ".travis.yml"
49
142
  - Gemfile
50
143
  - LICENSE.txt
51
144
  - README.md
52
145
  - Rakefile
53
146
  - bin/console
54
147
  - bin/setup
55
- - lib/rabbitmq/spec.rb
56
- - lib/rabbitmq/spec/version.rb
148
+ - exe/rabbitmq-spec
149
+ - lib/rabbitmq-spec.rb
150
+ - lib/rabbitmq-spec/dsl.rb
151
+ - lib/rabbitmq-spec/dsl/builder.rb
152
+ - lib/rabbitmq-spec/dsl/builder/base.rb
153
+ - lib/rabbitmq-spec/dsl/builder/exchange.rb
154
+ - lib/rabbitmq-spec/dsl/builder/queue.rb
155
+ - lib/rabbitmq-spec/dsl/world.rb
156
+ - lib/rabbitmq-spec/entity.rb
157
+ - lib/rabbitmq-spec/entity/exchange.rb
158
+ - lib/rabbitmq-spec/entity/queue.rb
159
+ - lib/rabbitmq-spec/setup.rb
160
+ - lib/rabbitmq-spec/setup/runner.rb
161
+ - lib/rabbitmq-spec/setup/world_fetcher.rb
162
+ - lib/rabbitmq-spec/setup/world_setupper.rb
163
+ - lib/rabbitmq-spec/version.rb
57
164
  - rabbitmq-spec.gemspec
58
165
  homepage: https://github.com/viniciusoyama/rabbitmq-spec
59
166
  licenses:
@@ -76,8 +183,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
76
183
  version: '0'
77
184
  requirements: []
78
185
  rubyforge_project:
79
- rubygems_version: 2.4.8
186
+ rubygems_version: 2.6.11
80
187
  signing_key:
81
188
  specification_version: 4
82
- summary: Gem for documenting and configuring RabbitMQ brokers
189
+ summary: Gem for documenting and configuring RabbitMQ brokers.
83
190
  test_files: []
@@ -1,5 +0,0 @@
1
- module Rabbitmq
2
- module Spec
3
- VERSION = "0.0.0"
4
- end
5
- end
data/lib/rabbitmq/spec.rb DELETED
@@ -1,7 +0,0 @@
1
- require "rabbitmq/spec/version"
2
-
3
- module Rabbitmq
4
- module Spec
5
- # Your code goes here...
6
- end
7
- end