Sha256: 2a810dacb542f0ec27de464f26ae6ab22816ccb020f78b1e0126dc1912cc1b2c

Contents?: true

Size: 913 Bytes

Versions: 3

Compression:

Stored size: 913 Bytes

Contents

module Nucleus
  module VersionDetector
    # 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.
    #
    # @return [Array<String>] names of the abstraction layer versions
    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
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nucleus-0.3.1 lib/nucleus/core/import/version_detector.rb
nucleus-0.2.0 lib/nucleus/core/import/version_detector.rb
nucleus-0.1.0 lib/nucleus/core/import/version_detector.rb