bumbleworks-sequel 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 +18 -0
- data/.rspec +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +30 -0
- data/Rakefile +9 -0
- data/bumbleworks-sequel.gemspec +28 -0
- data/lib/bumbleworks/sequel.rb +7 -0
- data/lib/bumbleworks/sequel/adapter.rb +22 -0
- data/lib/bumbleworks/sequel/version.rb +5 -0
- data/spec/lib/bumbleworks/ruote_spec.rb +32 -0
- data/spec/lib/bumbleworks/sequel/adapter_spec.rb +52 -0
- data/spec/spec_helper.rb +19 -0
- metadata +160 -0
data/.gitignore
ADDED
data/.rspec
ADDED
data/Gemfile
ADDED
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 any database that [Sequel](http://redis.io) supports 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-sequel'
|
10
|
+
|
11
|
+
## Usage
|
12
|
+
|
13
|
+
Set Bumbleworks.storage to a Sequel database connection. You can use Sequel.connect for this. In a configure block, this looks like:
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
Bumbleworks.configure do |c|
|
17
|
+
c.storage = Sequel.connect('postgres://user:password@host:port/database_name')
|
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,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/sequel/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bumbleworks-sequel"
|
8
|
+
spec.version = Bumbleworks::Sequel::VERSION
|
9
|
+
spec.authors = ["Ravi Gadad"]
|
10
|
+
spec.email = ["ravi@renewfund.com"]
|
11
|
+
spec.description = %q{Sequel support for Bumbleworks process storage}
|
12
|
+
spec.summary = %q{This gem allows you to use any of a number of RDBMSes (via the Sequel ORM) 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-sequel"
|
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,22 @@
|
|
1
|
+
require "bumbleworks/storage_adapter"
|
2
|
+
require "ruote-sequel"
|
3
|
+
|
4
|
+
module Bumbleworks
|
5
|
+
module Sequel
|
6
|
+
class Adapter < Bumbleworks::StorageAdapter
|
7
|
+
class << self
|
8
|
+
def driver
|
9
|
+
::Ruote::Sequel::Storage
|
10
|
+
end
|
11
|
+
|
12
|
+
def storage_class
|
13
|
+
::Sequel
|
14
|
+
end
|
15
|
+
|
16
|
+
def use?(storage)
|
17
|
+
storage.class.name =~ /^#{storage_class}/
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'bumbleworks'
|
2
|
+
|
3
|
+
describe Bumbleworks::Ruote do
|
4
|
+
before :each do
|
5
|
+
Bumbleworks.reset!
|
6
|
+
Bumbleworks::Sequel::Adapter.auto_register = false
|
7
|
+
end
|
8
|
+
|
9
|
+
it 'does not support Sequel storage before adapter is added' do
|
10
|
+
storage = Sequel.connect('mock://ninja/turtles')
|
11
|
+
Bumbleworks.storage = storage
|
12
|
+
expect {
|
13
|
+
described_class.send(:storage)
|
14
|
+
}.to raise_error(Bumbleworks::UndefinedSetting)
|
15
|
+
end
|
16
|
+
|
17
|
+
it 'supports Sequel storage after adapter is added' do
|
18
|
+
Bumbleworks.configuration.add_storage_adapter(Bumbleworks::Sequel::Adapter)
|
19
|
+
storage = Sequel.connect('mock://ninja/turtles')
|
20
|
+
Bumbleworks.storage = storage
|
21
|
+
Ruote::Sequel::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::Sequel::Adapter)
|
27
|
+
Bumbleworks.storage = :a_frog
|
28
|
+
expect {
|
29
|
+
described_class.send(:storage)
|
30
|
+
}.to raise_error(Bumbleworks::UndefinedSetting, /Sequel/)
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'bumbleworks'
|
2
|
+
|
3
|
+
describe Bumbleworks::Sequel::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 Sequel' do
|
43
|
+
described_class.use?(Sequel.connect('mock://ninja/turtles')).should be_true
|
44
|
+
end
|
45
|
+
|
46
|
+
it 'returns false if given storage class does not match Sequel' do
|
47
|
+
described_class.use?({}).should be_false
|
48
|
+
described_class.use?(nil).should be_false
|
49
|
+
described_class.use?('Sequel').should be_false
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -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/sequel'
|
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,160 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bumbleworks-sequel
|
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-15 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-sequel
|
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: Sequel 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
|
+
- Gemfile
|
120
|
+
- LICENSE.txt
|
121
|
+
- README.md
|
122
|
+
- Rakefile
|
123
|
+
- bumbleworks-sequel.gemspec
|
124
|
+
- lib/bumbleworks/sequel.rb
|
125
|
+
- lib/bumbleworks/sequel/adapter.rb
|
126
|
+
- lib/bumbleworks/sequel/version.rb
|
127
|
+
- spec/lib/bumbleworks/ruote_spec.rb
|
128
|
+
- spec/lib/bumbleworks/sequel/adapter_spec.rb
|
129
|
+
- spec/spec_helper.rb
|
130
|
+
homepage: ''
|
131
|
+
licenses:
|
132
|
+
- MIT
|
133
|
+
post_install_message:
|
134
|
+
rdoc_options: []
|
135
|
+
require_paths:
|
136
|
+
- lib
|
137
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
138
|
+
none: false
|
139
|
+
requirements:
|
140
|
+
- - ! '>='
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0'
|
143
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
+
none: false
|
145
|
+
requirements:
|
146
|
+
- - ! '>='
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
requirements: []
|
150
|
+
rubyforge_project:
|
151
|
+
rubygems_version: 1.8.23
|
152
|
+
signing_key:
|
153
|
+
specification_version: 3
|
154
|
+
summary: This gem allows you to use any of a number of RDBMSes (via the Sequel ORM)
|
155
|
+
for your Bumbleworks process storage.
|
156
|
+
test_files:
|
157
|
+
- spec/lib/bumbleworks/ruote_spec.rb
|
158
|
+
- spec/lib/bumbleworks/sequel/adapter_spec.rb
|
159
|
+
- spec/spec_helper.rb
|
160
|
+
has_rdoc:
|