eac_rails_base0 0.47.0 → 0.48.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: 9dbf7853e319ed40781d1ba226a0a69ab73429884cbd6355c9ffc53cd8e3ac62
4
- data.tar.gz: acf438c17b387f7b2fc025d92371809a4ec2dc68c2373678bd91c275d5e3e011
3
+ metadata.gz: 3e6e5c1e785de509bd1c7599df86fdb868e057c4edadd170c31db62b0d2b15bf
4
+ data.tar.gz: aa1eea6644eb191c24f0a3fc7e9b9482bfc23ebc080b2c4a73ce206676b9434a
5
5
  SHA512:
6
- metadata.gz: db2d718db7eca5f9720efcd5e3d4cf7618364611b9d08ca8329da68abcdab1acee7a414dc3dae7c676aaaf8f68c8948c5a568fbb5b958a3b3a95790087039340
7
- data.tar.gz: '08a70dac3579768cd8d3f7596e064a4ba16e2b8e8fa17b7263743669e5aab78b12bf70463324d853fca00126c7bbd516d0499f2d47aa0e790e9498ca314019f9'
6
+ metadata.gz: c0b4391fc0d49c14e2d20cd08a0e0be11f9ead8f39cb81a78a2d26c842389a8c5d68d8ec0ba2052d7c1919aa015893b3d9bb9bcc1c5be88861bd3646bb052652
7
+ data.tar.gz: edfe1a77f9782c2845a647a1ffa991652ebd9fd8810218abeec65accbf4ded71bd2df46074cb219be21b15fccdc4e6e4174b2fd311d5afdce79e3759e2a69006
@@ -1,24 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Rails.application.configure do
4
- config.action_mailer.smtp_settings = {
5
- address: ENV['action_mailer_smtp_address'],
6
- port: ENV['action_mailer_smtp_port'],
7
- domain: ENV['action_mailer_smtp_domain'],
8
- user_name: ENV['action_mailer_smtp_username'],
9
- password: ENV['action_mailer_smtp_password'],
10
- authentication: ENV['action_mailer_smtp_authentication'],
11
- enable_starttls_auto:
12
- ::EacRailsBase0::BooleanValue.to_b(ENV['action_mailer_smtp_enable_starttls_auto'])
13
- }
14
- %i[host port].each do |option|
15
- value = ENV["action_mailer_default_url_#{option}"]
16
- if value.present?
17
- config.action_mailer.default_url_options ||= {}
18
- config.action_mailer.default_url_options[option] = value
3
+ unless ::Rails.env.test?
4
+ Rails.application.configure do
5
+ config.action_mailer.smtp_settings = {
6
+ address: ENV['action_mailer_smtp_address'],
7
+ port: ENV['action_mailer_smtp_port'],
8
+ domain: ENV['action_mailer_smtp_domain'],
9
+ user_name: ENV['action_mailer_smtp_username'],
10
+ password: ENV['action_mailer_smtp_password'],
11
+ authentication: ENV['action_mailer_smtp_authentication'],
12
+ enable_starttls_auto:
13
+ ::EacRailsBase0::BooleanValue.to_b(ENV['action_mailer_smtp_enable_starttls_auto'])
14
+ }
15
+ %i[host port].each do |option|
16
+ value = ENV["action_mailer_default_url_#{option}"]
17
+ if value.present?
18
+ config.action_mailer.default_url_options ||= {}
19
+ config.action_mailer.default_url_options[option] = value
20
+ end
19
21
  end
22
+ config.action_mailer.default_options ||= {}
23
+ config.action_mailer.default_options[:from] = ENV['action_mailer_default_options_from']
24
+ config.action_mailer.default_options[:reply_to] = ENV['action_mailer_default_options_reply_to']
20
25
  end
21
- config.action_mailer.default_options ||= {}
22
- config.action_mailer.default_options[:from] = ENV['action_mailer_default_options_from']
23
- config.action_mailer.default_options[:reply_to] = ENV['action_mailer_default_options_reply_to']
24
26
  end
@@ -6,8 +6,7 @@ module EacRailsBase0App
6
6
  class Application < Rails::Application
7
7
  module All
8
8
  common_concern do
9
- setup('local_configuration', 'assets_cache', 'dependencies', 'localization', 'load_paths',
10
- 'loggers')
9
+ setup('assets_cache', 'dependencies', 'localization', 'load_paths', 'loggers')
11
10
  end
12
11
 
13
12
  module ClassMethods
@@ -45,12 +44,6 @@ module EacRailsBase0App
45
44
  config.autoload_paths << Rails.root.join('lib')
46
45
  end
47
46
 
48
- def setup_local_configuration
49
- local_configuration = ::File.join(rails_root(APP_PATH), 'config',
50
- 'local_configuration.rb')
51
- require local_configuration if File.exist?(local_configuration)
52
- end
53
-
54
47
  def setup_localization
55
48
  config.i18n.default_locale = :'pt-BR'
56
49
  end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'eac_ruby_utils/core_ext'
4
+ require 'eac_ruby_utils/yaml'
5
+
6
+ module EacRailsBase0App
7
+ class Application < Rails::Application
8
+ module Envvars
9
+ ENVVARS_FILE_BASENAME = 'envvars'
10
+ ENVVARS_DIRECTORY_NAME = "#{ENVVARS_FILE_BASENAME}.d"
11
+ ENVVARS_FILE_EXTENSIONS = %w[.yml .yaml].freeze
12
+
13
+ common_concern do
14
+ setup('envvars')
15
+ end
16
+
17
+ module ClassMethods
18
+ def config_root
19
+ ::Rails.root.join('config')
20
+ end
21
+
22
+ def envvars_files
23
+ ENVVARS_FILE_EXTENSIONS.flat_map do |extension|
24
+ [config_root.join("#{ENVVARS_FILE_BASENAME}#{extension}")] +
25
+ config_root.join(ENVVARS_DIRECTORY_NAME).glob("*#{extension}")
26
+ end
27
+ end
28
+
29
+ def load_envvars_file(path)
30
+ return unless path.exist?
31
+
32
+ vars = ::EacRubyUtils::Yaml.load(path.read)
33
+ raise "\"#{path}\" does not contain a Hash" unless vars.is_a?(::Hash)
34
+
35
+ vars.each { |name, value| ENV[name.to_s] = value }
36
+ end
37
+
38
+ def setup_envvars
39
+ envvars_files.each { |path| load_envvars_file(path) }
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -5,10 +5,16 @@ require 'eac_ruby_utils/core_ext'
5
5
  module EacRailsBase0App
6
6
  class Application < Rails::Application
7
7
  module Test
8
+ ACTION_MAILER_CONFIGS = {
9
+ delivery_method: :test,
10
+ default_url_options: { host: 'localhost', port: 3000 },
11
+ default_options: { from: 'myadddress@example.net', reply_to: '' }
12
+ }.freeze
13
+
8
14
  common_concern do
9
15
  next unless ::Rails.env.test?
10
16
 
11
- setup('action_controller', 'general', 'log', 'public_file_server')
17
+ setup('action_controller', 'action_mailer', 'general', 'log', 'public_file_server')
12
18
  end
13
19
 
14
20
  module ClassMethods
@@ -17,6 +23,12 @@ module EacRailsBase0App
17
23
  config.action_controller.allow_forgery_protection = false
18
24
  end
19
25
 
26
+ def setup_action_mailer
27
+ ACTION_MAILER_CONFIGS.each do |key, value|
28
+ config.action_mailer.send("#{key}=", value)
29
+ end
30
+ end
31
+
20
32
  def setup_general
21
33
  config.cache_classes = true
22
34
  config.eager_load = false
@@ -24,7 +36,6 @@ module EacRailsBase0App
24
36
  config.consider_all_requests_local = true
25
37
  config.action_controller.perform_caching = false
26
38
  config.action_dispatch.show_exceptions = false
27
- config.action_mailer.delivery_method = :test
28
39
  end
29
40
 
30
41
  def setup_log
@@ -20,4 +20,5 @@
20
20
 
21
21
  # Configuration files
22
22
  config/database.y*ml
23
- config/local_configuration.rb
23
+ config/envvars.y*ml
24
+ config/envvars.d/*.y*ml
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EacRailsBase0
4
- VERSION = '0.47.0'
4
+ VERSION = '0.48.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: eac_rails_base0
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.47.0
4
+ version: 0.48.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esquilo Azul Company
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-18 00:00:00.000000000 Z
11
+ date: 2020-10-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: active_scaffold
@@ -625,6 +625,7 @@ files:
625
625
  - lib/eac_rails_base0/app_base/application.rb
626
626
  - lib/eac_rails_base0/app_base/application/all.rb
627
627
  - lib/eac_rails_base0/app_base/application/development.rb
628
+ - lib/eac_rails_base0/app_base/application/envvars.rb
628
629
  - lib/eac_rails_base0/app_base/application/production.rb
629
630
  - lib/eac_rails_base0/app_base/application/test.rb
630
631
  - lib/eac_rails_base0/app_generator/builder.rb