Sha256: fc409e31b7af0d4eb4c163bfb8631ca931c9f2fc5f9a2e19444b73e3f9f2ecf2

Contents?: true

Size: 1.53 KB

Versions: 11

Compression:

Stored size: 1.53 KB

Contents

# frozen_string_literal: true

require 'eac_ruby_utils/core_ext'

module EacRailsBase0App
  class Application < Rails::Application
    module All
      common_concern do
        setup('assets_cache', 'dependencies', 'localization', 'load_paths', 'loggers')
      end

      module ClassMethods
        def app_temporary_directory
          ::File.join(::Dir.tmpdir, ::Rails.root.to_path.parameterize, 'tmp')
        end

        def rails_root(dir)
          return dir if ::File.exist?(::File.join(dir, 'config.ru'))
          raise 'config.ru not found in ascendent path' if dir == '/'

          rails_root(::File.dirname(dir))
        end

        def setup_assets_cache
          config.assets.configure do |env|
            env.cache = Sprockets::Cache::FileStore.new(
              ::File.join(app_temporary_directory, 'cache', 'assets'),
              config.assets.cache_limit,
              env.logger
            )
          end
        end

        def setup_dependencies
          require 'carrierwave'
        end

        def setup_deprecated_migrations
          path = ::Rails.root.join('db', 'migrate_deprecated')
          config.paths['db/migrate'] << path if path.directory?
        end

        def setup_load_paths
          config.autoload_paths << Rails.root.join('lib')
        end

        def setup_localization
          config.i18n.default_locale = :'pt-BR'
        end

        def setup_loggers
          config.after_initialize do
            ActiveRecord::Base.logger = nil
          end
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
eac_rails_base0-0.54.0 lib/eac_rails_base0/app_base/application/all.rb
eac_rails_base0-0.53.0 lib/eac_rails_base0/app_base/application/all.rb
eac_rails_base0-0.52.3 lib/eac_rails_base0/app_base/application/all.rb
eac_rails_base0-0.52.2 lib/eac_rails_base0/app_base/application/all.rb
eac_rails_base0-0.52.1 lib/eac_rails_base0/app_base/application/all.rb
eac_rails_base0-0.52.0 lib/eac_rails_base0/app_base/application/all.rb
eac_rails_base0-0.51.0 lib/eac_rails_base0/app_base/application/all.rb
eac_rails_base0-0.50.0 lib/eac_rails_base0/app_base/application/all.rb
eac_rails_base0-0.49.0 lib/eac_rails_base0/app_base/application/all.rb
eac_rails_base0-0.48.1 lib/eac_rails_base0/app_base/application/all.rb
eac_rails_base0-0.48.0 lib/eac_rails_base0/app_base/application/all.rb