Module: Padrino::ApplicationSetup::ClassMethods

Defined in:
padrino-core/lib/padrino-core/application/application_setup.rb

Instance Method Summary collapse

Instance Method Details

#default_configuration!Object

Defines default settings for Padrino application.



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'padrino-core/lib/padrino-core/application/application_setup.rb', line 14

def default_configuration!
  set :app_file, File.expand_path(caller_files.first || $0)
  set :app_name, Inflections.underscore(settings).to_sym

  set :environment, Padrino.env
  set :reload, proc { development? }
  set :logging, proc { development? }

  set :method_override, true
  set :default_builder, 'StandardFormBuilder'

  default_paths
  default_security
  global_configuration
  setup_prerequisites
end

#precompile_routes!Object



51
52
53
54
# File 'padrino-core/lib/padrino-core/application/application_setup.rb', line 51

def precompile_routes!
  compiled_router.prepare!
  compiled_router.engine.compile!
end

#precompile_routes?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'padrino-core/lib/padrino-core/application/application_setup.rb', line 47

def precompile_routes?
  settings.respond_to?(:precompile_routes) && settings.precompile_routes?
end

#setup_application!TrueClass

Setup the application by registering initializers, load paths and logger. Invoked automatically when an application is first instantiated.

Returns:

  • (TrueClass)


37
38
39
40
41
42
43
44
45
# File 'padrino-core/lib/padrino-core/application/application_setup.rb', line 37

def setup_application!
  return if @_configured
  require_dependencies
  default_routes
  default_errors
  setup_locale
  precompile_routes!
  @_configured = true
end