Skip to content

Instantly share code, notes, and snippets.

@jmettraux
Created August 23, 2011 21:21
Show Gist options
  • Save jmettraux/1166586 to your computer and use it in GitHub Desktop.
Save jmettraux/1166586 to your computer and use it in GitHub Desktop.
def substitute_in_envfile(key, env_key=key)
return unless ENV[env_key]
runshell(
"sed -i \"s%@@#{key}@@%#{ENV[env_key]}%\" " +
"config/environments/#{ENV['RAILS_ENV']}.rb")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment