Managing ENV configuration in development
There are a few tools I've come across over the past couple years for managing local configuration via ENV. One which comes to mind is dotenv. Since I use pow to serve my Rails applications in development, I've always just exported environment variables in a local .powenv file. It's simple, effective and doesn't require any extra tooling.
I recently deployed a client project with the talented folks over at Blue Box, and one of their ops guys introduced me to .rbenv-vars. While using .powenv was fine, .rbenv-vars has a distinct advantage: I no longer must type
source .powenv when running commands in my shell (or create separate configuration to automate it). Every time Ruby is executed, the project's configuration is magically available.
I hadn't tried this on my local machine until just now, when I got tired of manually including Code Climate's repo token when running tests:
My first attempt to get .rbenv-vars up and running was to follow the instructions on their GitHub page. This didn't work for whatever reason, so I uninstalled the plugin (
rm -rf ~/.rbenv/plugins/rbenv-vars) and ran:
Boom. Next, I created a local .rbenv-vars file in my project directory:
Lastly, I gitignored this file globally so that I wouldn't accidentally commit it on future projects:
Now, whenever I run
rake, Code Climate gets updated with the latest test coverage. Easy!
No webmentions were found.