Git Product home page Git Product logo

envb-rails's Introduction

envb-rails

A super easy way to display what Rails environment you're currently running in.

There were other gems that do this, but they are kind of ugly and display other extraneous information that I didn't find relevant.

envb-rails in action!

Installation

Add the envb-rails gem to your Gemfile. Then run bundle install.

gem 'envb-rails'

Usage

Require the envb stylesheet at the top of your asset manifest.

*= require envb
*= require_self
...

As long as you don't want to customize any default behavior, that's it!

Excluding environment names

By default envb-rails will not render a banner on the production environment.

To exclude the banner from other environments you can create config/initializers/envb.rb and modify the array of excluded environment names. For example, if you wanted to exclude on staging as well as production:

Envb::Rails.options[:excludes] = %w(production staging)

Or to alternatively have it render on production as well, you can use an empty array:

Envb::Rails.options[:excludes] = []

After creating or changing this initializer you must recompile your assets. In development mode this is as easy as running rake assets:clean. For non-local environments, most deployment systems will recompile with every deploy or you should be able to set them to.

Customization

By default envb-rails will colorize the environment banners in the following combinations, development:purple, acceptance:aqua, staging:orange, and production:red. Other custom named environments will be a default (gray) color.

If you would like to customize the colors or add environment names you can further modify your config/initializers/envb.rb file with the following:

Envb::Rails.options[:colors].update({
    custom_name: '#xxxxxx',
    another_name: 'rgb(x, x, x)',
    one_more: '$envb_green'
})

As you can see, you should be able to use any valid CSS color model to specify the color of the banner. You may also use the built in envb color variables which are:

$envb_gray:                   #969896;
$envb_red:                    #cc6666;
$envb_orange:                 #de935f;
$envb_yellow:                 #f0c674;
$envb_green:                  #b5bd68;
$envb_aqua:                   #8abeb7;
$envb_blue:                   #81a2be;
$envb_purple:                 #b294bb;

As with excluding environments, when you change the initializer you must recompile your assets.

Attribution


Copyright © 2013 Joe Bilt.

envb-rails's People

Contributors

ciniglio avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.