Project

rinfo

0.0
No commit activity in last 3 years
No release in over 3 years
Generates an rinfo.json page for your Rails app
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0
>= 3
 Project Readme

Rinfo

Gem Version Build Status Code Climate

Usage

Ever wish you could have quick and easy access to release information ("rinfo") about your Rails application's latest release? Well now you can!

Rinfo adds the following route to your application:

get '/rinfo.json'

Accessing your rinfo.json page will product something like this:

{
  deployed_by: "Rafe Colton",
  deployed_at: "2014-03-17 15:18:35 -0700",
  rails_env: "development",
  branch: "master",
  rev: "018f44579795167c56066c013b4b18e196142ecb"
}

It's as easy as that!

A Note About Estimation

It is not always the case that the release information above is available, so sometimes, it has to be estimated. In addition, Rinfo does not make any assumptions about how you deploy your application, and not all deployment methods make it possible to inject your release information at deploy time. Therefore, the following estimations are made at run time:

  • deployed_by: estimated as the git config user.name, or, if that is not available, the author name on the most recent commit
  • deployed_at: estimated as timestamp of the most recent commit

Installation

To add rinfo to your Rails application, add the rinfo gem to your Gemfile:

# Gemfile
gem 'rinfo'

Then, to install the gem:

bundle install

Configuring

Rinfo's functionality is extremely simple, and it doesn't require any configuration, but should you desire, it is configurable.

Your configuration file config/initializers/rinfo.rb would look something like this:

# config/initializers/rinfo.rb
Rinfo.env_blacklist = :prod, :production

Rinfo.filename = 'rinfo.json'

env_blacklist

The env_blacklist attribute is a list of environments such that if it includes your RAILS_ENV, the /rinfo.json route will return a 404 response insetad of a JSON blob. The arguments provided can be a string, an array, or a comma separated list, and each entry can be either a string or a symbol. The default blacklist is [:prod, :production]

NOTE: There is one special value :all, which, if included in your list, will prevent rinfo.json from showing up entirely, regardless of your RAILS_ENV

filename

The filename attribute allows you to set the filename at which your release information is available. The default value of rinfo.json will mean your file is available at /rinfo.json.

Contributing

  1. Fork it
  2. Do your thing
  3. Submit a pull request