Skip to content

Instantly share code, notes, and snippets.

@tolleiv
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tolleiv/126f2c13303bd07a35ec to your computer and use it in GitHub Desktop.
Save tolleiv/126f2c13303bd07a35ec to your computer and use it in GitHub Desktop.
Dump environment from Ruby / a Chef recipe to a file. That file can be used with "source /environment.sh" to set the missing variables in a session later on.
# Dump environment for debugging purpose
file '/environment.sh' do
content ENV.reduce("#!/bin/bash\n") { |s, e| s+="export #{e[0]}=$\{#{e[0]}:?#{e[1]}\}\n" }
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment