Skip to content

Commit

Permalink
Merge pull request #183 from technomancy/app_root
Browse files Browse the repository at this point in the history
Look for .env and app_root in the same dir as the Procfile.
  • Loading branch information
ddollar committed Apr 23, 2012
2 parents 865cabb + 66f76c2 commit 55f2745
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion lib/foreman/cli.rb
Expand Up @@ -79,7 +79,10 @@ def check_procfile!
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
Expand Down
3 changes: 1 addition & 2 deletions lib/foreman/engine.rb
Expand Up @@ -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
Expand Down Expand Up @@ -214,7 +214,6 @@ def read_environment_files(filenames)
environment.merge!(Foreman::Engine.read_environment(filename))
end

environment.merge!(Foreman::Engine.read_environment(".env")) unless filenames
environment
end
end

0 comments on commit 55f2745

Please sign in to comment.