Permalink
Browse files

added --filename option to specify env file or plain --appenv to use …

…app name with .env extension
  • Loading branch information...
1 parent 2410bb6 commit fd406eafdbe0199dbb4ca6b34239af2830af0b53 @joelvh committed Apr 24, 2012
Showing with 7 additions and 2 deletions.
  1. +1 −0 .gitignore
  2. +6 −2 lib/config/heroku/command/config.rb
View
@@ -0,0 +1 @@
+.project
@@ -41,7 +41,9 @@ def push
private ######################################################################
def local_config
- File.read(".env").split("\n").inject({}) do |hash, line|
+ filename = extract_option("--filename", "#{app if extract_option('--appenv')}.env")
+
+ File.read(filename).split("\n").inject({}) do |hash, line|
if line =~ /\A([A-Za-z_]+)=(.*)\z/
hash[$1] = $2
end
@@ -56,7 +58,9 @@ def remote_config
end
def write_local_config(config)
- File.open(".env", "w") do |file|
+ filename = extract_option("--filename", "#{app if extract_option('--appenv')}.env")
+
+ File.open(filename, "w") do |file|
config.keys.sort.each do |key|
file.puts "#{key}=#{config[key]}"
end

0 comments on commit fd406ea

Please sign in to comment.