Skip to content

Instantly share code, notes, and snippets.

@toretore

toretore/run Secret

Last active August 29, 2015 14:18
Show Gist options
  • Save toretore/32c70bf8b8b0271571cb to your computer and use it in GitHub Desktop.
Save toretore/32c70bf8b8b0271571cb to your computer and use it in GitHub Desktop.
(cat vars.erb template.erb) | ruby t.rb
FOO = BAR
BAR = default bar
require 'erb'
class Context
def self.const_missing(name)
nil
end
def binding
super
end
end
print ERB.new(STDIN.read).result(Context.new.binding)
FOO = <%= FOO || 'default foo' %>
BAR = <%= BAR || 'default bar' %>
<%
FOO="BAR"
%>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment