bender 0.2.4 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8c687fa8c12ede0c966f86ad51090c930954df88
4
- data.tar.gz: 9f4a8a3009fc0ca9a2a1bfa6f787bc5c2d4fd83a
3
+ metadata.gz: af67ff7730ce26b550d4442dbcfc37244f91f753
4
+ data.tar.gz: 394d0b3028f52c7a141d739ef22c80c9a6809cfb
5
5
  SHA512:
6
- metadata.gz: 9eb974ccac0f408495f128861c2d1f10d9b440cd53b9faf5fd835bdb9c6b7e72220422edd204c871d212b11f6e63511c4a3666cc1700b18adfb8c158ab53f5a5
7
- data.tar.gz: 98f4f797e5139dd431bde6007d6f65068c31128014347c87f71a8bd7e67da1bdee71da93e36e72874f89af9e046ba5292c3506183a13f942bf8c0e52c7dcc370
6
+ metadata.gz: dfac4acaf2586329fd1a99a39debf18ffba3832c04c2a7b5cd14e3b9e5e3c9d663043169bf390814f6ca052f864e94f125335079ceaf684229c8eed98d8b9a1f
7
+ data.tar.gz: 308f814ee4f5b6e3df73da6112ba0b0c62674e745f11025a772446599f146ca54ec87793aeb9e8381b6633cc100e15f706aa16e9981ff8665a9481aa985e9329
data/Gemfile.lock CHANGED
@@ -1,9 +1,9 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- bender (0.2.3)
4
+ bender (0.2.5)
5
5
  activesupport (~> 4.0)
6
- aws-sdk (~> 1.61)
6
+ aws-sdk-v1 (~> 1.61)
7
7
  dotenv (~> 1.0)
8
8
  thor (~> 0.19)
9
9
 
@@ -16,8 +16,6 @@ GEM
16
16
  minitest (~> 5.1)
17
17
  thread_safe (~> 0.3, >= 0.3.4)
18
18
  tzinfo (~> 1.1)
19
- aws-sdk (1.61.0)
20
- aws-sdk-v1 (= 1.61.0)
21
19
  aws-sdk-v1 (1.61.0)
22
20
  json (~> 1.4)
23
21
  nokogiri (>= 1.4.4)
data/bender.gemspec CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency "pry-byebug", '~> 2.0'
26
26
  spec.add_development_dependency "rspec", '~> 2.12'
27
27
 
28
- spec.add_runtime_dependency 'aws-sdk', '~> 1.61'
28
+ spec.add_runtime_dependency 'aws-sdk-v1', '~> 1.61'
29
29
  spec.add_runtime_dependency 'activesupport', '~> 4.0'
30
30
  spec.add_runtime_dependency 'dotenv', '~> 1.0'
31
31
  spec.add_runtime_dependency 'thor', '~> 0.19'
@@ -5,7 +5,7 @@ require 'bender'
5
5
  hostname = Socket.gethostname
6
6
  message = {:hello => :you}
7
7
 
8
- config = { :queue_prefix => 'my-custom-prefix', :watchers => [{:name => :watcher_life_cycle_hook}] }
8
+ config = { :queue_prefix => 'my-custom-prefix-is-really-really-really-huge', :watchers => [{:name => :watcher_life_cycle_hook}] }
9
9
 
10
10
  bender = Bender::Client.new(hostname, config)
11
11
  bender.publish(:watcher_life_cycle_hook, message, true)
data/lib/bender/client.rb CHANGED
@@ -1,4 +1,4 @@
1
- require 'aws-sdk'
1
+ require 'aws-sdk-v1'
2
2
  require 'thwait'
3
3
  require 'dotenv'
4
4
  require 'active_support/inflector'
@@ -100,6 +100,11 @@ module Bender
100
100
 
101
101
  private
102
102
 
103
+ def safe_queue_name(name, with_uniqe = false)
104
+ name = "#{name}#{SecureRandom.uuid}" if with_uniqe
105
+ name[0..79]
106
+ end
107
+
103
108
  def initialize_watchers
104
109
  @watchers = @config[:watchers].collect do |watcher_config|
105
110
  Bender.logger.info("Loading #{watcher_config[:name]}")
@@ -108,7 +113,7 @@ module Bender
108
113
  end
109
114
 
110
115
  def with_confirmation
111
- name = "#{@queue_name}-ack-#{SecureRandom.uuid}"
116
+ name = safe_queue_name("#{@queue_name}-ack-", true)
112
117
  cq = Bender::Client.sqs.queues.create(name, self.config[:create_options])
113
118
 
114
119
  # send message
@@ -1,3 +1,3 @@
1
1
  module Bender
2
- VERSION = "0.2.4"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -9,7 +9,7 @@ end
9
9
  class Watcher
10
10
 
11
11
  def name
12
- @name ||= "#{@queue_name}-#{self.class.to_s.underscore}"
12
+ @name ||= safe_queue_name("#{@queue_name}-#{self.class.to_s.underscore}")
13
13
  end
14
14
 
15
15
  def initialize(queue_name, options)
@@ -56,6 +56,10 @@ class Watcher
56
56
 
57
57
  private
58
58
 
59
+ def safe_queue_name(name)
60
+ name[0..79]
61
+ end
62
+
59
63
  def safe_perform(json)
60
64
  message = JSON.parse(json, :symbolize_names => true) rescue :invalid
61
65
  if message == :invalid
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bender
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.4
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Anthony Leak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-01-28 00:00:00.000000000 Z
11
+ date: 2015-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -81,7 +81,7 @@ dependencies:
81
81
  - !ruby/object:Gem::Version
82
82
  version: '2.12'
83
83
  - !ruby/object:Gem::Dependency
84
- name: aws-sdk
84
+ name: aws-sdk-v1
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
87
  - - "~>"