Small Gem to read your version file
Ruby
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.ruby-gemset
.ruby-version
.travis.yml
.watchr
Gemfile
Gemfile.lock
README.md
Rakefile
VERSION
version_reader.gemspec

README.md

version_reader Build Status Code Climate

Small Gem to read your version file.

Usage

Assuming you have a file ~/CoolApp/VERSION with the content of 0.4.2\n.

require 'version_reader'

version_reader = VersionReader.new('~/CoolApp/VERSION')
version_reader.normal # 0.4.2

Rails integration

If you add this gem to your Gemfile of a Rails application it will automatically define CoolApp::Application.version and fill in a Rails-flavored VersionReader instance.

Flavors

Flavors are an easy way to extend a VersionReader object with additional informations.

Rails

The Rails flavor adds some additional methods which also show some information about the current Rails-Environment.

rails_env

Always adds the current Rails-Environment to the version. Maybe useful to see whether this is staging or not :)

CoolApp::Application.version.rails_env

Output would be 0.4.2-development.

rails_env_without

Adds the current Rails-Environment if it does not match one of the given environments.

CoolApp::Application.version.rails_env_without(:production,:staging)

Output would be 0.4.2-development or 0.4.2 for staging and production.