mirror of
https://github.com/meineerde/rackstash.git
synced 2026-01-31 17:27:13 +00:00
Add more useful version specification.
This commit is contained in:
parent
572b95c580
commit
5dc6af0220
@ -4,5 +4,36 @@
|
||||
# of the MIT license. See the LICENSE.txt file for details.
|
||||
|
||||
module Rackstash
|
||||
VERSION = '0.1.0'
|
||||
# Version information about Rackstash.
|
||||
module Version
|
||||
# MAJOR version. It is incremented after incompatible API changes
|
||||
MAJOR = 0
|
||||
# MINOR version. It is incremented after adding functionality in a
|
||||
# backwards-compatible manner
|
||||
MINOR = 1
|
||||
# PATCH version. It is incremented when making backwards-compatible
|
||||
# bug-fixes.
|
||||
PATCH = 0
|
||||
# PRERELEASE suffix. Set to a alphanumeric string on any pre-release
|
||||
# versions like beta or RC releases.
|
||||
PRERELEASE = nil
|
||||
|
||||
# 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
|
||||
Gem::Version.new to_s
|
||||
end
|
||||
|
||||
# @return [String] the Rackstash version as a semver-compliant string
|
||||
def self.to_s
|
||||
STRING
|
||||
end
|
||||
end
|
||||
|
||||
# The Rackstash version as a semver-compliant string
|
||||
# @see Version::STRING
|
||||
VERSION = Version::STRING
|
||||
end
|
||||
|
||||
23
spec/rackstash/version_spec.rb
Normal file
23
spec/rackstash/version_spec.rb
Normal file
@ -0,0 +1,23 @@
|
||||
# Copyright 2017 Holger Just
|
||||
#
|
||||
# This software may be modified and distributed under the terms
|
||||
# of the MIT license. See the LICENSE.txt file for details.
|
||||
|
||||
require 'spec_helper'
|
||||
|
||||
require 'rackstash/version'
|
||||
|
||||
describe 'Rackstash::Version' do
|
||||
it 'has a version number' do
|
||||
expect(Rackstash::Version::STRING).to be_a String
|
||||
end
|
||||
|
||||
it 'exposes the version as Rackstash::VERSION' do
|
||||
expect(Rackstash::VERSION).to equal Rackstash::Version::STRING
|
||||
end
|
||||
|
||||
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
|
||||
end
|
||||
end
|
||||
@ -6,11 +6,4 @@
|
||||
require 'spec_helper'
|
||||
|
||||
describe Rackstash do
|
||||
it 'has a version number' do
|
||||
expect(Rackstash::VERSION).not_to be nil
|
||||
end
|
||||
|
||||
it 'does something useful' do
|
||||
expect(false).to eq(true)
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user