Add VERSION constant for runtime usage

Introduce `Radix::VERSION` to be used at runtime by users of the
library for any purpose this will help them (expose them, use
conditional blocks or similar).

Also add spec that checks that defined versions in both `shard.yml`
and `Radix::VERSION` matches to avoid messing up releases.
This commit is contained in:
Luis Lavena 2016-05-16 20:37:41 -03:00
parent 54d3b627a2
commit 77789be285
4 changed files with 20 additions and 0 deletions

View File

@ -5,6 +5,8 @@ This project aims to comply with [Semantic Versioning](http://semver.org/),
so please check *Changed* and *Removed* notes before upgrading.
## [Unreleased]
### Added
- Introduce `Radix::VERSION` so library version can be used at runtime.
## [0.3.0] - 2016-04-16
### Fixed

View File

@ -0,0 +1,14 @@
require "../spec_helper"
require "yaml"
module Radix
describe VERSION do
it "matches version defined in shard.yml" do
contents = File.read(File.expand_path("../../../shard.yml", __FILE__))
meta = YAML.parse(contents)
meta["version"]?.should_not be_falsey
Radix::VERSION.should eq(meta["version"].as_s)
end
end
end

View File

@ -1 +1,2 @@
require "./radix/tree"
require "./radix/version"

3
src/radix/version.cr Normal file
View File

@ -0,0 +1,3 @@
module Radix
VERSION = "0.3.0"
end