1
0
mirror of https://github.com/meineerde/rackstash.git synced 2026-02-01 01:37:12 +00:00

Separate the PRERELEASE version part with a dash instead of a dot

This commit is contained in:
Holger Just 2017-07-05 19:21:24 +02:00
parent d6c3111999
commit e96a0aaf94
2 changed files with 11 additions and 5 deletions

View File

@ -18,9 +18,6 @@ module Rackstash
# versions like beta or RC releases.
PRERELEASE = 'dev'.freeze
# A standard string representation of the version parts
STRING = [MAJOR, MINOR, PATCH, PRERELEASE].compact.join('.').freeze
# @return [Gem::Version] the version of the currently loaded Rackstash as
# a `Gem::Version`
def self.gem_version
@ -30,8 +27,15 @@ module Rackstash
# @return [String] the Rackstash version as a semver-compliant string
# @see http://semver.org/
def self.to_s
STRING
@version ||= begin
base_version = [MAJOR, MINOR, PATCH].compact.join('.')
release = [base_version, PRERELEASE].compact.join('-')
release.freeze
end
end
# A standard string representation of the version parts
STRING = to_s
end
# The Rackstash version as a semver-compliant string

View File

@ -10,6 +10,7 @@ require 'rackstash/version'
describe 'Rackstash::Version' do
it 'has a version number' do
expect(Rackstash::Version::STRING).to be_a String
expect(Rackstash::Version::STRING).to equal Rackstash::Version.to_s
end
it 'exposes the version as Rackstash::VERSION' do
@ -18,6 +19,7 @@ describe 'Rackstash::Version' do
it 'exposes a gem_version method' do
expect(Rackstash::Version.gem_version).to be_a Gem::Version
expect(Rackstash::Version.gem_version.to_s).to eql Rackstash::VERSION
expect(Rackstash::Version.gem_version.to_s.gsub('.pre.', '-'))
.to eql Rackstash::VERSION
end
end