rabid_mq 0.1.7 → 0.1.8

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: 8010b58365ea9f5351f770c9f500a1dc0540c8a2
4
- data.tar.gz: f82934497af821cbdcb68149c77ab27e10478650
3
+ metadata.gz: 00c8990a2d97feae21f657180719f5d6784d4509
4
+ data.tar.gz: 34d977530cb959f6ab9996564914b4dd56327df8
5
5
  SHA512:
6
- metadata.gz: 6bf22422cbdee7287954c33858920bfff70323c3d9b9e447c05adfd4af8017620f8d0dc74c5d816f634129475c3d237507947c43d3cf09b6bf87e0aad392060a
7
- data.tar.gz: 65e179ed94a5626a2b3d37a3b2f5f5b9bcc3a326d06057fb8f51fc7918806601d29d9dbf631943e8298487987e42103d243b0376237925a2bd582784d609675d
6
+ metadata.gz: b339ce90a271e03791ee69f3af6962402c2f16be3e533d014cb8d9087d8368070585f082b30c369f4b12b834396f15c4a6605f151d59418fb919cf7563ccf717
7
+ data.tar.gz: a2ec7410a4b03684072fff1be7eac0273f6816f0b2afd07cf667a32e545dd8395a8f1888f1acf16db946a97d59daa4dc630135cd4aea80197da726d5464aba2f
@@ -32,7 +32,7 @@ module RabidMQ
32
32
  # end
33
33
  #
34
34
  def queue_name(name, **options)
35
- @amqp_queue = RabidMQ.channel.queue(name, **options)
35
+ @amqp_queue = RabidMQ.channel.queue(name_with_env(name), **options)
36
36
  end
37
37
 
38
38
  # Use this as a macro in including classes like
@@ -42,12 +42,7 @@ module RabidMQ
42
42
  # end
43
43
  #
44
44
  def exchange(topic, **options)
45
- @amqp_exchange = RabidMQ.topic_exchange env_topic(topic), options
46
- end
47
-
48
- def env_topic(topic)
49
- return topic unless defined?(::Rails)
50
- topic + "[#{Rails.env}]"
45
+ @amqp_exchange = RabidMQ.topic_exchange name_with_env(topic), options
51
46
  end
52
47
 
53
48
  def bind(exchange=@amqp_exchange, routing_key: '#', **options)
@@ -57,6 +52,7 @@ module RabidMQ
57
52
  delegate :subscribe, to: :bind
58
53
  delegate :channel, to: ::RabidMQ
59
54
  delegate :queue, to: :channel
55
+ delegate :name_with_env, to: ::RabidMQ
60
56
 
61
57
  def amqp_connection
62
58
  amqp_exchange.channel.connection
@@ -1,3 +1,3 @@
1
1
  module RabidMQ
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
data/lib/rabid_mq.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  require 'bunny'
2
2
  require 'yaml'
3
+ require 'sleepers'
3
4
  require 'active_support/concern'
4
5
  require 'active_support/core_ext/module/delegation'
5
6
  require 'rabid_mq/version'
@@ -14,12 +15,12 @@ module RabidMQ
14
15
 
15
16
  # Provide a topic exchange on demand connected to the existing channel
16
17
  def topic_exchange(topic, **options)
17
- channel.topic(topic, **options)
18
+ channel.topic(name_with_env(topic), **options)
18
19
  end
19
20
 
20
21
  # Provide fanout exchange
21
22
  def fanout_exchange(topic, **options)
22
- channel.fanout(topic, **options)
23
+ channel.fanout(name_with_env(topic), **options)
23
24
  end
24
25
 
25
26
  # Get a channel with the Bunny::Session
@@ -40,6 +41,12 @@ module RabidMQ
40
41
  end
41
42
  end
42
43
 
44
+ def name_with_env(name)
45
+ return name unless defined?(::Rails)
46
+ return name if name.match /\[(development|test|production)\]/
47
+ name + "[#{Rails.env}]"
48
+ end
49
+
43
50
  # Provide a new or existing Bunny::Session
44
51
  def connection
45
52
  @connection ||= Bunny.new RabidMQ::Config.load_config
data/rabid_mq.gemspec CHANGED
@@ -36,5 +36,6 @@ Gem::Specification.new do |spec|
36
36
  spec.add_development_dependency "bundler", "~> 1.14"
37
37
  spec.add_development_dependency "rake", "~> 11.0"
38
38
  spec.add_development_dependency "rspec", "~> 3.0"
39
- spec.add_development_dependency "hashie"
39
+ spec.add_development_dependency "sleepers"
40
+
40
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rabid_mq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tyrone Wilson
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '3.0'
83
83
  - !ruby/object:Gem::Dependency
84
- name: hashie
84
+ name: sleepers
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - ">="