No commit activity in last 3 years
No release in over 3 years
Greps all Ruby files below the given starting_dir for usage of the ENV hash to ensure that any ENV vars used have been defined.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

Env Vars Validator

Greps all Ruby files below the given starting dir for usage of the ENV hash and ensures that any ENV vars used have been defined.

Install

gem install env_vars_validator

Example Usage

(assuming this code is placed in the entry point script at the root of your project's source tree)

require 'env_vars_validator'

unless EnvVarsValidator.validate(File.dirname(__FILE__))
  puts EnvVarsValidator.last_error
  exit(1)
end

EnvVarsValidator.validate takes a directory as its single argument. It will scan the source code of all *.rb files in the directory tree starting at the directory it was passed (excluding any "vendor" folders). The method returns true if all ENV vars used in your source code have been declared, false otherwise. In the event that the method returns false, EnvVarsValidator.last_error will be populated with a descriptive error message something like this:

The following env vars are required and have not been defined:
  DB_USER
  DB_PASS