eac_rails_base0 0.43.0 → 0.48.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/eac_rails_base0/mailer_controller.rb +32 -0
- data/app/helpers/eac_rails_base0/layout_helper.rb +12 -9
- data/app/mailers/eac_rails_base0/send_test_mailer.rb +10 -0
- data/app/tableless_models/eac_rails_base0/email_send_test.rb +32 -0
- data/app/views/eac_rails_base0/mailer/info.html.erb +17 -0
- data/app/views/eac_rails_base0/mailer/send_test.html.erb +5 -0
- data/app/views/eac_rails_base0/send_test_mailer/main.html.erb +1 -0
- data/config/initializers/action_mailer.rb +21 -19
- data/config/locales/en.yml +10 -0
- data/config/locales/pt-BR.yml +6 -0
- data/config/routes.rb +11 -0
- data/lib/eac_rails_base0/app_base/ability.rb +1 -0
- data/lib/eac_rails_base0/app_base/ability_mapping.rb +5 -0
- data/lib/eac_rails_base0/app_base/application.rb +6 -51
- data/lib/eac_rails_base0/app_base/application/all.rb +59 -0
- data/lib/eac_rails_base0/app_base/application/development.rb +58 -0
- data/lib/eac_rails_base0/app_base/application/envvars.rb +44 -0
- data/lib/eac_rails_base0/app_base/application/production.rb +49 -0
- data/lib/eac_rails_base0/app_base/application/test.rb +54 -0
- data/lib/eac_rails_base0/app_generator/builder.rb +1 -1
- data/lib/eac_rails_base0/app_generator/templates/gitignore +24 -0
- data/lib/eac_rails_base0/version.rb +1 -1
- data/lib/eac_rails_base0/x_engine.rb +4 -0
- metadata +33 -7
- data/config/initializers/pg_deprecated_constants.rb +0 -37
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3e6e5c1e785de509bd1c7599df86fdb868e057c4edadd170c31db62b0d2b15bf
|
4
|
+
data.tar.gz: aa1eea6644eb191c24f0a3fc7e9b9482bfc23ebc080b2c4a73ce206676b9434a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c0b4391fc0d49c14e2d20cd08a0e0be11f9ead8f39cb81a78a2d26c842389a8c5d68d8ec0ba2052d7c1919aa015893b3d9bb9bcc1c5be88861bd3646bb052652
|
7
|
+
data.tar.gz: edfe1a77f9782c2845a647a1ffa991652ebd9fd8810218abeec65accbf4ded71bd2df46074cb219be21b15fccdc4e6e4174b2fd311d5afdce79e3759e2a69006
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EacRailsBase0
|
4
|
+
class MailerController < ::EacRailsBase0::ApplicationController
|
5
|
+
def info
|
6
|
+
klass = ::ActionMailer::Base
|
7
|
+
@sections = %w[default_params default_url_options smtp_settings].map do |section|
|
8
|
+
["#{klass}.#{section}", klass.send(section)]
|
9
|
+
end.to_h
|
10
|
+
end
|
11
|
+
|
12
|
+
def send_test
|
13
|
+
@record = ::EacRailsBase0::EmailSendTest.new
|
14
|
+
end
|
15
|
+
|
16
|
+
def send_test_submit
|
17
|
+
@record = ::EacRailsBase0::EmailSendTest.new(send_test_submit_params)
|
18
|
+
if @record.save
|
19
|
+
flash[:success] = t('eac_rails_base0.mailer.send_test_successful', address: @record.address)
|
20
|
+
redirect_to action: :send_test
|
21
|
+
else
|
22
|
+
render :send_test
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def send_test_submit_params
|
29
|
+
params[::EacRailsBase0::EmailSendTest.model_name.param_key].permit(:alternative_address)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -4,6 +4,7 @@ module EacRailsBase0
|
|
4
4
|
module LayoutHelper
|
5
5
|
APP_TITLE_METHOD = 'app_title'
|
6
6
|
APP_MAIN_MENU_ENTRIES_METHOD = 'app_main_menu_entries'
|
7
|
+
ADMIN_ENTRIES = %w[eac_users_support tasks_scheduler aranha br_railties mailer].freeze
|
7
8
|
|
8
9
|
def base0_app_title
|
9
10
|
if respond_to?(APP_TITLE_METHOD)
|
@@ -28,17 +29,19 @@ module EacRailsBase0
|
|
28
29
|
end
|
29
30
|
|
30
31
|
def base0_app_main_menu_admin_entries
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
send("#{identifier}_main_menu_admin_entries")
|
36
|
-
end
|
37
|
-
h
|
32
|
+
ADMIN_ENTRIES.map do |identifier|
|
33
|
+
[::I18n.t("eac_rails_base0.main_menu.admin.#{identifier}"),
|
34
|
+
send("#{identifier}_main_menu_admin_entries")]
|
35
|
+
end.to_h
|
38
36
|
end
|
39
37
|
|
40
|
-
def
|
41
|
-
[
|
38
|
+
def mailer_main_menu_admin_entries
|
39
|
+
%w[info send_test].map do |action|
|
40
|
+
[
|
41
|
+
t("eac_rails_base0.mailer.#{action}"),
|
42
|
+
main_app.send("#{action}_eac_rails_base0_mailer_index_path")
|
43
|
+
]
|
44
|
+
end.to_h
|
42
45
|
end
|
43
46
|
|
44
47
|
def eac_users_support_main_menu_admin_entries
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacRailsBase0
|
6
|
+
class EmailSendTest < ::EacRailsUtils::Models::Tableless
|
7
|
+
attribute :alternative_address, ::String
|
8
|
+
|
9
|
+
validates :alternative_address, allow_blank: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
10
|
+
validates :logged_user_address, allow_blank: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
11
|
+
validates :address, presence: true, format: { with: URI::MailTo::EMAIL_REGEXP }
|
12
|
+
|
13
|
+
def save
|
14
|
+
return false unless valid?
|
15
|
+
|
16
|
+
send_mail
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
def address
|
21
|
+
alternative_address.presence || logged_user_address.presence
|
22
|
+
end
|
23
|
+
|
24
|
+
def logged_user_address
|
25
|
+
::EacUsersSupport::User.current_user.if_present(&:email)
|
26
|
+
end
|
27
|
+
|
28
|
+
def send_mail
|
29
|
+
::EacRailsBase0::SendTestMailer.with(address: address).main.deliver_later
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<h2><%= t('eac_rails_base0.mailer.info') %></h2>
|
2
|
+
<% @sections.each do |section_title, section_data| %>
|
3
|
+
<h3><%= section_title %></h3>
|
4
|
+
<dl>
|
5
|
+
<% section_data.each do |key, value| %>
|
6
|
+
<dt><%= key %></dt>
|
7
|
+
<dd>
|
8
|
+
<% if key.to_s.downcase.include?('password') %>
|
9
|
+
<em><%= value.present? ? 'Present' : 'Blank' %></em>
|
10
|
+
<% else %>
|
11
|
+
<%= value %>
|
12
|
+
<% end %>
|
13
|
+
(<%= value.class %>)
|
14
|
+
</dd>
|
15
|
+
<% end %>
|
16
|
+
</dl>
|
17
|
+
<% end %>
|
@@ -0,0 +1 @@
|
|
1
|
+
<h2><%= @subject %></h2>
|
@@ -1,24 +1,26 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
Rails.
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
data/config/locales/pt-BR.yml
CHANGED
@@ -27,9 +27,15 @@ pt-BR:
|
|
27
27
|
eac_rails_base0:
|
28
28
|
app_version:
|
29
29
|
unsetted: Não especificada
|
30
|
+
mailer:
|
31
|
+
info: 'Informações de e-mail'
|
32
|
+
send_submit: 'Enviar'
|
33
|
+
send_test: 'Envio de e-mail de teste'
|
34
|
+
send_test_successful: 'E-mail enviado para %{address}'
|
30
35
|
main_menu:
|
31
36
|
admin:
|
32
37
|
aranha: Aranha
|
33
38
|
br_railties: BrRailties
|
39
|
+
mailer: E-mail
|
34
40
|
eac_users_support: Usuários
|
35
41
|
tasks_scheduler: Agendador
|
data/config/routes.rb
CHANGED
@@ -7,4 +7,15 @@ Rails.application.routes.draw do
|
|
7
7
|
mount ::EacUsersSupport::Engine => '/'
|
8
8
|
mount ::Aranha::Engine => '/aranha'
|
9
9
|
mount ::BrRailties::Engine => '/br_railties'
|
10
|
+
|
11
|
+
namespace(:eac_rails_base0) do
|
12
|
+
resources(:mailer, only: []) do
|
13
|
+
collection do
|
14
|
+
get :info
|
15
|
+
get :send_test
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
post '/eac_rails_base0/mailer/send_test', to: 'eac_rails_base0/mailer#send_test_submit'
|
10
21
|
end
|
@@ -17,6 +17,11 @@ module EacRailsBase0
|
|
17
17
|
map_controller 'BrRailties::Municipalities', :manage, ::BrRailties::Municipality
|
18
18
|
map_controller 'ScheduledTasks', :manage, ::ScheduledTask
|
19
19
|
map_controller 'TasksSchedulerDaemon', :manage, ::ScheduledTask
|
20
|
+
map_eac_rails_base0
|
21
|
+
end
|
22
|
+
|
23
|
+
def map_eac_rails_base0
|
24
|
+
map_controller 'EacRailsBase0::Mailer', :manage, :eac_rails_base0_mailer
|
20
25
|
end
|
21
26
|
end
|
22
27
|
end
|
@@ -1,65 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
3
4
|
require 'rails/all'
|
4
5
|
|
5
6
|
# Require the gems listed in Gemfile, including any gems
|
6
7
|
# you've limited to :test, :development, or :production.
|
7
8
|
Bundler.require(*Rails.groups)
|
8
9
|
|
9
|
-
def rails_root(dir)
|
10
|
-
return dir if ::File.exist?(::File.join(dir, 'config.ru'))
|
11
|
-
raise 'config.ru not found in ascendent path' if dir == '/'
|
12
|
-
|
13
|
-
rails_root(::File.dirname(dir))
|
14
|
-
end
|
15
|
-
|
16
|
-
local_configuration = ::File.join(rails_root(APP_PATH), 'config', 'local_configuration.rb')
|
17
|
-
require local_configuration if File.exist?(local_configuration)
|
18
|
-
|
19
10
|
module EacRailsBase0App
|
20
11
|
class Application < Rails::Application
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
|
26
|
-
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
|
27
|
-
# config.time_zone = 'Central Time (US & Canada)'
|
28
|
-
|
29
|
-
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
|
30
|
-
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
|
31
|
-
# config.i18n.default_locale = :de
|
32
|
-
config.i18n.default_locale = :'pt-BR'
|
33
|
-
|
34
|
-
# Do not swallow errors in after_commit/after_rollback callbacks.
|
35
|
-
config.active_record.raise_in_transactional_callbacks = true if ::Rails.version < '5'
|
36
|
-
|
37
|
-
# Autoload do código em /lib.
|
38
|
-
config.autoload_paths << Rails.root.join('lib')
|
39
|
-
|
40
|
-
config.after_initialize do
|
41
|
-
ActiveRecord::Base.logger = nil
|
42
|
-
end
|
43
|
-
|
44
|
-
app_tmpdir = ::File.join(::Dir.tmpdir, ::Rails.root.to_path.parameterize, 'tmp')
|
45
|
-
|
46
|
-
config.assets.configure do |env|
|
47
|
-
env.cache = Sprockets::Cache::FileStore.new(
|
48
|
-
::File.join(app_tmpdir, 'cache', 'assets'),
|
49
|
-
config.assets.cache_limit,
|
50
|
-
env.logger
|
51
|
-
)
|
12
|
+
class << self
|
13
|
+
def setup(*args)
|
14
|
+
args.each { |a| send("setup_#{a}") }
|
15
|
+
end
|
52
16
|
end
|
53
17
|
|
54
|
-
|
55
|
-
config.paths['db/migrate'] << migrate_deprecated_dir if migrate_deprecated_dir.directory?
|
56
|
-
|
57
|
-
if ::Rails.env.development?
|
58
|
-
require 'letter_opener'
|
59
|
-
config.action_mailer.delivery_method = :letter_opener
|
60
|
-
config.action_mailer.perform_deliveries = true
|
61
|
-
end
|
18
|
+
require_sub __FILE__, include_modules: true
|
62
19
|
end
|
63
20
|
end
|
64
|
-
|
65
|
-
require 'carrierwave'
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacRailsBase0App
|
6
|
+
class Application < Rails::Application
|
7
|
+
module All
|
8
|
+
common_concern do
|
9
|
+
setup('assets_cache', 'dependencies', 'localization', 'load_paths', 'loggers')
|
10
|
+
end
|
11
|
+
|
12
|
+
module ClassMethods
|
13
|
+
def app_temporary_directory
|
14
|
+
::File.join(::Dir.tmpdir, ::Rails.root.to_path.parameterize, 'tmp')
|
15
|
+
end
|
16
|
+
|
17
|
+
def rails_root(dir)
|
18
|
+
return dir if ::File.exist?(::File.join(dir, 'config.ru'))
|
19
|
+
raise 'config.ru not found in ascendent path' if dir == '/'
|
20
|
+
|
21
|
+
rails_root(::File.dirname(dir))
|
22
|
+
end
|
23
|
+
|
24
|
+
def setup_assets_cache
|
25
|
+
config.assets.configure do |env|
|
26
|
+
env.cache = Sprockets::Cache::FileStore.new(
|
27
|
+
::File.join(app_temporary_directory, 'cache', 'assets'),
|
28
|
+
config.assets.cache_limit,
|
29
|
+
env.logger
|
30
|
+
)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def setup_dependencies
|
35
|
+
require 'carrierwave'
|
36
|
+
end
|
37
|
+
|
38
|
+
def setup_deprecated_migrations
|
39
|
+
path = ::Rails.root.join('db', 'migrate_deprecated')
|
40
|
+
config.paths['db/migrate'] << path if path.directory?
|
41
|
+
end
|
42
|
+
|
43
|
+
def setup_load_paths
|
44
|
+
config.autoload_paths << Rails.root.join('lib')
|
45
|
+
end
|
46
|
+
|
47
|
+
def setup_localization
|
48
|
+
config.i18n.default_locale = :'pt-BR'
|
49
|
+
end
|
50
|
+
|
51
|
+
def setup_loggers
|
52
|
+
config.after_initialize do
|
53
|
+
ActiveRecord::Base.logger = nil
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacRailsBase0App
|
6
|
+
class Application < Rails::Application
|
7
|
+
module Development
|
8
|
+
common_concern do
|
9
|
+
next unless ::Rails.env.development?
|
10
|
+
|
11
|
+
setup('assets', 'cache', 'general', 'letter_opener', 'log')
|
12
|
+
end
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def setup_assets
|
16
|
+
config.assets.debug = true
|
17
|
+
config.assets.quiet = true
|
18
|
+
end
|
19
|
+
|
20
|
+
def setup_cache
|
21
|
+
if Rails.root.join('tmp/caching-dev.txt').exist?
|
22
|
+
config.action_controller.perform_caching = true
|
23
|
+
config.cache_store = :memory_store
|
24
|
+
config.public_file_server.headers = {
|
25
|
+
'Cache-Control' => "public, max-age=#{2.days.seconds.to_i}"
|
26
|
+
}
|
27
|
+
else
|
28
|
+
config.action_controller.perform_caching = false
|
29
|
+
config.cache_store = :null_store
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def setup_general
|
34
|
+
config.cache_classes = false
|
35
|
+
config.eager_load = false
|
36
|
+
config.consider_all_requests_local = true
|
37
|
+
config.action_mailer.raise_delivery_errors = false
|
38
|
+
config.action_mailer.perform_caching = false
|
39
|
+
config.active_record.migration_error = :page_load
|
40
|
+
config.file_watcher = ActiveSupport::EventedFileUpdateChecker
|
41
|
+
end
|
42
|
+
|
43
|
+
def setup_letter_opener
|
44
|
+
require 'letter_opener'
|
45
|
+
config.action_mailer.delivery_method = :letter_opener
|
46
|
+
config.action_mailer.perform_deliveries = true
|
47
|
+
end
|
48
|
+
|
49
|
+
def setup_log
|
50
|
+
config.active_support.deprecation = :log
|
51
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
52
|
+
logger.formatter = config.log_formatter
|
53
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
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
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacRailsBase0App
|
6
|
+
class Application < Rails::Application
|
7
|
+
module Production
|
8
|
+
common_concern do
|
9
|
+
next unless ::Rails.env.production?
|
10
|
+
|
11
|
+
setup('assets', 'general', 'log', 'public_file_server')
|
12
|
+
end
|
13
|
+
|
14
|
+
module ClassMethods
|
15
|
+
def setup_assets
|
16
|
+
config.assets.js_compressor = :uglifier
|
17
|
+
config.assets.compile = false
|
18
|
+
end
|
19
|
+
|
20
|
+
def setup_general
|
21
|
+
config.active_record.dump_schema_after_migration = false
|
22
|
+
config.cache_classes = true
|
23
|
+
config.eager_load = false
|
24
|
+
config.consider_all_requests_local = false
|
25
|
+
config.action_controller.perform_caching = true
|
26
|
+
config.read_encrypted_secrets = true
|
27
|
+
config.action_mailer.perform_caching = false
|
28
|
+
config.i18n.fallbacks = true
|
29
|
+
end
|
30
|
+
|
31
|
+
def setup_log
|
32
|
+
config.log_level = :debug
|
33
|
+
config.log_tags = [:request_id]
|
34
|
+
config.active_support.deprecation = :notify
|
35
|
+
config.log_formatter = ::Logger::Formatter.new
|
36
|
+
return if ENV['RAILS_LOG_TO_STDOUT'].blank?
|
37
|
+
|
38
|
+
logger = ActiveSupport::Logger.new(STDOUT)
|
39
|
+
logger.formatter = config.log_formatter
|
40
|
+
config.logger = ActiveSupport::TaggedLogging.new(logger)
|
41
|
+
end
|
42
|
+
|
43
|
+
def setup_public_file_server
|
44
|
+
config.public_file_server.enabled = ENV['RAILS_SERVE_STATIC_FILES'].present?
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'eac_ruby_utils/core_ext'
|
4
|
+
|
5
|
+
module EacRailsBase0App
|
6
|
+
class Application < Rails::Application
|
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
|
+
|
14
|
+
common_concern do
|
15
|
+
next unless ::Rails.env.test?
|
16
|
+
|
17
|
+
setup('action_controller', 'action_mailer', 'general', 'log', 'public_file_server')
|
18
|
+
end
|
19
|
+
|
20
|
+
module ClassMethods
|
21
|
+
def setup_action_controller
|
22
|
+
config.action_controller.perform_caching = false
|
23
|
+
config.action_controller.allow_forgery_protection = false
|
24
|
+
end
|
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
|
+
|
32
|
+
def setup_general
|
33
|
+
config.cache_classes = true
|
34
|
+
config.eager_load = false
|
35
|
+
|
36
|
+
config.consider_all_requests_local = true
|
37
|
+
config.action_controller.perform_caching = false
|
38
|
+
config.action_dispatch.show_exceptions = false
|
39
|
+
end
|
40
|
+
|
41
|
+
def setup_log
|
42
|
+
config.active_support.deprecation = :stderr
|
43
|
+
end
|
44
|
+
|
45
|
+
def setup_public_file_server
|
46
|
+
config.public_file_server.enabled = true
|
47
|
+
config.public_file_server.headers = {
|
48
|
+
'Cache-Control' => "public, max-age=#{1.hour.seconds.to_i}"
|
49
|
+
}
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
|
2
|
+
#
|
3
|
+
# If you find yourself ignoring temporary files generated by your text editor
|
4
|
+
# or operating system, you probably want to add a global ignore instead:
|
5
|
+
# git config --global core.excludesfile '~/.gitignore_global'
|
6
|
+
|
7
|
+
# Ignore bundler config.
|
8
|
+
/.bundle
|
9
|
+
|
10
|
+
<% if sqlite3? -%>
|
11
|
+
# Ignore the default SQLite database.
|
12
|
+
/db/*.sqlite3
|
13
|
+
/db/*.sqlite3-journal
|
14
|
+
|
15
|
+
<% end -%>
|
16
|
+
# Ignore all logfiles and tempfiles.
|
17
|
+
/log/*
|
18
|
+
!/log/.keep
|
19
|
+
/tmp
|
20
|
+
|
21
|
+
# Configuration files
|
22
|
+
config/database.y*ml
|
23
|
+
config/envvars.y*ml
|
24
|
+
config/envvars.d/*.y*ml
|
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.
|
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-
|
11
|
+
date: 2020-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: active_scaffold
|
@@ -353,7 +353,7 @@ dependencies:
|
|
353
353
|
- !ruby/object:Gem::Version
|
354
354
|
version: '0'
|
355
355
|
- !ruby/object:Gem::Dependency
|
356
|
-
name:
|
356
|
+
name: listen
|
357
357
|
requirement: !ruby/object:Gem::Requirement
|
358
358
|
requirements:
|
359
359
|
- - ">="
|
@@ -367,19 +367,33 @@ dependencies:
|
|
367
367
|
- !ruby/object:Gem::Version
|
368
368
|
version: '0'
|
369
369
|
- !ruby/object:Gem::Dependency
|
370
|
-
name:
|
370
|
+
name: puma
|
371
371
|
requirement: !ruby/object:Gem::Requirement
|
372
372
|
requirements:
|
373
373
|
- - ">="
|
374
374
|
- !ruby/object:Gem::Version
|
375
|
-
version:
|
375
|
+
version: '0'
|
376
376
|
type: :runtime
|
377
377
|
prerelease: false
|
378
378
|
version_requirements: !ruby/object:Gem::Requirement
|
379
379
|
requirements:
|
380
380
|
- - ">="
|
381
381
|
- !ruby/object:Gem::Version
|
382
|
-
version:
|
382
|
+
version: '0'
|
383
|
+
- !ruby/object:Gem::Dependency
|
384
|
+
name: rails
|
385
|
+
requirement: !ruby/object:Gem::Requirement
|
386
|
+
requirements:
|
387
|
+
- - "~>"
|
388
|
+
- !ruby/object:Gem::Version
|
389
|
+
version: 5.1.7
|
390
|
+
type: :runtime
|
391
|
+
prerelease: false
|
392
|
+
version_requirements: !ruby/object:Gem::Requirement
|
393
|
+
requirements:
|
394
|
+
- - "~>"
|
395
|
+
- !ruby/object:Gem::Version
|
396
|
+
version: 5.1.7
|
383
397
|
- !ruby/object:Gem::Dependency
|
384
398
|
name: rails-i18n
|
385
399
|
requirement: !ruby/object:Gem::Requirement
|
@@ -563,10 +577,13 @@ files:
|
|
563
577
|
- app/assets/stylesheets/eac_rails_base0/components.scss
|
564
578
|
- app/assets/stylesheets/eac_rails_base0/default_configuration.scss
|
565
579
|
- app/controllers/eac_rails_base0/application_controller.rb
|
580
|
+
- app/controllers/eac_rails_base0/mailer_controller.rb
|
566
581
|
- app/helpers/eac_rails_base0/app_version_helper.rb
|
567
582
|
- app/helpers/eac_rails_base0/layout_helper.rb
|
568
583
|
- app/helpers/eac_rails_base0/panel_default_helper.rb
|
584
|
+
- app/mailers/eac_rails_base0/send_test_mailer.rb
|
569
585
|
- app/models/eac_rails_base0/application_record.rb
|
586
|
+
- app/tableless_models/eac_rails_base0/email_send_test.rb
|
570
587
|
- app/uploaders/eac_rails_base0/default_file_uploader.rb
|
571
588
|
- app/views/devise/confirmations/new.html.erb
|
572
589
|
- app/views/devise/mailer/confirmation_instructions.html.erb
|
@@ -577,6 +594,9 @@ files:
|
|
577
594
|
- app/views/devise/registrations/new.html.erb
|
578
595
|
- app/views/devise/sessions/new.html.erb
|
579
596
|
- app/views/devise/shared/_links.html.erb
|
597
|
+
- app/views/eac_rails_base0/mailer/info.html.erb
|
598
|
+
- app/views/eac_rails_base0/mailer/send_test.html.erb
|
599
|
+
- app/views/eac_rails_base0/send_test_mailer/main.html.erb
|
580
600
|
- app/views/layouts/eac_rails_base0/_flash.html.erb
|
581
601
|
- app/views/layouts/eac_rails_base0/_main_menu.html.erb
|
582
602
|
- app/views/layouts/eac_rails_base0/_navbar_user.html.erb
|
@@ -593,9 +613,9 @@ files:
|
|
593
613
|
- config/initializers/filter_parameter_logging.rb
|
594
614
|
- config/initializers/mime_types.rb
|
595
615
|
- config/initializers/patches.rb
|
596
|
-
- config/initializers/pg_deprecated_constants.rb
|
597
616
|
- config/initializers/session_store.rb
|
598
617
|
- config/initializers/wrap_parameters.rb
|
618
|
+
- config/locales/en.yml
|
599
619
|
- config/locales/pt-BR.yml
|
600
620
|
- config/routes.rb
|
601
621
|
- exe/eac_rails_base0_app
|
@@ -603,6 +623,11 @@ files:
|
|
603
623
|
- lib/eac_rails_base0/app_base/ability.rb
|
604
624
|
- lib/eac_rails_base0/app_base/ability_mapping.rb
|
605
625
|
- lib/eac_rails_base0/app_base/application.rb
|
626
|
+
- lib/eac_rails_base0/app_base/application/all.rb
|
627
|
+
- lib/eac_rails_base0/app_base/application/development.rb
|
628
|
+
- lib/eac_rails_base0/app_base/application/envvars.rb
|
629
|
+
- lib/eac_rails_base0/app_base/application/production.rb
|
630
|
+
- lib/eac_rails_base0/app_base/application/test.rb
|
606
631
|
- lib/eac_rails_base0/app_generator/builder.rb
|
607
632
|
- lib/eac_rails_base0/app_generator/generator.rb
|
608
633
|
- lib/eac_rails_base0/app_generator/templates/Gemfile
|
@@ -625,6 +650,7 @@ files:
|
|
625
650
|
- lib/eac_rails_base0/app_generator/templates/config/environments/production.rb
|
626
651
|
- lib/eac_rails_base0/app_generator/templates/config/environments/test.rb
|
627
652
|
- lib/eac_rails_base0/app_generator/templates/config/routes.rb
|
653
|
+
- lib/eac_rails_base0/app_generator/templates/gitignore
|
628
654
|
- lib/eac_rails_base0/app_generator/templates/lib/local_plugins.rb
|
629
655
|
- lib/eac_rails_base0/boolean_value.rb
|
630
656
|
- lib/eac_rails_base0/engine.rb
|
@@ -1,37 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
# File: lib/pg/deprecated_constants.rb
|
4
|
-
#
|
5
|
-
# This file overrides the pg gem's pg/deprecated_constants.rb file and so
|
6
|
-
# its warning message is not printed. Avoiding this warning message helps
|
7
|
-
# clean up the app startup and test output.
|
8
|
-
#
|
9
|
-
# This behaviour relies on lib/ being ahead of the pg gem in $LOAD_PATH and
|
10
|
-
# these lines from the pg gem's lib/pg.rb file:
|
11
|
-
# autoload :PGError, 'pg/deprecated_constants'
|
12
|
-
# autoload :PGconn, 'pg/deprecated_constants'
|
13
|
-
# autoload :PGresult, 'pg/deprecated_constants'
|
14
|
-
#
|
15
|
-
# Your config/application.rb may need to modify autoload_paths to ensure
|
16
|
-
# the lib/ dir is ahead of the pg gem install path in $LOAD_PATH:
|
17
|
-
#
|
18
|
-
# config.autoload_paths << Rails.root.join('lib')
|
19
|
-
#
|
20
|
-
if (PG::VERSION != '0.21.0') || (ActiveRecord.version.to_s != '4.2.11.3')
|
21
|
-
::Rails.logger.warn(<<~MSG)
|
22
|
-
-----------------------------------------------------------------------------------
|
23
|
-
The pg and/or activerecord gem version has changed, meaning deprecated pg constants
|
24
|
-
may no longer be in use, so try deleting this file to see if the
|
25
|
-
'The PGconn, PGresult, and PGError constants are deprecated...' message has gone:
|
26
|
-
#{__FILE__}
|
27
|
-
-----------------------------------------------------------------------------------
|
28
|
-
|
29
|
-
MSG
|
30
|
-
end
|
31
|
-
|
32
|
-
# Declare the deprecated constants as is done in the original
|
33
|
-
# pg/deprecated_constants.rb so they can still be used by older
|
34
|
-
# versions of gems such as activerecord.
|
35
|
-
PGconn = PG::Connection
|
36
|
-
PGresult = PG::Result
|
37
|
-
PGError = PG::Error
|