switchman 1.9.2 → 1.9.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fa3506567faae98c3df18544db429163ea0aed03
4
- data.tar.gz: 8f354e57d9ce1342ce2f369a13fe485f92f6dcfa
3
+ metadata.gz: dd6a78ff6974c70fd495154833ff83a7b1408d89
4
+ data.tar.gz: a6ba5ec6032e7b82d808115cc09ce37d10a89b09
5
5
  SHA512:
6
- metadata.gz: 4a9c5fb4a816d4e76f2991b5d39b23182c055d34771016edaeb181dda77c1f0c99c542d23fad4629b7d3ccc2202fa7954faf38b0006f76a333817a7b6e6dbd7b
7
- data.tar.gz: 2e05febfa8a714552cbb27cdb0fb223d5c8442de344fb3cba606a5c4a566cac6a47df34d362991524ed5a0591a6d3e188666a33cbf3ab7b0874187488c2035d9
6
+ metadata.gz: 9a3a696130257d94b959fd6ef57e200196fe9993aa066a356b6ebde4ef56076ac342bbd8bc866eb45e1e0c9cd3229201972b039a02f209b258ecc2788fabfa6a
7
+ data.tar.gz: ce87fe2d582572246d05c7761b61fd3b4b1ce7dc49d90e0cf9037de78edfd73e67ba7641c87e6737320aca0b2ac30e8191d570f45ca82454ff045fc77dfc6158
@@ -8,4 +8,4 @@ ActiveRecord::Base
8
8
  # we need to make sure we define the class someone wanted (in which case
9
9
  # AR's on_load hook won't be called either yet, and establish_connection
10
10
  # will be safe)
11
- require 'switchman/shard_internal'
11
+ require_dependency 'switchman/shard_internal'
@@ -2,7 +2,7 @@ module Switchman
2
2
  class Engine < ::Rails::Engine
3
3
  isolate_namespace Switchman
4
4
 
5
- config.autoload_once_paths << File.expand_path(File.join(__FILE__, "../../../app/models"))
5
+ config.autoload_once_paths << File.expand_path("app/models", config.paths.path)
6
6
 
7
7
  def self.lookup_stores(cache_store_config)
8
8
  result = {}
@@ -87,7 +87,7 @@ module Switchman
87
87
  require "switchman/call_super"
88
88
  require "switchman/rails"
89
89
  require "switchman/shackles/relation"
90
- require "switchman/shard_internal"
90
+ require_dependency "switchman/shard_internal"
91
91
  require "switchman/standard_error"
92
92
 
93
93
  ::StandardError.include(StandardError)
@@ -118,7 +118,7 @@ module Switchman
118
118
  klass.before do
119
119
  raise "Sharding did not set up correctly" if @@sharding_failed
120
120
  Shard.clear_cache
121
- if use_transactional_fixtures
121
+ if (::Rails.version >= '5' && use_transactional_tests) || use_transactional_fixtures
122
122
  Shard.default(true)
123
123
  @shard1 = Shard.find(@shard1.id)
124
124
  @shard2 = Shard.find(@shard2.id)
@@ -134,7 +134,7 @@ module Switchman
134
134
 
135
135
  klass.after do
136
136
  next if @@sharding_failed
137
- if use_transactional_fixtures
137
+ if (::Rails.version >= '5' && use_transactional_tests) || use_transactional_fixtures
138
138
  shards = [@shard2]
139
139
  shards << @shard1 unless @shard1.database_server == Shard.default.database_server
140
140
  shards.each do |shard|
@@ -1,3 +1,3 @@
1
1
  module Switchman
2
- VERSION = "1.9.2"
2
+ VERSION = "1.9.3"
3
3
  end
@@ -60,21 +60,23 @@ module Switchman
60
60
  end
61
61
 
62
62
  ::Shackles.activate(:deploy) do
63
- begin
64
- categories = categories.call if categories.respond_to?(:call)
65
- Shard.with_each_shard(scope, categories, options) do
66
- shard = Shard.current
67
- puts "#{shard.id}: #{shard.description}"
68
- ::ActiveRecord::Base.connection_pool.spec.config[:shard_name] = Shard.current.name
69
- ::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys
70
- shard.database_server.unshackle do
71
- old_actions.each { |action| action.call(*task_args) }
63
+ Shard.default.database_server.unshackle do
64
+ begin
65
+ categories = categories.call if categories.respond_to?(:call)
66
+ Shard.with_each_shard(scope, categories, options) do
67
+ shard = Shard.current
68
+ puts "#{shard.id}: #{shard.description}"
69
+ ::ActiveRecord::Base.connection_pool.spec.config[:shard_name] = Shard.current.name
70
+ ::ActiveRecord::Base.configurations[::Rails.env] = ::ActiveRecord::Base.connection_pool.spec.config.stringify_keys
71
+ shard.database_server.unshackle do
72
+ old_actions.each { |action| action.call(*task_args) }
73
+ end
74
+ nil
72
75
  end
73
- nil
76
+ rescue => e
77
+ puts "Exception from #{e.current_shard.id}: #{e.current_shard.description}" if options[:parallel] != 0
78
+ raise
74
79
  end
75
- rescue => e
76
- puts "Exception from #{e.current_shard.id}: #{e.current_shard.description}" if options[:parallel] != 0
77
- raise
78
80
  end
79
81
  end
80
82
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: switchman
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.9.2
4
+ version: 1.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cody Cutrer
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-12-13 00:00:00.000000000 Z
13
+ date: 2017-02-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: railties
@@ -108,20 +108,6 @@ dependencies:
108
108
  - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: mysql2
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - "~>"
116
- - !ruby/object:Gem::Version
117
- version: '0.3'
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'
125
111
  - !ruby/object:Gem::Dependency
126
112
  name: pg
127
113
  requirement: !ruby/object:Gem::Requirement
@@ -142,14 +128,14 @@ dependencies:
142
128
  requirements:
143
129
  - - '='
144
130
  - !ruby/object:Gem::Version
145
- version: 3.1.0
131
+ version: 3.5.2
146
132
  type: :development
147
133
  prerelease: false
148
134
  version_requirements: !ruby/object:Gem::Requirement
149
135
  requirements:
150
136
  - - '='
151
137
  - !ruby/object:Gem::Version
152
- version: 3.1.0
138
+ version: 3.5.2
153
139
  - !ruby/object:Gem::Dependency
154
140
  name: sqlite3
155
141
  requirement: !ruby/object:Gem::Requirement
@@ -170,14 +156,14 @@ dependencies:
170
156
  requirements:
171
157
  - - "~>"
172
158
  - !ruby/object:Gem::Version
173
- version: '11.3'
159
+ version: '12.0'
174
160
  type: :development
175
161
  prerelease: false
176
162
  version_requirements: !ruby/object:Gem::Requirement
177
163
  requirements:
178
164
  - - "~>"
179
165
  - !ruby/object:Gem::Version
180
- version: '11.3'
166
+ version: '12.0'
181
167
  description: Sharding
182
168
  email:
183
169
  - cody@instructure.com
@@ -256,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
256
242
  version: '0'
257
243
  requirements: []
258
244
  rubyforge_project:
259
- rubygems_version: 2.5.2
245
+ rubygems_version: 2.6.10
260
246
  signing_key:
261
247
  specification_version: 4
262
248
  summary: Rails 4 sharding magic