Skip to content

luxflux/version_reader

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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.

About

Small Gem to read your version file

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages