Module: NewRelic::VERSION

Defined in:
lib/new_relic/version.rb

Overview

:nodoc:

Constant Summary collapse

GEMSPEC_PATH =
File.join(File.dirname(__FILE__), '..', '..', 'newrelic_rpm.gemspec')
MAJOR =
3
MINOR =
5
TINY =
4
BUILD =
parse_build_from_gemspec(GEMSPEC_PATH)
STRING =
[MAJOR, MINOR, TINY, BUILD].compact.join('.')

Class Method Summary collapse

Class Method Details

.parse_build_from_gemspec(path) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/new_relic/version.rb', line 5

def self.parse_build_from_gemspec(path)
  if File.exist?(path)
    version_string = if Kernel.const_defined?(:Gem)
      spec = Gem::Specification.load(path)
      spec.version.to_s if spec
    else
      md = File.read(path).match(/s\.version\s*=\s*"(.*)"/)
      md[1] if md
    end
    version_string && version_string.split('.', 4)[3]
  end
end