Sha256: 312fda1bc8c3939a9d1e725738f9d5c30e5350cf230abf85af7ec9076abb934c

Contents?: true

Size: 976 Bytes

Versions: 1

Compression:

Stored size: 976 Bytes

Contents

# frozen_string_literal: true

module PuppetEditorServices
  PUPPETEDITORSERVICESVERSION = '2.0.4' unless defined? PUPPETEDITORSERVICESVERSION

  # @api public
  #
  # @return [String] containing the editor services version, e.g. "0.4.0"
  def self.version
    return @editor_services_version if @editor_services_version

    version_file = File.join(File.dirname(__FILE__), 'VERSION')
    version = read_version_file(version_file)

    @editor_services_version = version.nil? ? PUPPETEDITORSERVICESVERSION : version
  end

  # Sets the editor services version
  # Typically only used in testing
  #
  # @return [void]
  #
  # @api private
  def self.version=(version)
    @editor_services_version = version
  end

  # @api private
  #
  # @return [String] the version -- for example: "0.4.0" or nil if the VERSION
  #   file does not exist.
  def self.read_version_file(path)
    File.read(path).chomp if File.exist?(path)
  end
  private_class_method :read_version_file
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
puppet-editor-services-2.0.4 lib/puppet_editor_services/version.rb