Module: Avm::Sources::Base::Application

Defined in:
lib/avm/sources/base/application.rb

Constant Summary collapse

APPLICATION_NAME_KEY =
'application'

Instance Method Summary collapse

Instance Method Details

#applicationAvm::Applications::Base



14
15
16
# File 'lib/avm/sources/base/application.rb', line 14

def application
  @application ||= ::Avm::Applications::Base.new(application_id)
end

#application_idString

Returns:

  • (String)


19
20
21
# File 'lib/avm/sources/base/application.rb', line 19

def application_id
  application_id_by_configuration || application_id_by_directory
end

#application_id_by_configurationString?

Returns:

  • (String, nil)


24
25
26
# File 'lib/avm/sources/base/application.rb', line 24

def application_id_by_configuration
  configuration.entry(APPLICATION_NAME_KEY).value
end

#application_id_by_directoryString

Returns:

  • (String)


29
30
31
32
# File 'lib/avm/sources/base/application.rb', line 29

def application_id_by_directory
  path.basename.to_path.gsub(::EacConfig::EntryPath::PART_SEPARATOR, '-')
    .gsub(/\A-+/, '').gsub(/-+\z/, '')
end