eac_rails_utils 0.30.0 → 0.32.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:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4c1c8cc243cf56400a3dbabd1a60d2f4446fd9976f4c058566e79111f82e5213
|
|
4
|
+
data.tar.gz: c2dab26dc092a2685758c5fe6813e93150e1cb5a0ed09a149aceb095e1f9db2d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b9c411f024f75fe5bc5de0502eac45d4dc4e5711b6cb28b09d24b1700fbb6392a0049cc72d67d3066837c1e10cb4c7155313f3f506d183fc62ce0b419cecc047
|
|
7
|
+
data.tar.gz: f548f87ffaa910b5c33f3e1b99b2bf498c1db924a12f7a59b2d375358b578687dcd89fa990bfab3bd891f051c4e936a7765645912b79077fb26c13affa65011d
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module EacRailsUtils
|
|
4
|
+
module Availability
|
|
5
|
+
class << self
|
|
6
|
+
# @return [Boolean]
|
|
7
|
+
def database?
|
|
8
|
+
::ActiveRecord::Base.connection.table_exists?('any_table_name')
|
|
9
|
+
rescue ActiveRecord::NoDatabaseError, PG::ConnectionBad
|
|
10
|
+
false
|
|
11
|
+
else
|
|
12
|
+
true
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# @return [Boolean]
|
|
16
|
+
def database_schema?
|
|
17
|
+
database? && ::RedminePluginsHelper::Migration.from_code.all?(&:applied?)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
# @param model_classes [Enumerable<>]
|
|
21
|
+
# @return [Boolean]
|
|
22
|
+
def model?(*model_classes)
|
|
23
|
+
table?(*model_classes.map(&:table_name))
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# @param table_names [Enumerable<String>]
|
|
27
|
+
# @return [Boolean]
|
|
28
|
+
def table?(*table_names)
|
|
29
|
+
database? && table_names
|
|
30
|
+
.all? { |table_name| ::ActiveRecord::Base.connection.table_exists?(table_name) }
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -12,6 +12,7 @@ module EacRailsUtils
|
|
|
12
12
|
common_concern do
|
|
13
13
|
append_after_initializers
|
|
14
14
|
append_autoload_paths
|
|
15
|
+
append_mailer_preview_paths
|
|
15
16
|
append_self_migrations
|
|
16
17
|
end
|
|
17
18
|
|
|
@@ -32,6 +33,16 @@ module EacRailsUtils
|
|
|
32
33
|
config.autoload_paths += Dir["#{config.root}/lib"]
|
|
33
34
|
end
|
|
34
35
|
|
|
36
|
+
# @return [void]
|
|
37
|
+
def append_mailer_preview_paths
|
|
38
|
+
initializer :append_mailer_preview_paths, before: 'action_mailer.set_configs' do |app|
|
|
39
|
+
%w[spec test].each do |test_dir|
|
|
40
|
+
path = config.root.join(test_dir, 'mailers', 'previews')
|
|
41
|
+
(app.config.action_mailer.preview_paths ||= []) << path if path.directory?
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
|
|
35
46
|
def append_self_migrations
|
|
36
47
|
initializer :append_migrations do |app|
|
|
37
48
|
config.paths['db/migrate'].expanded.each do |expanded_path|
|
|
@@ -98,6 +98,20 @@ module EacRailsUtils
|
|
|
98
98
|
association
|
|
99
99
|
end
|
|
100
100
|
|
|
101
|
+
# generated association accessors call this before reading/writing an association
|
|
102
|
+
# (added by Rails to support the deprecated associations API, since Rails 8.1)
|
|
103
|
+
if defined?(ActiveRecord::Associations::Deprecation)
|
|
104
|
+
def deprecated_associations_api_guard(association, method_name)
|
|
105
|
+
ActiveRecord::Associations::Deprecation.guard(association.reflection) do
|
|
106
|
+
"the method #{method_name} was invoked"
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
def report_deprecated_association(reflection, context:)
|
|
111
|
+
ActiveRecord::Associations::Deprecation.report(reflection, context: context)
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
101
115
|
def read_attribute(name)
|
|
102
116
|
send(name)
|
|
103
117
|
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: eac_rails_utils
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.32.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- E.A.C.
|
|
@@ -55,14 +55,14 @@ dependencies:
|
|
|
55
55
|
requirements:
|
|
56
56
|
- - ">="
|
|
57
57
|
- !ruby/object:Gem::Version
|
|
58
|
-
version:
|
|
58
|
+
version: '7.2'
|
|
59
59
|
type: :runtime
|
|
60
60
|
prerelease: false
|
|
61
61
|
version_requirements: !ruby/object:Gem::Requirement
|
|
62
62
|
requirements:
|
|
63
63
|
- - ">="
|
|
64
64
|
- !ruby/object:Gem::Version
|
|
65
|
-
version:
|
|
65
|
+
version: '7.2'
|
|
66
66
|
- !ruby/object:Gem::Dependency
|
|
67
67
|
name: sprockets-rails
|
|
68
68
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -123,14 +123,14 @@ dependencies:
|
|
|
123
123
|
requirements:
|
|
124
124
|
- - "~>"
|
|
125
125
|
- !ruby/object:Gem::Version
|
|
126
|
-
version: '0.
|
|
126
|
+
version: '0.15'
|
|
127
127
|
type: :development
|
|
128
128
|
prerelease: false
|
|
129
129
|
version_requirements: !ruby/object:Gem::Requirement
|
|
130
130
|
requirements:
|
|
131
131
|
- - "~>"
|
|
132
132
|
- !ruby/object:Gem::Version
|
|
133
|
-
version: '0.
|
|
133
|
+
version: '0.15'
|
|
134
134
|
executables: []
|
|
135
135
|
extensions: []
|
|
136
136
|
extra_rdoc_files: []
|
|
@@ -192,6 +192,7 @@ files:
|
|
|
192
192
|
- config/locales/en.yml
|
|
193
193
|
- config/locales/pt-BR.yml
|
|
194
194
|
- lib/eac_rails_utils.rb
|
|
195
|
+
- lib/eac_rails_utils/availability.rb
|
|
195
196
|
- lib/eac_rails_utils/engine.rb
|
|
196
197
|
- lib/eac_rails_utils/engine_helper.rb
|
|
197
198
|
- lib/eac_rails_utils/menus/action.rb
|