eac_rails_utils 0.31.0 → 0.33.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 +4 -4
- data/lib/eac_rails_utils/availability.rb +34 -0
- data/lib/eac_rails_utils/engine_helper.rb +12 -1
- data/lib/eac_rails_utils/version.rb +1 -1
- metadata +8 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: aef634ece4f55d36b2b5108be04fb1a8482ec01b5a82cdcb8a72ffee611fb043
|
|
4
|
+
data.tar.gz: 120421090144743f58bf1b78025b335650ea13498bb3d71ee49deab8995c4ac4
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b81b3d4379027108fca826fb9dfdb2d06baf6d89803873c9d65d27c74e89d29e77a3522af607afaada73bfd594cce2ac436313006ea7c8c8b9ac3bc38138d441
|
|
7
|
+
data.tar.gz: cc8dd8a8f44c445748435be68e31be92960b56568eb2f53c980e0878a3ad68b1df3f370be4de83c53dd9d1a67b3648d722e1f1569853146d3680f349a4c319d3
|
|
@@ -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
|
|
|
@@ -29,7 +30,17 @@ module EacRailsUtils
|
|
|
29
30
|
end
|
|
30
31
|
|
|
31
32
|
def append_autoload_paths
|
|
32
|
-
config.
|
|
33
|
+
config.autoload_once_paths += Dir["#{config.root}/lib"]
|
|
34
|
+
end
|
|
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
|
|
33
44
|
end
|
|
34
45
|
|
|
35
46
|
def append_self_migrations
|
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.33.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- E.A.C.
|
|
@@ -124,6 +124,9 @@ dependencies:
|
|
|
124
124
|
- - "~>"
|
|
125
125
|
- !ruby/object:Gem::Version
|
|
126
126
|
version: '0.15'
|
|
127
|
+
- - ">="
|
|
128
|
+
- !ruby/object:Gem::Version
|
|
129
|
+
version: 0.15.2
|
|
127
130
|
type: :development
|
|
128
131
|
prerelease: false
|
|
129
132
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -131,6 +134,9 @@ dependencies:
|
|
|
131
134
|
- - "~>"
|
|
132
135
|
- !ruby/object:Gem::Version
|
|
133
136
|
version: '0.15'
|
|
137
|
+
- - ">="
|
|
138
|
+
- !ruby/object:Gem::Version
|
|
139
|
+
version: 0.15.2
|
|
134
140
|
executables: []
|
|
135
141
|
extensions: []
|
|
136
142
|
extra_rdoc_files: []
|
|
@@ -192,6 +198,7 @@ files:
|
|
|
192
198
|
- config/locales/en.yml
|
|
193
199
|
- config/locales/pt-BR.yml
|
|
194
200
|
- lib/eac_rails_utils.rb
|
|
201
|
+
- lib/eac_rails_utils/availability.rb
|
|
195
202
|
- lib/eac_rails_utils/engine.rb
|
|
196
203
|
- lib/eac_rails_utils/engine_helper.rb
|
|
197
204
|
- lib/eac_rails_utils/menus/action.rb
|