redis_open3 0.0.1
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 +7 -0
- data/.gitignore +22 -0
- data/.rspec +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +80 -0
- data/Rakefile +2 -0
- data/lib/redis_open3/enum.rb +55 -0
- data/lib/redis_open3/version.rb +3 -0
- data/lib/redis_open3.rb +70 -0
- data/redis_open3.gemspec +26 -0
- data/spec/lib/redis_open3/enum_spec.rb +71 -0
- data/spec/lib/redis_open3_spec.rb +73 -0
- data/spec/spec_helper.rb +103 -0
- metadata +116 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 060a708ef7b2533866b91169cd1b2890500f7315
|
4
|
+
data.tar.gz: 370b16a073547778f1c8c66a03ea0d281c20907f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 39d569cdc09b5295fcc10c14ecb40d0faafed89548b5d936a3c678b123a631f0d453354aa10e9df91171a1c7a8f310bfc152dcb37f9fa3ef795449f444f0dc6e
|
7
|
+
data.tar.gz: e4e8d305f0fb35b8b77c69a21a6a1bb4d1e920941190adb79db01d704a8690e58a061604aa24eb4585bac0345d462859745e6169270f5ece947e4a735fe33d57
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Tyler Hartland
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,80 @@
|
|
1
|
+
# RedisOpen3
|
2
|
+
|
3
|
+
Provides Open3 like syntax for passing data through Redis.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'redis_open3'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install redis_open3
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Initialize a RedisOpen3 object giving a method which will yield redis connections.
|
22
|
+
```
|
23
|
+
# example using ConnectinPool gem
|
24
|
+
conn_pool = ConnectionPool.new(size: 9, timeout: 10) { Redis.new }
|
25
|
+
ropen3 = RedisOpen3.new(conn_pool.method(:with))
|
26
|
+
```
|
27
|
+
|
28
|
+
Use #popen3 to start passing data through Redis.
|
29
|
+
```
|
30
|
+
# example using RedisOpen3 to pass data to a different Sidekiq instance
|
31
|
+
ropen3.popen3 do |redis_in, redis_out, redis_err, uuids|
|
32
|
+
# start the foreign Sidekiq job
|
33
|
+
# The worker must be pre-configured to use a queue worked by the foreign process
|
34
|
+
ForeignWorker.perform_async(args, uuids)
|
35
|
+
|
36
|
+
# Then feed data across Redis
|
37
|
+
# Using threads allows true streaming between processes/workers
|
38
|
+
threads = [] << Thread.new do
|
39
|
+
input_data.each { |row| redis_in << row }
|
40
|
+
# Important to signal that we're done sending data
|
41
|
+
redis_in.close
|
42
|
+
end
|
43
|
+
|
44
|
+
# Catch your return data
|
45
|
+
threads << Thread.new do
|
46
|
+
redis_out.each { |row| output_file << row }
|
47
|
+
end
|
48
|
+
|
49
|
+
# Catch logging/error messages
|
50
|
+
threads << Thread.new do
|
51
|
+
redis_err.each { |row| log_file << row }
|
52
|
+
end
|
53
|
+
|
54
|
+
threads.each(&:join)
|
55
|
+
# You should have already closed redis_in yourself, but it will also be closed if you haven't
|
56
|
+
# redis_out and redis_err lists will be deleted
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
60
|
+
Use #process3 to receive input and return data
|
61
|
+
```
|
62
|
+
# This could be used as the body of the perform method on a Sidekiq worker
|
63
|
+
# Assumes uuids were send across as args
|
64
|
+
ropen3.process3(uuids) do |redis_in, redis_out, redis_err|
|
65
|
+
# Pull your input data from Redis
|
66
|
+
# And send your results back across Redis
|
67
|
+
redis_in.each { |row| redis_out << process(row) }
|
68
|
+
|
69
|
+
# Any exceptions raised from this block will be sent to redis_err
|
70
|
+
# redis_out and redis_err will be closed
|
71
|
+
# redis_in will be deleted
|
72
|
+
end
|
73
|
+
```
|
74
|
+
## Contributing
|
75
|
+
|
76
|
+
1. Fork it ( https://github.com/[my-github-username]/redis_open3/fork )
|
77
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
78
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
79
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
80
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,55 @@
|
|
1
|
+
require 'redis'
|
2
|
+
require 'redis_open3'
|
3
|
+
|
4
|
+
class RedisOpen3
|
5
|
+
class Enum
|
6
|
+
class TimeoutError < RedisOpen3::Error; end
|
7
|
+
|
8
|
+
include Enumerable
|
9
|
+
attr_reader :list_name
|
10
|
+
|
11
|
+
# magic :(
|
12
|
+
EOF = '90829c12-3ac3-4af9-aeb4-8b63d1cc1d23'
|
13
|
+
EOF_REGX = /\A#{EOF}\z/
|
14
|
+
|
15
|
+
def initialize(list_name, opts={})
|
16
|
+
@list_name = list_name
|
17
|
+
@timeout = opts[:timeout]
|
18
|
+
@redis = opts[:redis] || Redis.new(opts[:redis_opts] || {})
|
19
|
+
end
|
20
|
+
|
21
|
+
def <<(input)
|
22
|
+
push(input)
|
23
|
+
end
|
24
|
+
|
25
|
+
def close
|
26
|
+
push(EOF)
|
27
|
+
end
|
28
|
+
|
29
|
+
def each(&block)
|
30
|
+
Enumerator.new do |y|
|
31
|
+
until (line = pop.chomp) =~ EOF_REGX
|
32
|
+
y << line
|
33
|
+
end
|
34
|
+
end.each(&block)
|
35
|
+
end
|
36
|
+
|
37
|
+
def delete
|
38
|
+
@redis.del(list_name)
|
39
|
+
end
|
40
|
+
|
41
|
+
private
|
42
|
+
|
43
|
+
def push(string)
|
44
|
+
@redis.rpush(list_name, string)
|
45
|
+
end
|
46
|
+
|
47
|
+
def pop
|
48
|
+
if popped = @redis.blpop(list_name, @timeout)
|
49
|
+
popped.last
|
50
|
+
else
|
51
|
+
raise TimeoutError, "Timeout of #{@timeout.inspect} seconds expired on list_name #{list_name.inspect}."
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/redis_open3.rb
ADDED
@@ -0,0 +1,70 @@
|
|
1
|
+
require "redis_open3/version"
|
2
|
+
require 'redis'
|
3
|
+
|
4
|
+
class RedisOpen3
|
5
|
+
class Error < StandardError; end
|
6
|
+
|
7
|
+
IN_KEY = 'redis_open3_in'
|
8
|
+
OUT_KEY = 'redis_open3_out'
|
9
|
+
ERR_KEY = 'redis_open3_err'
|
10
|
+
|
11
|
+
def initialize(redis_pool, opts={})
|
12
|
+
@redis_pool = redis_pool
|
13
|
+
@timeout = opts[:timeout] || 900
|
14
|
+
end
|
15
|
+
|
16
|
+
def open3
|
17
|
+
with_enums(generated_uuids) do |redis_in, redis_out, redis_err, uuids|
|
18
|
+
begin
|
19
|
+
yield redis_in, redis_out, redis_err, uuids
|
20
|
+
ensure
|
21
|
+
redis_in.close
|
22
|
+
redis_out.delete
|
23
|
+
redis_err.delete
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def process3(uuids)
|
29
|
+
with_enums(uuids) do |redis_in, redis_out, redis_err|
|
30
|
+
begin
|
31
|
+
yield redis_in, redis_out, redis_err
|
32
|
+
rescue Exception => e
|
33
|
+
([e.inspect] + e.backtrace).each { |row| redis_err << row }
|
34
|
+
raise e
|
35
|
+
ensure
|
36
|
+
redis_in.delete
|
37
|
+
redis_out.close
|
38
|
+
redis_err.close
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
private
|
44
|
+
|
45
|
+
def with_conns
|
46
|
+
@redis_pool.call do |redis1|
|
47
|
+
@redis_pool.call do |redis2|
|
48
|
+
@redis_pool.call do |redis3|
|
49
|
+
yield redis1, redis2, redis3
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def with_enums(uuids)
|
56
|
+
with_conns do |redis1, redis2, redis3|
|
57
|
+
redis_in = Enum.new(uuids[IN_KEY], redis: redis1, timeout: @timeout)
|
58
|
+
redis_out = Enum.new(uuids[OUT_KEY], redis: redis2, timeout: @timeout)
|
59
|
+
redis_err = Enum.new(uuids[ERR_KEY], redis: redis3, timeout: @timeout)
|
60
|
+
yield redis_in, redis_out, redis_err, uuids
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def generated_uuids
|
65
|
+
[ IN_KEY, OUT_KEY, ERR_KEY ].inject({}) do |result, key|
|
66
|
+
result[key] = SecureRandom.uuid
|
67
|
+
result
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
data/redis_open3.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'redis_open3/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "redis_open3"
|
8
|
+
spec.version = RedisOpen3::VERSION
|
9
|
+
spec.authors = ["Tyler Hartland"]
|
10
|
+
spec.email = ["tyler.hartland@code42.com"]
|
11
|
+
spec.summary = %q{Use Open3 like sematics to pass data through Redis.}
|
12
|
+
# spec.description = %q{TODO: Write a longer description. Optional.}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency 'rspec', '~> 3.0.0'
|
24
|
+
|
25
|
+
spec.add_runtime_dependency 'redis', '~> 3.1.0'
|
26
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'redis_open3/enum'
|
2
|
+
|
3
|
+
describe RedisOpen3::Enum do
|
4
|
+
let(:list_name) { 'redis_open3:redis_enum:test_list' }
|
5
|
+
let(:enum) { RedisOpen3::Enum.new(list_name, redis: RedisConn.conn, timeout: 1) }
|
6
|
+
let(:eof) { RedisOpen3::Enum::EOF }
|
7
|
+
|
8
|
+
after { enum.delete }
|
9
|
+
|
10
|
+
describe '#<<' do
|
11
|
+
it 'adds an item to the redis list' do
|
12
|
+
RedisConn.with do |redis|
|
13
|
+
expect {
|
14
|
+
enum << 'test_item'
|
15
|
+
}.to change {
|
16
|
+
redis.lpop(list_name)
|
17
|
+
}.from(nil).to('test_item')
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
describe '#close' do
|
23
|
+
it 'adds the EOF uuid to the redis list' do
|
24
|
+
RedisConn.with do |redis|
|
25
|
+
expect {
|
26
|
+
enum.close
|
27
|
+
}.to change {
|
28
|
+
redis.lpop(list_name)
|
29
|
+
}.from(nil).to(eof)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#each' do
|
35
|
+
let(:expected_items) { ['item1', 'item2', 'item3'] }
|
36
|
+
|
37
|
+
it 'blocks until it can yield each item in the list' do
|
38
|
+
Thread.new do
|
39
|
+
RedisConn.with do |redis|
|
40
|
+
expected_items.each do |item|
|
41
|
+
redis.rpush(list_name, item)
|
42
|
+
sleep 0.02
|
43
|
+
end
|
44
|
+
redis.rpush(list_name, eof)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
found_items = enum.each.to_a
|
49
|
+
expected_items.each_with_index { |item, i| expect(found_items[i]).to eq item }
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe '#delete' do
|
54
|
+
it 'deletes the redis list' do
|
55
|
+
RedisConn.with do |redis|
|
56
|
+
enum << 'junk'
|
57
|
+
expect {
|
58
|
+
enum.delete
|
59
|
+
}.to change {
|
60
|
+
redis.exists(list_name)
|
61
|
+
}.from(true).to(false)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
context 'timeout' do
|
67
|
+
it 'raises a timeout error if the timeout expires' do
|
68
|
+
expect { enum.each.to_a }.to raise_error(RedisOpen3::Enum::TimeoutError)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
require 'redis_open3'
|
2
|
+
|
3
|
+
describe RedisOpen3 do
|
4
|
+
let(:ropen) { RedisOpen3.new(conns, timeout: 1) }
|
5
|
+
let(:conns) { RedisConn.method(:with) }
|
6
|
+
|
7
|
+
describe '#popen3' do
|
8
|
+
it 'yields 3 redis enum objects and an array with their list uuids' do
|
9
|
+
ropen.open3 do |r_in, r_out, r_err, uuids|
|
10
|
+
expect(uuids[RedisOpen3::IN_KEY]).to eq r_in.list_name
|
11
|
+
expect(uuids[RedisOpen3::OUT_KEY]).to eq r_out.list_name
|
12
|
+
expect(uuids[RedisOpen3::ERR_KEY]).to eq r_err.list_name
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it 'sends EOF to redis in enum after block closes' do
|
17
|
+
r_in = nil
|
18
|
+
ropen.open3 { |redis_in| r_in = redis_in }
|
19
|
+
expect(r_in.each.to_a).to eq []
|
20
|
+
end
|
21
|
+
|
22
|
+
it 'deletes the redis_out and redis_err list' do
|
23
|
+
out_name = nil
|
24
|
+
err_name = nil
|
25
|
+
conns.call do |redis|
|
26
|
+
ropen.open3 do |_, redis_out, redis_err|
|
27
|
+
out_name = redis_out.list_name
|
28
|
+
err_name = redis_err.list_name
|
29
|
+
redis_out << 'junk'
|
30
|
+
redis_err << 'junk'
|
31
|
+
expect(redis.exists(out_name)).to eq true
|
32
|
+
expect(redis.exists(err_name)).to eq true
|
33
|
+
end
|
34
|
+
expect(redis.exists(out_name)).to eq false
|
35
|
+
expect(redis.exists(err_name)).to eq false
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
describe '#process3' do
|
41
|
+
let(:uuids) {{
|
42
|
+
RedisOpen3::IN_KEY => SecureRandom.uuid,
|
43
|
+
RedisOpen3::OUT_KEY => SecureRandom.uuid,
|
44
|
+
RedisOpen3::ERR_KEY => SecureRandom.uuid
|
45
|
+
}}
|
46
|
+
|
47
|
+
it 'yields 3 redis enum objects with given list names' do
|
48
|
+
ropen.process3(uuids) do |r_in, r_out, r_err|
|
49
|
+
expect(r_in.list_name).to eq uuids[RedisOpen3::IN_KEY]
|
50
|
+
expect(r_out.list_name).to eq uuids[RedisOpen3::OUT_KEY]
|
51
|
+
expect(r_err.list_name).to eq uuids[RedisOpen3::ERR_KEY]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
it 'sends EOF to redis out and redis err enums after block closes' do
|
56
|
+
r_out = nil
|
57
|
+
r_err = nil
|
58
|
+
ropen.process3(uuids) { |_, redis_out, redis_err| r_out = redis_out; r_err = redis_err }
|
59
|
+
expect(r_out.each.to_a).to eq []
|
60
|
+
expect(r_err.each.to_a).to eq []
|
61
|
+
end
|
62
|
+
|
63
|
+
it 'deletes the redis_in list' do
|
64
|
+
conns.call do |redis|
|
65
|
+
ropen.process3(uuids) do |redis_in|
|
66
|
+
redis_in << 'junk'
|
67
|
+
expect(redis.exists(uuids[RedisOpen3::IN_KEY])).to eq true
|
68
|
+
end
|
69
|
+
expect(redis.exists(uuids[RedisOpen3::IN_KEY])).to eq false
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
lib_path = "#{File.dirname(__FILE__)}/../lib"
|
2
|
+
$LOAD_PATH << lib_path unless $LOAD_PATH.include?(lib_path)
|
3
|
+
|
4
|
+
class RedisConn
|
5
|
+
def self.with
|
6
|
+
redis = new_conn
|
7
|
+
yield redis
|
8
|
+
redis.quit
|
9
|
+
end
|
10
|
+
|
11
|
+
def self.conn
|
12
|
+
new_conn
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.flushdb
|
16
|
+
with { |redis| redis.flushdb }
|
17
|
+
end
|
18
|
+
|
19
|
+
private
|
20
|
+
|
21
|
+
def self.new_conn
|
22
|
+
Redis.new(db: 14)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
26
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
27
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause this
|
28
|
+
# file to always be loaded, without a need to explicitly require it in any files.
|
29
|
+
#
|
30
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
31
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
32
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
33
|
+
# individual file that may not need all of that loaded. Instead, make a
|
34
|
+
# separate helper file that requires this one and then use it only in the specs
|
35
|
+
# that actually need it.
|
36
|
+
#
|
37
|
+
# The `.rspec` file also contains a few flags that are not defaults but that
|
38
|
+
# users commonly want.
|
39
|
+
#
|
40
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
41
|
+
RSpec.configure do |config|
|
42
|
+
config.after(:suite) { RedisConn.flushdb }
|
43
|
+
# The settings below are suggested to provide a good initial experience
|
44
|
+
# with RSpec, but feel free to customize to your heart's content.
|
45
|
+
|
46
|
+
# These two settings work together to allow you to limit a spec run
|
47
|
+
# to individual examples or groups you care about by tagging them with
|
48
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
49
|
+
# get run.
|
50
|
+
config.filter_run :focus
|
51
|
+
config.run_all_when_everything_filtered = true
|
52
|
+
|
53
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
54
|
+
# file, and it's useful to allow more verbose output when running an
|
55
|
+
# individual spec file.
|
56
|
+
if config.files_to_run.one?
|
57
|
+
# Use the documentation formatter for detailed output,
|
58
|
+
# unless a formatter has already been configured
|
59
|
+
# (e.g. via a command-line flag).
|
60
|
+
config.default_formatter = 'doc'
|
61
|
+
end
|
62
|
+
|
63
|
+
# Print the 10 slowest examples and example groups at the
|
64
|
+
# end of the spec run, to help surface which specs are running
|
65
|
+
# particularly slow.
|
66
|
+
config.profile_examples = 10
|
67
|
+
|
68
|
+
# Run specs in random order to surface order dependencies. If you find an
|
69
|
+
# order dependency and want to debug it, you can fix the order by providing
|
70
|
+
# the seed, which is printed after each run.
|
71
|
+
# --seed 1234
|
72
|
+
config.order = :random
|
73
|
+
|
74
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
75
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
76
|
+
# test failures related to randomization by passing the same `--seed` value
|
77
|
+
# as the one that triggered the failure.
|
78
|
+
Kernel.srand config.seed
|
79
|
+
|
80
|
+
# rspec-expectations config goes here. You can use an alternate
|
81
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
82
|
+
# assertions if you prefer.
|
83
|
+
config.expect_with :rspec do |expectations|
|
84
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
85
|
+
# For more details, see:
|
86
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
87
|
+
expectations.syntax = :expect
|
88
|
+
end
|
89
|
+
|
90
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
91
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
92
|
+
config.mock_with :rspec do |mocks|
|
93
|
+
# Enable only the newer, non-monkey-patching expect syntax.
|
94
|
+
# For more details, see:
|
95
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
96
|
+
mocks.syntax = :expect
|
97
|
+
|
98
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
99
|
+
# a real object. This is generally recommended.
|
100
|
+
mocks.verify_partial_doubles = true
|
101
|
+
end
|
102
|
+
|
103
|
+
end
|
metadata
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: redis_open3
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Tyler Hartland
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-08-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 3.0.0
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 3.0.0
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: redis
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.1.0
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.1.0
|
69
|
+
description:
|
70
|
+
email:
|
71
|
+
- tyler.hartland@code42.com
|
72
|
+
executables: []
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- ".gitignore"
|
77
|
+
- ".rspec"
|
78
|
+
- Gemfile
|
79
|
+
- LICENSE.txt
|
80
|
+
- README.md
|
81
|
+
- Rakefile
|
82
|
+
- lib/redis_open3.rb
|
83
|
+
- lib/redis_open3/enum.rb
|
84
|
+
- lib/redis_open3/version.rb
|
85
|
+
- redis_open3.gemspec
|
86
|
+
- spec/lib/redis_open3/enum_spec.rb
|
87
|
+
- spec/lib/redis_open3_spec.rb
|
88
|
+
- spec/spec_helper.rb
|
89
|
+
homepage: ''
|
90
|
+
licenses:
|
91
|
+
- MIT
|
92
|
+
metadata: {}
|
93
|
+
post_install_message:
|
94
|
+
rdoc_options: []
|
95
|
+
require_paths:
|
96
|
+
- lib
|
97
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - ">="
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
102
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
requirements: []
|
108
|
+
rubyforge_project:
|
109
|
+
rubygems_version: 2.1.11
|
110
|
+
signing_key:
|
111
|
+
specification_version: 4
|
112
|
+
summary: Use Open3 like sematics to pass data through Redis.
|
113
|
+
test_files:
|
114
|
+
- spec/lib/redis_open3/enum_spec.rb
|
115
|
+
- spec/lib/redis_open3_spec.rb
|
116
|
+
- spec/spec_helper.rb
|