captainu-tincan 0.7.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,15 @@
1
+ require 'codeclimate-test-reporter'
2
+ CodeClimate::TestReporter.start
3
+
4
+ require 'rspec'
5
+ require 'pry'
6
+ require 'tincan'
7
+
8
+ Dir[File.join(File.dirname(__FILE__), 'support', '**', '*.rb')].each do |file|
9
+ require file
10
+ end
11
+
12
+ RSpec.configure do |config|
13
+ config.order = 'random'
14
+ config.include Futuristic::Matchers
15
+ end
@@ -0,0 +1,8 @@
1
+ # A dummy used for sending a message.
2
+ class DummyClass
3
+ attr_accessor :name
4
+
5
+ def to_json(options)
6
+ { name: name }.to_json(options)
7
+ end
8
+ end
@@ -0,0 +1,61 @@
1
+ require 'timeout'
2
+
3
+ # Provides matchers for expecting asynchronous results.
4
+ module Futuristic
5
+ module Matchers
6
+ class Matcher
7
+ attr_accessor :expected
8
+
9
+ def evenual_result
10
+ Timeout.timeout(5.0) do
11
+ value = nil
12
+ while value.nil?
13
+ sleep(0.1)
14
+ value = yield
15
+ end
16
+ value
17
+ end
18
+ rescue TimeoutError
19
+ nil
20
+ end
21
+
22
+ def supports_block_expectations?
23
+ true
24
+ end
25
+ end
26
+
27
+ class EventuallyEqual < Matcher
28
+ attr_accessor :condition
29
+
30
+ def initialize(expected, condition = :equality)
31
+ @expected = expected
32
+ @condition = condition
33
+ end
34
+
35
+ def matches?(block)
36
+ case condition
37
+ when :equality
38
+ expected == evenual_result(&block)
39
+ when :class_equality
40
+ expected == evenual_result(&block).class
41
+ end
42
+ end
43
+
44
+ def failure_message
45
+ "The block should've eventually resulted in #{expected} but it did not."
46
+ end
47
+
48
+ def failure_message_when_negated
49
+ "The block shouldn't have eventually resulted in #{expected} but it did."
50
+ end
51
+ end
52
+
53
+ def eventually_equal(target)
54
+ Futuristic::Matchers::EventuallyEqual.new(target, :equality)
55
+ end
56
+
57
+ def eventually_be_a(target)
58
+ Futuristic::Matchers::EventuallyEqual.new(target, :class_equality)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,7 @@
1
+ require 'spec_helper'
2
+
3
+ describe Tincan do
4
+ it 'has a version' do
5
+ expect(Tincan::VERSION).to be_a(String)
6
+ end
7
+ end
data/tincan.gemspec ADDED
@@ -0,0 +1,35 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'tincan/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = 'captainu-tincan'
8
+ spec.version = Tincan::VERSION
9
+ spec.authors = ['Ben Kreeger']
10
+ spec.email = %w(ben@captainu.com)
11
+ spec.summary = %q(A simple implementation of reliable Redis messaging.)
12
+ spec.description = <<-DESC
13
+ Provides an easy way to register senders and receivers on a reliable Redis
14
+ message queue.
15
+ DESC
16
+
17
+ spec.homepage = 'https://github.com/captainu/tincan'
18
+ spec.license = 'MIT'
19
+
20
+ spec.files = `git ls-files -z`.split("\x0")
21
+ spec.executables = spec.files.grep(/^bin\//) { |f| File.basename(f) }
22
+ spec.test_files = spec.files.grep(/^(test|spec|features)\//)
23
+ spec.require_paths = %w(lib)
24
+
25
+ spec.add_runtime_dependency 'json', '~> 1.8.1'
26
+ spec.add_runtime_dependency 'redis', '~> 3.0.7'
27
+ spec.add_runtime_dependency 'activesupport', '>= 3.2.0'
28
+
29
+ spec.add_development_dependency 'bundler', '~> 1.6'
30
+ spec.add_development_dependency 'rspec', '~> 3.0.0'
31
+ spec.add_development_dependency 'pry', '~> 0.9.12'
32
+ spec.add_development_dependency 'pry-nav', '~> 0.2.3'
33
+ spec.add_development_dependency 'codeclimate-test-reporter', '~> 0.3.0'
34
+ spec.add_development_dependency 'rake'
35
+ end
metadata ADDED
@@ -0,0 +1,213 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: captainu-tincan
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.7.0
5
+ platform: ruby
6
+ authors:
7
+ - Ben Kreeger
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-07-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: json
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ~>
18
+ - !ruby/object:Gem::Version
19
+ version: 1.8.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ~>
25
+ - !ruby/object:Gem::Version
26
+ version: 1.8.1
27
+ - !ruby/object:Gem::Dependency
28
+ name: redis
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 3.0.7
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ~>
39
+ - !ruby/object:Gem::Version
40
+ version: 3.0.7
41
+ - !ruby/object:Gem::Dependency
42
+ name: activesupport
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: 3.2.0
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: 3.2.0
55
+ - !ruby/object:Gem::Dependency
56
+ name: bundler
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.6'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '1.6'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: 3.0.0
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: 3.0.0
83
+ - !ruby/object:Gem::Dependency
84
+ name: pry
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 0.9.12
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 0.9.12
97
+ - !ruby/object:Gem::Dependency
98
+ name: pry-nav
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ~>
102
+ - !ruby/object:Gem::Version
103
+ version: 0.2.3
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ~>
109
+ - !ruby/object:Gem::Version
110
+ version: 0.2.3
111
+ - !ruby/object:Gem::Dependency
112
+ name: codeclimate-test-reporter
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - ~>
116
+ - !ruby/object:Gem::Version
117
+ version: 0.3.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - ~>
123
+ - !ruby/object:Gem::Version
124
+ version: 0.3.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - '>='
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - '>='
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: |2
140
+ Provides an easy way to register senders and receivers on a reliable Redis
141
+ message queue.
142
+ email:
143
+ - ben@captainu.com
144
+ executables:
145
+ - tincan
146
+ - tincanctl
147
+ extensions: []
148
+ extra_rdoc_files: []
149
+ files:
150
+ - .gitignore
151
+ - .rspec
152
+ - .rubocop.yml
153
+ - .ruby-version
154
+ - .travis.yml
155
+ - Gemfile
156
+ - Rakefile
157
+ - bin/tincan
158
+ - bin/tincanctl
159
+ - lib/tincan.rb
160
+ - lib/tincan/cli.rb
161
+ - lib/tincan/failure.rb
162
+ - lib/tincan/message.rb
163
+ - lib/tincan/receiver.rb
164
+ - lib/tincan/sender.rb
165
+ - lib/tincan/version.rb
166
+ - license.markdown
167
+ - readme.markdown
168
+ - spec/failure_spec.rb
169
+ - spec/fixtures/failure.json
170
+ - spec/fixtures/message.json
171
+ - spec/message_spec.rb
172
+ - spec/receiver_spec.rb
173
+ - spec/sender_spec.rb
174
+ - spec/spec_helper.rb
175
+ - spec/support/dummy.rb
176
+ - spec/support/futuristic.rb
177
+ - spec/tincan_spec.rb
178
+ - tincan.gemspec
179
+ homepage: https://github.com/captainu/tincan
180
+ licenses:
181
+ - MIT
182
+ metadata: {}
183
+ post_install_message:
184
+ rdoc_options: []
185
+ require_paths:
186
+ - lib
187
+ required_ruby_version: !ruby/object:Gem::Requirement
188
+ requirements:
189
+ - - '>='
190
+ - !ruby/object:Gem::Version
191
+ version: '0'
192
+ required_rubygems_version: !ruby/object:Gem::Requirement
193
+ requirements:
194
+ - - '>='
195
+ - !ruby/object:Gem::Version
196
+ version: '0'
197
+ requirements: []
198
+ rubyforge_project:
199
+ rubygems_version: 2.3.0
200
+ signing_key:
201
+ specification_version: 4
202
+ summary: A simple implementation of reliable Redis messaging.
203
+ test_files:
204
+ - spec/failure_spec.rb
205
+ - spec/fixtures/failure.json
206
+ - spec/fixtures/message.json
207
+ - spec/message_spec.rb
208
+ - spec/receiver_spec.rb
209
+ - spec/sender_spec.rb
210
+ - spec/spec_helper.rb
211
+ - spec/support/dummy.rb
212
+ - spec/support/futuristic.rb
213
+ - spec/tincan_spec.rb