Module: LatoCore::Interface::Application
- Included in:
- LatoCore::Interface
- Defined in:
- lib/lato_core/interfaces/application.rb
Overview
This module contains a list of functions used to get application informations. Information about the application are saved on a global variable APPLICATION.
Instance Method Summary collapse
-
#core__get_application_gems ⇒ Object
This function return the list of gems used by the application.
-
#core__get_application_language ⇒ Object
This function return the default language set on main application (I18l).
-
#core__get_application_lato_configs_path ⇒ Object
This function create and return the path of configs on main application.
-
#core__get_application_logo_path ⇒ Object
This function return the path of the application logo.
-
#core__get_application_logo_sidebar_path ⇒ Object
This function return the path of the application logo for the sidebar.
-
#core__get_application_root_path ⇒ Object
This function return the root path of the application.
Instance Method Details
#core__get_application_gems ⇒ Object
This function return the list of gems used by the application.
13 14 15 16 17 18 19 |
# File 'lib/lato_core/interfaces/application.rb', line 13 def core__get_application_gems gems = {} Bundler.load.specs.each do |spec| gems[spec.name] = spec.version end gems end |
#core__get_application_language ⇒ Object
This function return the default language set on main application (I18l).
8 9 10 |
# File 'lib/lato_core/interfaces/application.rb', line 8 def core__get_application_language I18n.locale end |
#core__get_application_lato_configs_path ⇒ Object
This function create and return the path of configs on main application.
56 57 58 59 60 61 62 |
# File 'lib/lato_core/interfaces/application.rb', line 56 def core__get_application_lato_configs_path absolute_path = "#{core__get_application_root_path}/config/lato" # create directory if not exist FileUtils.mkdir_p(absolute_path) unless File.exist?(absolute_path) # return directory absolute_path end |
#core__get_application_logo_path ⇒ Object
This function return the path of the application logo.
42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/lato_core/interfaces/application.rb', line 42 def core__get_application_logo_path dir = "#{core__get_application_root_path}/app/assets/images/lato/" if File.exist?("#{dir}/logo.svg") return 'lato/logo.svg' elsif File.exist?("#{dir}/logo.png") return 'lato/logo.png' elsif File.exist?("#{dir}/logo.jpg") return 'lato/logo.jpg' elsif File.exist?('#{dir}/logo.gif') return 'lato/logo.gif' end end |
#core__get_application_logo_sidebar_path ⇒ Object
This function return the path of the application logo for the sidebar.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/lato_core/interfaces/application.rb', line 27 def dir = "#{core__get_application_root_path}/app/assets/images/lato/" if File.exist?("#{dir}/logo_sidebar.svg") return 'lato/logo_sidebar.svg' elsif File.exist?("#{dir}/logo_sidebar.png") return 'lato/logo_sidebar.png' elsif File.exist?("#{dir}/logo_sidebar.jpg") return 'lato/logo_sidebar.jpg' elsif File.exist?("#{dir}/logo_sidebar.gif") return 'lato/logo_sidebar.gif' end core__get_application_logo_path end |
#core__get_application_root_path ⇒ Object
This function return the root path of the application.
22 23 24 |
# File 'lib/lato_core/interfaces/application.rb', line 22 def core__get_application_root_path Rails.root.to_s end |