bumbleworks-redis 0.0.2

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.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
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
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --color
2
+ --format=nested
3
+ --require spec_helper
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 1.9.3-p392
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in bumbleworks-redis.gemspec
4
+ gemspec
data/LICENSE.txt ADDED
@@ -0,0 +1,22 @@
1
+ Copyright (c) 2013 Bumbleworks
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,30 @@
1
+ # Bumbleworks::Redis
2
+
3
+ Allows you to use a [Redis](http://redis.io) database for your [Bumbleworks](http://github.com/bumbleworks/bumbleworks) process storage. Just including this gem in your gemfile will automatically register the adapter by default.
4
+
5
+ ## Installation
6
+
7
+ Add this line to your application's Gemfile:
8
+
9
+ gem 'bumbleworks-redis'
10
+
11
+ ## Usage
12
+
13
+ Set Bumbleworks.storage to a Redis instance. In a configure block, this looks like:
14
+
15
+ ```ruby
16
+ Bumbleworks.configure do |c|
17
+ c.storage = Redis.new(:host => '127.0.0.1', :db => 0, :thread_safe => true)
18
+ # ...
19
+ end
20
+ ```
21
+
22
+ Happy bumbling!
23
+
24
+ ## Contributing
25
+
26
+ 1. Fork it
27
+ 2. Create your feature branch (`git checkout -b my-new-feature`)
28
+ 3. Commit your changes (`git commit -am 'Add some feature'`)
29
+ 4. Push to the branch (`git push origin my-new-feature`)
30
+ 5. Create new Pull Request
data/Rakefile ADDED
@@ -0,0 +1,9 @@
1
+ require "bundler/gem_tasks"
2
+
3
+ require 'rspec/core/rake_task'
4
+
5
+ RSpec::Core::RakeTask.new(:spec)
6
+
7
+ task :default => [:spec]
8
+
9
+ Rake::TaskManager.record_task_metadata = true
@@ -0,0 +1,28 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'bumbleworks/redis/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "bumbleworks-redis"
8
+ spec.version = Bumbleworks::Redis::VERSION
9
+ spec.authors = ["Ravi Gadad"]
10
+ spec.email = ["ravi@renewfund.com"]
11
+ spec.description = %q{Redis support for Bumbleworks process storage}
12
+ spec.summary = %q{This gem allows you to use a Redis database for your Bumbleworks process storage.}
13
+ spec.homepage = ""
14
+ spec.license = "MIT"
15
+
16
+ spec.files = `git ls-files`.split($/)
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_runtime_dependency "bumbleworks"
22
+ spec.add_runtime_dependency "ruote-redis"
23
+
24
+ spec.add_development_dependency "bundler", "~> 1.3"
25
+ spec.add_development_dependency "rake"
26
+ spec.add_development_dependency 'rspec'
27
+ spec.add_development_dependency 'simplecov'
28
+ end
@@ -0,0 +1,7 @@
1
+ require "bumbleworks/redis/version"
2
+ require "bumbleworks/redis/adapter"
3
+
4
+ module Bumbleworks
5
+ module Redis
6
+ end
7
+ end
@@ -0,0 +1,18 @@
1
+ require "bumbleworks/storage_adapter"
2
+ require "ruote-redis"
3
+
4
+ module Bumbleworks
5
+ module Redis
6
+ class Adapter < Bumbleworks::StorageAdapter
7
+ class << self
8
+ def driver
9
+ ::Ruote::Redis::Storage
10
+ end
11
+
12
+ def storage_class
13
+ ::Redis
14
+ end
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,5 @@
1
+ module Bumbleworks
2
+ module Redis
3
+ VERSION = "0.0.2"
4
+ end
5
+ end
@@ -0,0 +1,52 @@
1
+ require 'bumbleworks'
2
+
3
+ describe Bumbleworks::Redis::Adapter do
4
+ before :each do
5
+ Bumbleworks.reset!
6
+ end
7
+
8
+ describe 'when added to configuration' do
9
+ it 'adds storage adapter to Bumbleworks' do
10
+ described_class.stub(:auto_register?).and_return(false)
11
+ Bumbleworks.configuration.storage_adapters.should_not include(described_class)
12
+ Bumbleworks.configuration.add_storage_adapter(described_class)
13
+ Bumbleworks.configuration.storage_adapters.should include(described_class)
14
+ end
15
+ end
16
+
17
+ describe 'when auto_register is true' do
18
+ it 'is already automatically added to configuration' do
19
+ described_class.stub(:auto_register?).and_return(true)
20
+ Bumbleworks.configuration.storage_adapters.should include(described_class)
21
+ end
22
+ end
23
+
24
+ describe '.auto_register?' do
25
+ it 'returns true if auto_register is true' do
26
+ described_class.auto_register = true
27
+ described_class.auto_register?.should be_true
28
+ end
29
+
30
+ it 'returns false if auto_register is not true' do
31
+ described_class.auto_register = :ghosts
32
+ described_class.auto_register?.should be_false
33
+ end
34
+
35
+ it 'is true by default' do
36
+ described_class.auto_register = nil
37
+ described_class.auto_register?.should be_true
38
+ end
39
+ end
40
+
41
+ describe 'use?' do
42
+ it 'returns true if given storage class matches Redis' do
43
+ described_class.use?(Redis.new).should be_true
44
+ end
45
+
46
+ it 'returns false if given storage class does not match Redis' do
47
+ described_class.use?({}).should be_false
48
+ described_class.use?(nil).should be_false
49
+ described_class.use?('Redis').should be_false
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,32 @@
1
+ require 'bumbleworks'
2
+
3
+ describe Bumbleworks::Ruote do
4
+ before :each do
5
+ Bumbleworks.reset!
6
+ Bumbleworks::Redis::Adapter.auto_register = false
7
+ end
8
+
9
+ it 'does not support Redis storage before adapter is added' do
10
+ storage = Redis.new
11
+ Bumbleworks.storage = storage
12
+ expect {
13
+ described_class.send(:storage)
14
+ }.to raise_error(Bumbleworks::UndefinedSetting)
15
+ end
16
+
17
+ it 'supports Redis storage after adapter is added' do
18
+ Bumbleworks.configuration.add_storage_adapter(Bumbleworks::Redis::Adapter)
19
+ storage = Redis.new
20
+ Bumbleworks.storage = storage
21
+ Ruote::Redis::Storage.should_receive(:new).with(storage)
22
+ described_class.send(:storage)
23
+ end
24
+
25
+ it 'adds itself to error message for unsupported storages' do
26
+ Bumbleworks.configuration.add_storage_adapter(Bumbleworks::Redis::Adapter)
27
+ Bumbleworks.storage = :a_frog
28
+ expect {
29
+ described_class.send(:storage)
30
+ }.to raise_error(Bumbleworks::UndefinedSetting, /Redis/)
31
+ end
32
+ end
@@ -0,0 +1,19 @@
1
+ require 'simplecov'
2
+ SimpleCov.start
3
+
4
+ # Requires supporting ruby files with custom matchers and macros, etc,
5
+ # in spec/support/ and its subdirectories.
6
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
7
+
8
+ require_relative '../lib/bumbleworks/redis'
9
+
10
+ RSpec.configure do |config|
11
+ config.treat_symbols_as_metadata_keys_with_true_values = true
12
+ config.run_all_when_everything_filtered = true
13
+
14
+ # Run specs in random order to surface order dependencies. If you find an
15
+ # order dependency and want to debug it, you can fix the order by providing
16
+ # the seed, which is printed after each run.
17
+ # --seed 1234
18
+ config.order = 'random'
19
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bumbleworks-redis
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Ravi Gadad
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-05-14 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bumbleworks
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ - !ruby/object:Gem::Dependency
31
+ name: ruote-redis
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ! '>='
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ type: :runtime
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: bundler
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: '1.3'
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '1.3'
62
+ - !ruby/object:Gem::Dependency
63
+ name: rake
64
+ requirement: !ruby/object:Gem::Requirement
65
+ none: false
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ type: :development
71
+ prerelease: false
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
78
+ - !ruby/object:Gem::Dependency
79
+ name: rspec
80
+ requirement: !ruby/object:Gem::Requirement
81
+ none: false
82
+ requirements:
83
+ - - ! '>='
84
+ - !ruby/object:Gem::Version
85
+ version: '0'
86
+ type: :development
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: simplecov
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: '0'
102
+ type: :development
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: '0'
110
+ description: Redis support for Bumbleworks process storage
111
+ email:
112
+ - ravi@renewfund.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - .gitignore
118
+ - .rspec
119
+ - .ruby-version
120
+ - Gemfile
121
+ - LICENSE.txt
122
+ - README.md
123
+ - Rakefile
124
+ - bumbleworks-redis.gemspec
125
+ - lib/bumbleworks/redis.rb
126
+ - lib/bumbleworks/redis/adapter.rb
127
+ - lib/bumbleworks/redis/version.rb
128
+ - spec/lib/bumbleworks/redis/adapter_spec.rb
129
+ - spec/lib/bumbleworks/ruote_spec.rb
130
+ - spec/spec_helper.rb
131
+ homepage: ''
132
+ licenses:
133
+ - MIT
134
+ post_install_message:
135
+ rdoc_options: []
136
+ require_paths:
137
+ - lib
138
+ required_ruby_version: !ruby/object:Gem::Requirement
139
+ none: false
140
+ requirements:
141
+ - - ! '>='
142
+ - !ruby/object:Gem::Version
143
+ version: '0'
144
+ segments:
145
+ - 0
146
+ hash: -3017453694027102814
147
+ required_rubygems_version: !ruby/object:Gem::Requirement
148
+ none: false
149
+ requirements:
150
+ - - ! '>='
151
+ - !ruby/object:Gem::Version
152
+ version: '0'
153
+ segments:
154
+ - 0
155
+ hash: -3017453694027102814
156
+ requirements: []
157
+ rubyforge_project:
158
+ rubygems_version: 1.8.23
159
+ signing_key:
160
+ specification_version: 3
161
+ summary: This gem allows you to use a Redis database for your Bumbleworks process
162
+ storage.
163
+ test_files:
164
+ - spec/lib/bumbleworks/redis/adapter_spec.rb
165
+ - spec/lib/bumbleworks/ruote_spec.rb
166
+ - spec/spec_helper.rb