Module: Nucleus::VersionDetector

Defined in:
lib/nucleus/core/import/version_detector.rb

Class Method Summary collapse

Class Method Details

.api_versionsArray<String>

Get all abstraction layer versions that are included in the project via the adapters. The abstraction layer versions are identified by the presence of a directory below ‘adapters/’. An abstraction layer’s directory will resolve to its version. Therefore, if there is a directory ‘adapters/v3’, ‘v3’ will be on of the returned versions. The method caches its detected versions and returns the previous result if called multiple times.

Returns:

  • (Array<String>)

    names of the abstraction layer versions



10
11
12
13
14
15
16
# File 'lib/nucleus/core/import/version_detector.rb', line 10

def self.api_versions
  return @api_versions if @api_versions
  abstraction_layer_api_versions_dir = "#{Nucleus.root}/lib/nucleus/adapters/*"
  @api_versions = Dir.glob(abstraction_layer_api_versions_dir).map do |f|
    File.basename(f) if File.directory?(f)
  end.compact
end