codekindly-utils 0.0.13 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/code_kindly/utils/active_record.rb +8 -6
- data/lib/code_kindly/utils/version.rb +1 -1
- metadata +8 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c8f368a1c0df321a7c4bae4810f1e56201135546c9c6659b069bc846bbcd9aa5
|
4
|
+
data.tar.gz: cbf75f7d1ec771f1aef48f1cc270b078b5143b8faa280e123a76c357aa3e4fc2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95cccb4d0f33d5cb582bd4f982854de5c092426cd7378203f285d6174353b947547e29befd246fa3d735d8054fdcdccd850465da125d93355e0604a29e204f13
|
7
|
+
data.tar.gz: 7cac163514c846e69a77ce9bd08164d8a2d3bc8ec424a462cedb0a877eb2c0966048434a768a09f59352a8b7c5092c3a117c38067df7f1b94da757e69eec3a1a
|
@@ -34,18 +34,21 @@ module CodeKindly
|
|
34
34
|
configs[name || default_name]
|
35
35
|
end
|
36
36
|
|
37
|
-
# rubocop:disable
|
38
|
-
def configs
|
37
|
+
def configs # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
|
39
38
|
@configs ||= ::ActiveRecord::Base.configurations
|
39
|
+
if @configs.class.name == 'ActiveRecord::DatabaseConfigurations' # rubocop:disable Style/ClassEqualityComparison
|
40
|
+
@configs = @configs.configs_for.each_with_object({}) do |config, hash|
|
41
|
+
hash[config.env_name] = config&.configuration_hash || config&.config
|
42
|
+
end
|
43
|
+
end
|
40
44
|
return @configs unless @configs == {}
|
41
45
|
return @configs unless RAILS.respond_to?(:root)
|
42
46
|
|
43
47
|
file = RAILS.root.join('config', 'database.yml')
|
44
48
|
return @configs unless ::File.readable?(file)
|
45
49
|
|
46
|
-
@configs = YAML.load(::File.read(file))
|
50
|
+
@configs = YAML.load(::File.read(file)) # rubocop:disable Security/YAMLLoad
|
47
51
|
end
|
48
|
-
# rubocop:enable Security/YAMLLoad
|
49
52
|
|
50
53
|
def configurations
|
51
54
|
deprecate :configurations, :configs, :'0.1.0'
|
@@ -103,8 +106,7 @@ module CodeKindly
|
|
103
106
|
def load_classes_in_development
|
104
107
|
return unless RAILS.try(:env).try(:development?)
|
105
108
|
|
106
|
-
|
107
|
-
::Dir.glob(model_files) do |f|
|
109
|
+
::Dir.glob(RAILS.root.join('app/models/**/*.rb').to_s) do |f|
|
108
110
|
klass = ::File.basename(f, '.rb').classify
|
109
111
|
next if Kernel.const_defined? klass
|
110
112
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codekindly-utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Weathers
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: highline
|
@@ -72,14 +72,14 @@ dependencies:
|
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '2.2'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '2.2'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry-byebug
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -180,7 +180,7 @@ homepage: https://github.com/jlw/codekindly-utils
|
|
180
180
|
licenses:
|
181
181
|
- MIT
|
182
182
|
metadata: {}
|
183
|
-
post_install_message:
|
183
|
+
post_install_message:
|
184
184
|
rdoc_options: []
|
185
185
|
require_paths:
|
186
186
|
- lib
|
@@ -195,9 +195,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: '0'
|
197
197
|
requirements: []
|
198
|
-
|
199
|
-
|
200
|
-
signing_key:
|
198
|
+
rubygems_version: 3.3.26
|
199
|
+
signing_key:
|
201
200
|
specification_version: 4
|
202
201
|
summary: These are small utilities that I like to have around in my projects.
|
203
202
|
test_files: []
|