Module: EacRailsBase0::AppVersionHelper

Defined in:
app/helpers/eac_rails_base0/app_version_helper.rb

Instance Method Summary collapse

Instance Method Details

#base0_app_versionObject



5
6
7
8
9
# File 'app/helpers/eac_rails_base0/app_version_helper.rb', line 5

def base0_app_version
  base0_app_version_by_environment_variable ||
    base0_app_version_by_version_file ||
    ::I18n.t('eac_rails_base0.app_version.unsetted')
end

#base0_app_version_by_environment_variableObject



11
12
13
# File 'app/helpers/eac_rails_base0/app_version_helper.rb', line 11

def base0_app_version_by_environment_variable
  ENV['APP_VERSION'].to_s.strip.presence
end

#base0_app_version_by_version_fileObject



15
16
17
18
# File 'app/helpers/eac_rails_base0/app_version_helper.rb', line 15

def base0_app_version_by_version_file
  ::Rails.root.children.find { |file| file.basename.to_path.downcase == 'version' }
    .if_present { |file| file.read.presence }
end