From 66f76c2036f5d76035bb2b3443f66b7a12230cfd Mon Sep 17 00:00:00 2001 From: Phil Hagelberg Date: Fri, 20 Apr 2012 20:59:37 -0700 Subject: [PATCH] Look for .env and app_root in the same dir as the Procfile. --- lib/foreman/cli.rb | 5 ++++- lib/foreman/engine.rb | 3 +-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/foreman/cli.rb b/lib/foreman/cli.rb index f7dc59b..8cdaf57 100644 --- a/lib/foreman/cli.rb +++ b/lib/foreman/cli.rb @@ -79,7 +79,10 @@ private ###################################################################### end def engine - @engine ||= Foreman::Engine.new(procfile, options) + root = File.expand_path(File.dirname(procfile)) + env = File.expand_path(File.join(root, ".env")) + @engine ||= Foreman::Engine.new(procfile, options.merge({:app_root => root, + :env => env})) end def procfile diff --git a/lib/foreman/engine.rb b/lib/foreman/engine.rb index 00766f1..7ed568f 100644 --- a/lib/foreman/engine.rb +++ b/lib/foreman/engine.rb @@ -22,7 +22,7 @@ class Foreman::Engine def initialize(procfile, options={}) @procfile = Foreman::Procfile.new(procfile) - @directory = options[:app_root] || File.expand_path(File.dirname(procfile)) + @directory = options[:app_root] @options = options.dup @environment = read_environment_files(options[:env]) @output_mutex = Mutex.new @@ -214,7 +214,6 @@ private ###################################################################### environment.merge!(Foreman::Engine.read_environment(filename)) end - environment.merge!(Foreman::Engine.read_environment(".env")) unless filenames environment end end