shard_handler 0.1.4 → 0.1.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: b73438164d74c6049b163a1f0b61dc62585a3fcb
4
- data.tar.gz: 5dfdcf6cae3e106d57aed21e7d07a6150daed604
3
+ metadata.gz: 06f210d21de1ef1056745ae9f2fb5efa0c2ccde9
4
+ data.tar.gz: dc1ef604949718dd7591fea00ae662e6c4d1b95e
5
5
  SHA512:
6
- metadata.gz: 3e95086eb004cabb1bf3a8872e966b4b32102e479cfd82e62fa992674cc4a6742d8651626fd3a7898990197f8039ac2c0f4a3c6c5e40a0bb427c5b5f07ffa13f
7
- data.tar.gz: 5f1993cd1f41e851dd3cb7f51fca8ece2398d8c5c5dcfc3eeec56e532b687921dd0d3b4bf138952c65c8c70ff4c78a3f282baa95602028113c5149cd6f694dad
6
+ metadata.gz: 789b104dbc989d93371d72a557b08d43aad98dca1edf17c824da0e2dfe4479ba15ed7810bbd633fd0a9710e267c7208af13a894962099b584604665f42c79936
7
+ data.tar.gz: 862bf172acdb194a0da5acd1f30d309385ef60d62ee7e7f4d06d2a7541f080012de7843b5ad78142a3e979efc133bf1a9fdcda9b5365a4effa56e2a546934b2b
@@ -80,10 +80,15 @@ module ShardHandler
80
80
  self.current_shard = shard
81
81
  yield
82
82
  ensure
83
- # Returns any connections in use by the current thread back to the pool.
84
- # It must be executed before changing the shard name back to its
85
- # old value.
86
- self.clear_active_connections!
83
+ # Returns any connections in use back to the pool. It is executed only
84
+ # if the shard name is different from the old one because one can call
85
+ # .using multiple times in a chain, like this:
86
+ #
87
+ # using(:shard1) do
88
+ # using(:shard1) do
89
+ # end
90
+ # end
91
+ self.clear_active_connections! if old_shard != current_shard
87
92
  self.current_shard = old_shard
88
93
  end
89
94
 
@@ -1,3 +1,3 @@
1
1
  module ShardHandler
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.5'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shard_handler
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lenon Marcel
@@ -9,9 +9,9 @@ authors:
9
9
  - Lucas Nogueira
10
10
  - Rodolfo Liviero
11
11
  autorequire:
12
- bindir: exe
12
+ bindir: bin
13
13
  cert_chain: []
14
- date: 2015-07-30 00:00:00.000000000 Z
14
+ date: 2015-08-03 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: activerecord
@@ -111,7 +111,7 @@ dependencies:
111
111
  - - ">="
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
- description: This gem is a simple sharding solution for Rails applications
114
+ description: A simple sharding solution for Rails applications
115
115
  email:
116
116
  - lenon.marcel@gmail.com
117
117
  - rafaeltimbosoares@gmail.com
@@ -121,22 +121,14 @@ executables: []
121
121
  extensions: []
122
122
  extra_rdoc_files: []
123
123
  files:
124
- - ".gitignore"
125
- - ".rspec"
126
- - ".travis.yml"
127
- - Gemfile
128
124
  - LICENSE.txt
129
125
  - README.md
130
- - Rakefile
131
- - bin/console
132
- - bin/setup
133
126
  - lib/shard_handler.rb
134
127
  - lib/shard_handler/errors.rb
135
128
  - lib/shard_handler/handler.rb
136
129
  - lib/shard_handler/model.rb
137
130
  - lib/shard_handler/thread_registry.rb
138
131
  - lib/shard_handler/version.rb
139
- - shard_handler.gemspec
140
132
  homepage: https://github.com/locaweb/shard_handler
141
133
  licenses:
142
134
  - MIT
@@ -160,6 +152,6 @@ rubyforge_project:
160
152
  rubygems_version: 2.4.6
161
153
  signing_key:
162
154
  specification_version: 4
163
- summary: This gem is a simple sharding solution for Rails applications
155
+ summary: A simple sharding solution for Rails applications
164
156
  test_files: []
165
157
  has_rdoc:
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
10
- /spec/database.yml
11
- /spec/shards.yml
data/.rspec DELETED
@@ -1,2 +0,0 @@
1
- --color
2
- --require spec_helper
@@ -1,12 +0,0 @@
1
- language: ruby
2
- rvm:
3
- - 2.1.6
4
- - 2.2.2
5
- addons:
6
- postgresql: "9.3"
7
- before_install: gem install bundler -v 1.10.5
8
- before_script:
9
- - cp spec/database.yml.travis spec/database.yml
10
- - cp spec/shards.yml.travis spec/shards.yml
11
- script:
12
- - bundle exec rake spec
data/Gemfile DELETED
@@ -1,6 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in shard_handler.gemspec
4
- gemspec
5
-
6
- gem 'codeclimate-test-reporter', group: :test, require: nil
data/Rakefile DELETED
@@ -1,6 +0,0 @@
1
- require 'bundler/gem_tasks'
2
- require 'rspec/core/rake_task'
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task default: :spec
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require 'bundler/setup'
4
- require 'shard_handler'
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require 'irb'
14
- IRB.start
data/bin/setup DELETED
@@ -1,7 +0,0 @@
1
- #!/bin/bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
-
5
- bundle install
6
-
7
- # Do any other automated setup that you need to do here
@@ -1,31 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'shard_handler/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = 'shard_handler'
8
- spec.version = ShardHandler::VERSION
9
- spec.authors = ['Lenon Marcel', 'Rafael Timbó', 'Lucas Nogueira',
10
- 'Rodolfo Liviero']
11
- spec.email = ['lenon.marcel@gmail.com', 'rafaeltimbosoares@gmail.com',
12
- 'lukspn.27@gmail.com', 'rodolfoliviero@gmail.com']
13
- spec.summary = 'This gem is a simple sharding solution for Rails applications'
14
- spec.description = 'This gem is a simple sharding solution for Rails applications'
15
- spec.homepage = 'https://github.com/locaweb/shard_handler'
16
- spec.license = 'MIT'
17
-
18
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
19
- spec.bindir = 'exe'
20
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
- spec.require_paths = ['lib']
22
-
23
- spec.add_dependency 'activerecord', '~> 4.2.0'
24
- spec.add_dependency 'activesupport', '~> 4.2.0'
25
-
26
- spec.add_development_dependency 'bundler', '~> 1.10'
27
- spec.add_development_dependency 'rake', '~> 10.0'
28
- spec.add_development_dependency 'rspec'
29
- spec.add_development_dependency 'pg'
30
- spec.add_development_dependency 'yard'
31
- end