activerecord-configurations 0.3.0 → 0.4.0

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
  SHA256:
3
- metadata.gz: 65b9acb517ade0d3a1e879b83394509133d9b7e4a754ca0e71c373b107602070
4
- data.tar.gz: 73b8f60deeba7461446ee6b5e27aeb56511e2d6d70e9279e1eaa9a634d0acf2b
3
+ metadata.gz: a58d7441fee7b7c75e3d9d00edfbe47eb2d91d5050e5b0234b082c5ce8853cf4
4
+ data.tar.gz: bd1e280da830e16b57e1c216e16fdc36b54cdd44995cdb0f0ee97544ca29f8f8
5
5
  SHA512:
6
- metadata.gz: 17ace681ea622e45f0cfb81d9386604300b69bbd5341aa3251d78ea69f6451616fef91d5bdda59db1784ffcbc229cec7237926ab2065e244f9548e4e6cc75287
7
- data.tar.gz: 9bb97abc5785e5b76e30fa79ee1d6bdc3b197ee4130c620d412eabfa4402ce6a78be6658eff0d1bc829d5a5613a961c494248ecbc71b2f2643ced0455116c822
6
+ metadata.gz: fc8d8522f44a473ebcf322001657925962c587f03851ad6f5e0283aed75aac8aeddacb20aa8d91aca0356f21e89e69952a498c46fe6317cbf9f7cf98c67e4c9c
7
+ data.tar.gz: a909956f9eff542f6e36a1e051f48adde3886a09a9b1c4b7e03b2fd17fa4e11b473c5bad715129983bfd581d71cacb77667871bffa06ef6e4de1cf8f95f42c3d
@@ -4,7 +4,7 @@ rvm:
4
4
  - 2.2
5
5
  - 2.3
6
6
  - 2.4
7
- - 3.5
7
+ - 2.5
8
8
  - ruby-head
9
9
  - jruby-head
10
10
  - rbx-2
@@ -18,11 +18,29 @@
18
18
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
19
  # THE SOFTWARE.
20
20
 
21
- require_relative "configurations/version"
21
+ require_relative 'configurations/version'
22
22
 
23
23
  require 'build/environment'
24
+ require 'active_record'
24
25
 
25
26
  module ActiveRecord
27
+ class Base
28
+ # This is a quick hack to work around https://github.com/rails/rails/pull/32135
29
+ def self.establish_connection(config = nil)
30
+ raise "Anonymous class is not allowed." unless name
31
+
32
+ config ||= DEFAULT_ENV.call.to_sym
33
+ spec_name = self == Base ? "primary" : name
34
+ self.connection_specification_name = spec_name
35
+
36
+ resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new(self.configurations)
37
+ spec = resolver.resolve(config).symbolize_keys
38
+ spec[:name] = spec_name
39
+
40
+ connection_handler.establish_connection(spec)
41
+ end
42
+ end
43
+
26
44
  module Configurations
27
45
  def self.extended(child)
28
46
  child.instance_variable_set(:@environments, {})
@@ -113,20 +131,5 @@ module ActiveRecord
113
131
 
114
132
  self.configurations[name.to_s] = configuration.stringify_keys
115
133
  end
116
-
117
- # This is a quick hack to work around https://github.com/rails/rails/pull/32135
118
- def establish_connection(config = nil)
119
- raise "Anonymous class is not allowed." unless name
120
-
121
- config ||= DEFAULT_ENV.call.to_sym
122
- spec_name = self == Base ? "primary" : name
123
- self.connection_specification_name = spec_name
124
-
125
- resolver = ConnectionAdapters::ConnectionSpecification::Resolver.new(self.configurations)
126
- spec = resolver.resolve(config).symbolize_keys
127
- spec[:name] = spec_name
128
-
129
- connection_handler.establish_connection(spec)
130
- end
131
134
  end
132
135
  end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module ActiveRecord
22
22
  module Configurations
23
- VERSION = "0.3.0"
23
+ VERSION = "0.4.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: activerecord-configurations
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams