README.md in envlogic-1.1.0 vs README.md in envlogic-1.1.1

- old
+ new

@@ -1,21 +1,23 @@ # Envlogic -[![Build Status](https://travis-ci.org/karafka/envlogic.png)](https://travis-ci.org/karafka/envlogic) +[![Build Status](https://github.com/karafka/envlogic/workflows/ci/badge.svg)](https://github.com/karafka/envlogic/actions?query=workflow%3Aci) [![Join the chat at https://gitter.im/karafka/karafka](https://badges.gitter.im/karafka/karafka.svg)](https://gitter.im/karafka/karafka?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Envlogic is a library used to manage environments for your Ruby application in a similar to Rails.env way. ## Installation -Add gem to your Gemfile +Add the gem to your Gemfile ```ruby gem 'envlogic' ``` ## Usage +### On a class/module level + Extend your class or module in which you want to use this library with **Envlogic** module. ```ruby module ExampleModule extend Envlogic @@ -32,15 +34,38 @@ ExampleModule.env = 'development' ExampleModule.env.development? # => true ExampleModule.env.production? # => false ``` +### On a per instance basis + +Include the **Envlogic** module in the class for which instances you want to use it. + +```ruby +class ExampleClass + include Envlogic + # code of this class +end +``` + +Once you include it in your class, you will have two additional methods (with two aliases): + + - *.env* (.environment) - obtain current env and work with it + - *.env=* (.environment=) - set your own environment + +```ruby + instance = ExampleClass.new + instance.env = 'development' + instance.env.development? # => true + instance.env.production? # => false +``` + ### ENV variables key names and default fallbacks #### Application root directory env key name -By default gem is looking for ENV variable that is based on your application root directory. +By default, the gem is looking for ENV variable that is based on your application root directory. For example, if your application lies in */home/deploy/my_app* it will look for **MY_APP_ENV** variable. #### Module/class name based env key name @@ -90,10 +115,10 @@ ## Note on contributions First, thank you for considering contributing to Envlogic! It's people like you that make the open source community such a great community! -Each pull request must pass all the rspec specs and meet our quality requirements. +Each pull request must pass all the RSpec specs and meet our quality requirements. To check if everything is as it should be, we use [Coditsu](https://coditsu.io) that combines multiple linters and code analyzers for both code and documentation. Once you're done with your changes, submit a pull request. Coditsu will automatically check your work against our quality standards. You can find your commit check results on the [builds page](https://app.coditsu.io/karafka/repositories/envlogic/builds/commit_builds) of Envlogic repository.