Module: EacRailsBase0App::Application::All::ClassMethods

Defined in:
lib/eac_rails_base0/app_base/application/all.rb

Instance Method Summary collapse

Instance Method Details

#app_temporary_directoryString

Returns:

  • (String)


19
20
21
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 19

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

#setup_app_rootObject



23
24
25
26
27
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 23

def setup_app_root
  return unless defined?(APP_PATH)

  config.root = find_root(APP_PATH)
end

#setup_assets_cacheObject



29
30
31
32
33
34
35
36
37
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 29

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

#setup_defaultsObject



57
58
59
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 57

def setup_defaults
  config.load_defaults 5.1
end

#setup_dependenciesObject



61
62
63
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 61

def setup_dependencies
  require 'carrierwave'
end

#setup_deprecated_migrationsObject



65
66
67
68
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 65

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

#setup_enginesObject



45
46
47
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 45

def setup_engines
  require 'eac_rails_base0/engine'
end

#setup_fs_cache_contextObject



39
40
41
42
43
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 39

def setup_fs_cache_context
  ::EacFs::Contexts.cache.push(
    ::EacFs::StorageTree.new(::Rails.root.join('tmp/cache/eac_fs'))
  )
end

#setup_load_pathsObject



70
71
72
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 70

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

#setup_local_enginesObject



49
50
51
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 49

def setup_local_engines
  ::EacRailsBase0::XEngine.require_local
end

#setup_localizationObject



74
75
76
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 74

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

#setup_loggersObject



78
79
80
81
82
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 78

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

#setup_unknown_asset_fallbackObject



53
54
55
# File 'lib/eac_rails_base0/app_base/application/all.rb', line 53

def setup_unknown_asset_fallback
  config.assets.unknown_asset_fallback = false
end